feat: pin agent definitions next to skills
A source can install agents (agents/<name>.md files with a frontmatter name) alongside or instead of skills. - manifest: optional "agents" selection; lock: "agents" map - add --agent / --all-agents, remove --agent, list shows the kind - check/update diff agents like skills (files, not directories) - dashboard lists and removes agents - home-manager module: agentTargets (default .claude/agents) links <name>.md Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0aedef8c8c
commit
df8d11d8cb
15 files changed
+648
-131
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
**Pin agent skills from git repos with Nix, and update them only after you've reviewed the diff.**
|
||||
|
||||
`skm` manages [agent skills](https://docs.claude.com/en/docs/claude-code/skills) (directories containing a `SKILL.md`) that come from git repositories. Each repo is pinned to a commit and a Nix `narHash`. Nix fetches the pinned sources and home-manager links every skill into `~/.claude/skills` and `~/.agents/skills`. `skm` only ever edits two JSON files.
|
||||
`skm` manages [agent skills](https://docs.claude.com/en/docs/claude-code/skills) (directories containing a `SKILL.md`) and subagent definitions (`agents/<name>.md` files) that come from git repositories. Each repo is pinned to a commit and a Nix `narHash`. Nix fetches the pinned sources and home-manager links every skill into `~/.claude/skills` and `~/.agents/skills`, and every agent into `~/.claude/agents`. `skm` only ever edits two JSON files.
|
||||
|
||||
- **Reproducible**: a lockfile with commit and hash for every source, evaluated by Nix.
|
||||
- **Reviewed updates**: see the diff of every changed skill before it is applied.
|
||||
@@ -58,6 +58,7 @@ Add the flake as an input and import its home-manager module:
|
||||
| `manifestDir` | | Directory holding `skills.json` and `skills.lock.json` |
|
||||
| `lockFile` | | The lockfile as a path inside your flake; pure evaluation can't read `manifestDir` |
|
||||
| `targets` | `[ ".claude/skills" ".agents/skills" ]` | Directories, relative to home, that get one symlink per skill |
|
||||
| `agentTargets` | `[ ".claude/agents" ]` | Directories, relative to home, that get one `<name>.md` symlink per agent |
|
||||
| `switchCommand` | `""` | Command `skm update --switch` runs to apply a new lock |
|
||||
| `package` | this flake's `skm` | The `skm` package to install |
|
||||
|
||||
@@ -88,7 +89,8 @@ In the diff review, `y` accepts a source, `n` skips it, and `tab`/`shift+tab` mo
|
||||
skm add github:mattpocock/skills # pick skills interactively
|
||||
skm add github:mattpocock/skills --skill tdd,grilling=grilling-mp
|
||||
skm add git+ssh://git@host/me/skills --ref main --all
|
||||
skm list # installed skills, source, short rev
|
||||
skm add github:cursor/plugins --agent pstack/agents/comment-sicko.md=comment-sicko
|
||||
skm list # installed skills and agents, source, short rev
|
||||
skm outdated # changed, added and removed skills upstream
|
||||
skm update # review diffs, then write the lock
|
||||
skm update tdd --yes --switch # no review, then run switchCommand
|
||||
@@ -98,9 +100,9 @@ skm import --diff # migrate from vercel's skil
|
||||
|
||||
| Command | Description |
|
||||
|---|---|
|
||||
| `add <url> [--ref R] [--name N] (--skill a,b=alias,dir/c \| --all)` | Prefetch a repo, choose skills, write manifest and lock. Adding to an existing source keeps its pin. |
|
||||
| `remove <name>` / `remove --source <source>` | Remove one skill (and the source once it's empty), or a whole source |
|
||||
| `list` | Installed skills with source, rev and path |
|
||||
| `add <url> [--ref R] [--name N] [--skill a,b=alias,dir/c \| --all] [--agent a,b=alias,dir/c.md \| --all-agents]` | Prefetch a repo, choose skills and/or agents, write manifest and lock. Adding to an existing source keeps its pin. |
|
||||
| `remove <name>` / `remove --agent <name>` / `remove --source <source>` | Remove one skill or agent (and the source once it's empty), or a whole source |
|
||||
| `list` | Installed skills and agents with source, rev and path |
|
||||
| `outdated [source\|skill...]` | Prefetch sources in parallel and report changes |
|
||||
| `update [source\|skill...] [--yes] [--switch]` | Review and apply updates. Without a terminal, diffs are printed and confirmed on stdin. |
|
||||
| `import [--from lock] [--local dir] [--diff]` | Import `~/.local/state/skills/.skill-lock.json` and compare against committed skill copies |
|
||||
@@ -136,6 +138,8 @@ Non-goals: non-git sources (tarballs, registries, local paths), patches or overl
|
||||
- `"as"` renames a skill. Two skills with the same installed name are an error.
|
||||
- `"path"` picks a skill by directory, for repos that ship the same name twice.
|
||||
- To hold one skill back, add a second source entry for the same repo with its own `ref`.
|
||||
- `"agents"` takes the same forms as `"skills"` (`"*"`, names, `"as"`, `"path"`) and is optional. An agent is a `.md` file directly inside a directory named `agents`, with a `name:` in its frontmatter; `"path"` is the file. Repos that ship the same agent twice (a Cursor and a Claude Code copy) need `"path"`. A source may install only agents (`"skills": []`).
|
||||
- Updates review agents like skills: an agent counts as outdated only when its own file changes.
|
||||
|
||||
`skills.lock.json` (written by `skm`):
|
||||
|
||||
@@ -145,7 +149,8 @@ Non-goals: non-git sources (tarballs, registries, local paths), patches or overl
|
||||
"sources": {
|
||||
"mattpocock": {
|
||||
"locked": { "type": "github", "owner": "mattpocock", "repo": "skills", "rev": "abc123…", "narHash": "sha256-…" },
|
||||
"skills": { "tdd": "skills/tdd", "prototype": "skills/prototype", "grilling-mp": "skills/grilling" }
|
||||
"skills": { "tdd": "skills/tdd", "prototype": "skills/prototype", "grilling-mp": "skills/grilling" },
|
||||
"agents": { "comment-sicko": "pstack/agents/comment-sicko.md" }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,6 +177,6 @@ The end-to-end tests create a temporary `git+file://` repo and need `nix` on `PA
|
||||
| `internal/core/` | add, remove, outdated, update and import operations |
|
||||
| `internal/fetch/` | `Fetcher` interface and the `nix flake prefetch` implementation |
|
||||
| `internal/manifest/`, `internal/lock/` | `skills.json` and `skills.lock.json` |
|
||||
| `internal/skills/` | `SKILL.md` discovery and subtree comparison |
|
||||
| `internal/skills/` | `SKILL.md` and agent definition discovery |
|
||||
| `internal/tui/` | bubbletea dashboard, picker and diff review |
|
||||
| `nix/module.nix` | home-manager module |
|
||||
Reference in new issue
Block a user