@zhiban/skh
v0.1.8
Published
SkillHub CLI: install Claude Code skills from a SkillHub registry
Readme
skh
Install Claude Code skills from a SkillHub registry, the way npm install installs packages.
npm install -g @zhiban/skh
skh config set tenant <tenant-uuid> # optional: also see your tenant's skills
skh install code-reviewerThe registry defaults to http://44.217.230.241:31808/api/v1; override it with skh config set registry <url>.
Skills land in ~/.claude/skills/<name>/ (user scope) or ./.claude/skills/<name>/ (project scope) and are picked up by Claude Code immediately. In a terminal, skh install asks where to install (Enter = the Claude Code default) and whether to keep a folder or a zip; use --out <dir> / --format zip to skip the questions, e.g. to install into another tool's skills directory. The location is recorded, so list / update / verify / uninstall keep working.
Commands
| Command | What it does |
| --- | --- |
| skh install [name \| name/id \| tenant-id/name/id][@range] ... | Resolve, download, verify sha256, extract, install. A skill bundle installs each of its member skills. With no args, installs everything in skillhub.toml (or the lockfile). |
| skh uninstall <name...> | Remove the directory and the lockfile / manifest entries. |
| skh list | Installed skills (offline, reads the lockfile). |
| skh search <query> | Search the registry. |
| skh info <name> | Versions, requirements and the SKILL.md of a skill. |
| skh update [name...] | Upgrade to the newest version matching each skill's range. |
| skh outdated [name...] | Show available upgrades without installing. |
| skh verify [name...] | Re-hash installed files against the lockfile. |
| skh doctor | Registry connectivity and local setup checks. |
| skh cache dir \| clean | Content-addressed package cache. |
| skh config list \| get \| set \| unset | Read / write ~/.skillhub/config.toml. |
| skh init | Write a SKILL.md skeleton in the current directory. |
Version ranges: 1.2.3, ^1.2.3, ~1.2.3, >=1.2.0, latest, next. Installing without a range records ^<version> (same as npm). Range resolution happens on the server, so the CLI and the registry never disagree.
Global flags: --registry <url>, --scope user|project, --dir <path>, --timeout 30s, --json, --verbose.
Scopes
- user (default):
~/.claude/skills/, lockfile at~/.skillhub/lock.json. - project:
./.claude/skills/, manifest./skillhub.toml, lockfile./skillhub-lock.json. Chosen automatically whenskillhub.tomlexists in the current directory;--scopealways wins.
# skillhub.toml
registry = "https://skillhub.example.com/api/v1"
[skills]
"code-reviewer" = "^1.2.0"
"pdf-filler" = "2.0.1"Commit both files; skh install with no arguments reproduces the same versions on another machine.
Configuration
Five layers, later wins: built-in defaults → ~/.skillhub/config.toml → ./skillhub.toml (only registry, [install], [headers]) → environment → flags.
# ~/.skillhub/config.toml
registry = "https://skillhub.example.com/api/v1"
[install]
scope = "user" # or "project"
# dir = "/custom/path"
[cache]
dir = "~/.skillhub/cache"
[network]
timeout = "30s"
retries = 3
[verify]
checksum = true # keep on
[headers] # private deployments behind an identity gateway
# X-Tenant-Id = "..."Environment: SKILLHUB_REGISTRY, SKILLHUB_INSTALL_SCOPE, SKILLHUB_INSTALL_DIR, SKILLHUB_CACHE_DIR, SKILLHUB_TIMEOUT. Tests and multi-account setups can relocate state with SKILLHUB_HOME (default ~/.skillhub) and SKILLHUB_CLAUDE_HOME (default ~/.claude).
Safety
- The package's sha256 from the registry is checked before anything is extracted; each extracted file is checked against the registry's per-file hashes.
- Zip entries that would escape the install directory (
../, drive letters) are refused even if the package hash is valid. - Installs replace the skill directory in three renames (new → tmp, old → aside, tmp → final) on the same filesystem, so a crash never leaves a half-written skill. Stale
.tmp-*/.old-*directories are cleaned up on the next run. requires_bins/requires_env/supported_osdeclared by a skill are checked before install and reported as warnings;--strict-requirementsturns them into errors.
Exit codes: 1 general, 2 usage, 3 checksum / integrity failure, 4 not found, 5 registry unreachable.
Development
npm install
npm test # vitest: unit + end-to-end against an in-process fake registry
npm run build # tsc → dist/
node dist/cli.js --helpThe registry contract this CLI implements is SkillHub/docs/registry-api.md.
