Skip to content

feat(cli): add sm skill commands for managing Claude skills#138

Merged
antosubash merged 3 commits intomainfrom
claude/add-skills-cli-command-QYMU6
Apr 30, 2026
Merged

feat(cli): add sm skill commands for managing Claude skills#138
antosubash merged 3 commits intomainfrom
claude/add-skills-cli-command-QYMU6

Conversation

@antosubash
Copy link
Copy Markdown
Owner

Summary

Adds a new sm skill command branch to the CLI for managing Claude skills under .claude/skills, with the install state tracked in skills-lock.json (the file already existed in the repo without any tooling backing it).

Commands

  • sm skill add <name> [--source <src>] [--description <text>] [--force] [--dry-run] — Adds a skill to the project. Without --source, scaffolds a minimal SKILL.md. With --source it accepts:
    • GitHub: owner/repo, owner/repo/path, owner/repo/path@ref (branch / tag / SHA)
    • Local directory: any absolute or ./ / ../ path
  • sm skill update [name] [--ref <ref>] [--check] [--dry-run] — Re-fetches skills tracked in skills-lock.json and refreshes their content + computed hash. Without a name, updates every tracked non-scaffold skill. --check reports drift without writing. Returns exit code 2 when drift is detected (useful for CI).
  • sm skill list — Tabular view of installed skills, their source, ref, hash, and tracked / untracked / missing status.

Implementation notes

  • SkillsLockFile round-trips the existing skills-lock.json schema (version, skills{ source, sourceType, ref?, computedHash }).
  • SkillFetcher uses the GitHub Contents API (api.github.com/repos/.../contents/...) and falls back to the repo's default_branch when no ref is given. Honors GITHUB_TOKEN for higher rate limits.
  • Hashing is SHA-256 over a sorted path:hash manifest, so identical content produces a stable hash regardless of fetch order.
  • SkillWriter refuses to write outside the target skill directory (path-traversal guard) and creates a self-contained scaffold for new skills.

Test plan

  • dotnet build cli/SimpleModule.Cli/SimpleModule.Cli.csproj — clean build (TreatWarningsAsErrors).
  • dotnet csharpier check — formatting matches project standard.
  • sm skill --help, sm skill add --help, sm skill update --help render correctly.
  • sm skill add tmp-test-skill --description "..." — scaffolds .claude/skills/tmp-test-skill/SKILL.md and updates skills-lock.json.
  • sm skill add tmp-test-skill --description "..." --dry-run — prints planned changes without writing.
  • sm skill list — shows existing on-disk skills as untracked and the existing shadcn lock entry as missing (since its directory isn't present).
  • sm skill update --check — gracefully reports network failures (e.g., GitHub rate-limit 403) without crashing.
  • End-to-end fetch from GitHub once a real skill repo is reachable from the test environment (currently rate-limited locally).

Generated by Claude Code

- 'sm skill add <name>' scaffolds a new skill or fetches one from a
  GitHub repo ('owner/repo[/path][@ref]') or a local directory.
- 'sm skill update [name]' re-fetches tracked skills, supports --check
  for drift reporting and --dry-run.
- 'sm skill list' shows installed skills with sources and lock status.
- Tracks installed skills in skills-lock.json with computed SHA-256
  content hashes.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 29, 2026

Deploying simplemodule-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: e69b00e
Status: ✅  Deploy successful!
Preview URL: https://0db8005f.simplemodule-website.pages.dev
Branch Preview URL: https://claude-add-skills-cli-comman.simplemodule-website.pages.dev

View logs

claude and others added 2 commits April 30, 2026 05:20
- Wrap transport/IO/JSON exceptions in SkillFetcher.FetchAsync so callers
  catch a single InvalidOperationException instead of three identical
  catch blocks.
- Use a static shared HttpClient (matching NuGetVersionResolver) and
  drop the redundant per-command 'using var http = new HttpClient()'.
- Replace the 'scaffold' magic string with SkillSource.TypeIdScaffold.
- Flatten the dual Ref-override branch in SkillUpdateCommand into a
  single resolved-ref assignment.
- Drop unused FetchedSkillFile.Length.
@antosubash antosubash marked this pull request as ready for review April 30, 2026 07:00
@antosubash antosubash merged commit bf0b146 into main Apr 30, 2026
6 checks passed
@antosubash antosubash deleted the claude/add-skills-cli-command-QYMU6 branch April 30, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants