CLI commands
The spm CLI covers the four main actions of skill management: add, init, install, and update.
spm add
Add a skill to your project.
Behavior overview:
- Perform a shallow clone of the GitHub repository
- Scan
SKILL.mdfiles and discover candidate skills - Select interactively or target a specific skill with
--skill - Write to
skills.json - Immediately install and link the new skill
spm init
Initialize skills.json in the current project.
Init behavior:
spm initprompts forinstallDirand additionallinkTargetsspm init --yeswrites default values directly- Fails if
skills.jsonalready exists - Does not create
skills-lock.yaml
spm install
Install all skills declared in skills.json.
Useful for:
- Initializing a new environment
- Restoring skill dependencies in CI
- Re-syncing the local skill directory after changing the manifest
Install Process
When you run spm install, the following happens:
- Read manifest — Load
skills.jsonto get the list of skills to install - Read lockfile — Load
skills-lock.yamlif it exists - Sync lockfile — Resolve each skill in the manifest to produce the lockfile entries for this install
- This step may involve git/network requests, even when a corresponding entry already exists in
skills-lock.yaml
- This step may involve git/network requests, even when a corresponding entry already exists in
- Prune — Remove skills that are no longer in the manifest
- Fetch — Download/copy skills to
installDir - Link — Create symlinks in
linkTargets - Write lockfile — Save updated
skills-lock.yaml
--frozen-lockfile
Prevent lockfile modifications and fail if it's out of sync.
When to use:
- CI/build environments where you want reproducible installs
- When you want to ensure the lockfile is not accidentally modified
- When you want faster installs (no git network requests to resolve refs)
Behavior differences from normal install:
Error scenarios:
Troubleshooting
Install fails with "Lockfile is out of sync"
This means the specifiers in skills.json don't match what's in skills-lock.yaml. Common causes:
- You edited
skills.jsonmanually without updating the lockfile - Someone else committed a new lockfile and your manifest is outdated
Solutions:
- Run
spm installwithout--frozen-lockfileto update the lockfile - Or revert your manifest changes to match the lockfile
spm update
Refresh already-declared git-based skills.
Update behavior:
- Uses
skills.jsonas the source of truth - Re-resolves git refs to the latest commit
- Skips local
file:skills - Fails immediately on unknown skill names
- Writes back
skills-lock.yamlonly after fetch and link both succeed