AI Engineering
Library Skills: Keep AI Agent Instructions Up to Date Automatically with Python and TypeScript CLI
Featured AnalysisAI EngineeringNov 30, 2026

Library Skills: Keep AI Agent Instructions Up to Date Automatically with Python and TypeScript CLI

Learn how Python and JS/TS libraries ship AI agent instructions, how Library Skills keeps them updated, and how to avoid the home folder trap.

+ Featured AnalysisReading: 11 min

Library Skills for AI Agents

  • Library Skills allows packages to ship their own agent instructions directly inside the package under .agents/skills/
  • The library-skills CLI scans dependencies and creates relative symbolic links to keep agent skills synchronized
  • Upgrading a dependency automatically updates its corresponding agent skill without manual intervention
  • Integrating library-skills into pre-commit hooks ensures agent instruction links never go out of date

Does your agent write FastAPI the 2023 way?

Mine did. I ran the official FastAPI skill against the backend of one of my projects, the editorial-manager, and the linter flagged 170 problems. 141 of them were Depends() without Annotated. None of them broke a test. All of them were patterns the docs had already moved away from.

The code wasn't sloppy. It was written with help from a model trained on older code, and I had no way of knowing what had changed.

Library Skills solves exactly that — for any Python or JS/TS package that ships its own skill. I first ran into it while testing FastAPI on my backend, but it isn't tied to one framework: I'll show how it works, how to set it up in 2 minutes, and what changed in the project.

The problem with generic skills#

A skill is a folder with a SKILL.md: a name, a description and instructions the agent reads when a task calls for them. The format is open (agentskills.io) and works in Claude Code, Cursor, Codex and several others.

The format is fine. The problem is who writes the skill.

Search any public catalog for "fastapi skill". You get dozens, each written by a different person, each pinned to a different version: "FastAPI 0.115+", "Pydantic v2 required", "Uvicorn 0.34". None of them knows which version is installed in your project. And when the next FastAPI release lands, nobody promises the author will come back to update it.

Result: you swap an outdated model for an outdated skill.

The idea: the skill lives in the package#

Library Skills, created by Sebastián Ramírez (the author of FastAPI), is a language- and library-agnostic CLI built in parallel for Python and TypeScript. It proposes one simple rule: any library can publish its own skill inside its package, in an .agents/skills/ folder. FastAPI and Streamlit are early Python examples, and the same workflow covers JS/TS packages and workspaces (uv, npm, and Bun).

For FastAPI, the skill lives at:

TEXT
fastapi/.agents/skills/fastapi/SKILL.md

Install the package and the skill comes with it. In your Python project, it shows up here:

TEXT
.venv/lib/python3.14/site-packages/fastapi/.agents/skills/fastapi/
├── SKILL.md
└── references/
    ├── dependencies.md
    ├── path-operations.md
    ├── pydantic.md
    ├── responses.md
    └── streaming.md

JavaScript works the same way, inside node_modules. The example in the docs is TanStack Router: node_modules/@tanstack/react-router/.agents/skills/tanstack-router/SKILL.md.

Three things change:

  1. The people who wrote the API write the skill. Nobody knows better what is deprecated.

  2. The skill matches your library version. You don't read FastAPI 0.165 instructions with 0.141 installed.

  3. Upgrading the library upgrades the skill. There is no second step.

Want to see item 2 happen? I downloaded several FastAPI packages straight from PyPI and counted the skill files in each one:

FastAPI version

Files in the skill

0.135.0

1 (just SKILL.md)

0.138.0

4

0.139.0 to 0.141.1

7

0.165.0

9 (added parameter-models.md and fastapi-cloud.md)

The skill grows with the library. If you're on 0.141, you get the 0.141 skill.

Setting it up in 2 minutes#

Your agent doesn't look inside .venv or node_modules on its own. That's where the library-skills CLI comes in: it scans your dependencies, finds the libraries that ship a skill and creates a link for each one in the folder your agent reads.

From the project root:

bash
# Python project
uvx library-skills

# JavaScript/TypeScript project
npx library-skills

# Using Claude Code? It doesn't read .agents/ yet, so install into .claude/skills
uvx library-skills --claude

The CLI reads pyproject.toml or package.json — scanning both Python and Node.js environments regardless of whether you invoke uvx or npx — shows a status table, and asks where to install. The default target is .agents/skills (supported by Codex, Cursor, GitHub Copilot, Pi, Antigravity, and OpenCode). With --claude, it installs into .claude/skills too. For scripts and CI, you can use --yes, scan --json, and list --json.

The detail that makes it all work: the CLI creates a symbolic link, not a copy. The link points to the folder inside the installed package. Upgraded FastAPI with uv lock --upgrade-package fastapi && uv sync? The link now points to the new skill. No extra command.

The links are relative, so you can commit them. Anyone who clones the repository gets the same skills after uv sync (before that, the links are broken, which is expected). On Windows, symbolic links may require Developer Mode. If that's a problem, use --copy, knowing the skill will no longer update on its own.

The statuses the CLI shows#

Running the CLI again is safe. It only touches the links it created itself, and never deletes a skill you wrote by hand. Each skill shows up with a status:

Status

What it means

new

the library ships a skill, but it isn't installed

up to date

installed and pointing at the current version

outdated

the link points to an old path

broken

the link target no longer exists

orphaned

the library left the project

hand-authored

a folder written by hand; the CLI leaves it alone

name mismatch

a symlink whose directory name does not match the skill it points to

To make sure nobody forgets, put the check in pre-commit. --check changes nothing: it only exits with code 1 if a link is out of place.

yaml
# .pre-commit-config.yaml
repos:
  - repo: local
    hooks:
      - id: library-skills
        name: library-skills --check
        entry: uvx library-skills --check
        language: system
        # Only runs when dependencies change
        files: ^(pyproject\.toml|uv\.lock|package\.json|package-lock\.json)$
        pass_filenames: false

If the hook fails, run uvx library-skills, accept the repairs and commit.

Case study: what changed in my FastAPI backend#

The editorial-manager is the backend behind this blog: FastAPI 0.141.1, about 15 AI agents, queued jobs and a few thousand lines that I and several agents wrote over months.

I installed the skill and asked the agent to review the code with it. The most repeated pattern was this one:

python
# Before: the old way, spread across 141 places
def get_current_user(
    token: str | None = Depends(oauth2_scheme),
    db: Session = Depends(get_db),
):
    ...

The official skill asks for Annotated and an alias for each reused dependency:

python
from typing import Annotated

from fastapi import Depends
from sqlalchemy.orm import Session

# One alias per dependency: the signature stays short
# and the type still holds outside FastAPI (tests, direct calls)
TokenDep = Annotated[str | None, Depends(oauth2_scheme)]
SessionDep = Annotated[Session, Depends(get_db)]


def get_current_user(token: TokenDep, db: SessionDep):
    ...

The other findings were of the same kind:

  • prefix in include_router() in 12 places. The skill wants prefix, tags and shared dependencies on the APIRouter itself.

  • ... as the default value of a required field. The skill says it isn't needed and isn't recommended.

  • response_model repeating the return type. With the return type declared, FastAPI already validates, filters and documents.

Result after five commits, one per topic: the count dropped from 170 to 43 warnings, with all 345 tests passing. The 43 left are in modules I froze on purpose.

The skill guides, the linter enforces#

One thing I learned along the way: the skill teaches the agent, but it doesn't stop the next commit from bringing the old pattern back. The linter does.

Ruff has a group of rules just for FastAPI. FAST002 catches exactly the Depends() without Annotated, FAST001 catches the redundant response_model and FAST003 catches a path parameter that is declared and never used. Along with them, turn on the ASYNC rules, which catch blocking calls inside async functions:

toml
# pyproject.toml
[tool.ruff.lint]
extend-select = ["FAST", "ASYNC"]

The 170 at the start came from a make lint-fastapi target with these rules. The split is simple: the skill makes the agent write it right the first time, and Ruff blocks whatever slips through, whether it came from the agent or from you.

The day I ran it in the wrong folder#

Before installing it in the right project, I ran uvx library-skills in my home folder. This is what the CLI did:

TEXT
 context
Project root               /home/g
Target Python environment  not found
node_modules               node_modules

 Removed orphaned symlink:  a2ui (claude-compatible) -> .claude/skills/a2ui
 Removed orphaned symlink:  gemini-api-dev (claude-compatible) -> .claude/skills/gemini-api-dev
 Removed orphaned symlink:  remotion (claude-compatible) -> .claude/skills/remotion
 ... 37 more lines like these ...
 Copied:  library-skills (universal) -> .agents/skills/library-skills
 Copied:  library-skills (claude-compatible) -> .claude/skills/library-skills

Reading it top to bottom:

  1. It treated my home folder as a project. Project root: /home/g. Because the CLI scans both Python and Node.js environments regardless of whether you run uvx or npx, finding a node_modules folder in /home/g was enough — even with no .venv and no library skill inside it.

  2. It removed 40 links from my ~/.claude/skills. I had installed those skills with another tool, npx skills add, which keeps the real skill in .agents/skills/ and creates a link in .claude/skills/ so Claude Code can see it. That's the same layout Library Skills uses for its own links. The CLI saw links in that shape, found no installed package that explained them and marked them all as orphaned. In the cleanup I accepted without reading the whole list, they were gone.

  3. It copied its own skill (library-skills) into both folders, so agents know how to run the CLI. Note the Copied: it's a copy, so this one doesn't update itself like the library skills do.

The content of the 40 skills wasn't lost. The folders stayed in ~/.agents/skills/, and the CLI listed each one as hand-authored. What disappeared was the link. But Claude Code reads ~/.claude/skills, not ~/.agents, so as far as it was concerned, the 40 skills were gone.

To recreate the links, paste this command into your terminal. It works in bash and zsh, from any folder:

bash
cd ~/.claude/skills && for dir in ../../.agents/skills/*/; do name=$(basename "$dir"); [ -e "$name" ] || [ -L "$name" ] || ln -s "../../.agents/skills/$name" "$name"; done; ls -l ~/.claude/skills

For each skill in ~/.agents/skills, it creates the link in ~/.claude/skills, but only when nothing with that name exists yet. Real folders and links already there stay untouched, so you can run it twice without breaking anything. The ls -l at the end shows the result. On my machine it looked like this (I cut the list short):

TEXT
total 48
lrwxrwxrwx 1 g g 25 Nov 30 15:59 a2ui -> ../../.agents/skills/a2ui
lrwxrwxrwx 1 g g 35 Nov 30 15:59 a2ui-migration -> ../../.agents/skills/a2ui-migration
lrwxrwxrwx 1 g g 37 Nov 30 15:59 adspower-browser -> ../../.agents/skills/adspower-browser
lrwxrwxrwx 1 g g 35 Nov 30 15:59 gemini-api-dev -> ../../.agents/skills/gemini-api-dev
lrwxrwxrwx 1 g g 47 Nov 30 15:59 google-agents-cli-adk-code -> ../../.agents/skills/google-agents-cli-adk-code
lrwxrwxrwx 1 g g 26 Nov 30 15:59 jotai -> ../../.agents/skills/jotai
...

How to read it: the l at the start of the line (lrwxrwxrwx) says it's a link, and the arrow shows where it points. If the target didn't exist, the link would be broken and Claude Code still wouldn't see the skill. The real folders already in ~/.claude/skills show up in the same list starting with d, with no arrow, just as they were.

To count how many links came back:

bash
ls -l ~/.claude/skills | grep -c '^l'

Why one line and no comment? Because in zsh, the default shell on macOS, a # pasted into the terminal isn't treated as a comment. In the first version of this article, the command had a comment in the middle, and zsh answered number expected on every pass of the loop.

The lesson: run Library Skills at the root of a project, never in your home folder. And if you already use another skills tool in the same folder, run uvx library-skills --check first, which validates the state without changing any file, and read the removal list before you confirm.

Two things to watch before you install everything#

A skill is text your agent obeys. A skill inside node_modules was written by whoever published the package. For FastAPI, Streamlit or TanStack, that's exactly what you want. For an obscure package with three downloads a week, it's a door for malicious instructions. Install skills from libraries you trust, and look at the SKILL.md diff when a big update lands.

Not every library publishes a skill yet. The docs name FastAPI and Streamlit as examples. Run uvx library-skills scan in your project to see which of your dependencies already ship one. The ones that don't still need another source.

Sources#

#Claude Code#Python#AI Agents