Add --as-skill flag to kit unpack for agent skill installation#1158
Merged
gorkem merged 10 commits intokitops-ml:mainfrom Apr 18, 2026
Merged
Add --as-skill flag to kit unpack for agent skill installation#1158gorkem merged 10 commits intokitops-ml:mainfrom
gorkem merged 10 commits intokitops-ml:mainfrom
Conversation
Prompt layers containing SKILL.md can now be installed directly as agent skills (Claude Code, Cursor, Windsurf, etc.) via --as-skill. Auto-discovers installed agents when no agents are specified. Installs globally by default; use -d for project-scoped installation. Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
Use the listing context directory when reading SKILL.md so parsing works reliably for nested paths and shifted working directories. This prevents false read failures and preserves skill metadata population during kitfile generation. Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
Ensure close and filesystem operations do not silently fail during prompt-to-skill install and related tests. Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new “skill installation” mode to kit unpack so prompt layers containing SKILL.md can be installed as agent skills (with auto-detection and per-agent installation paths), while also consolidating SKILL frontmatter parsing into a shared library.
Changes:
- Introduces
pkg/lib/skill(agent registry/detection, skill name derivation, tar skill-layer reading/frontmatter parsing, and installation logic). - Extends
kit unpackwith--as-skill[=agents...]to install qualifying prompt layers as agent skills (global by default, project-scoped when-dis explicitly set). - Updates kitfile generation to reuse shared SKILL frontmatter parsing and fixes relative-path reading by tracking
ContextDir.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/lib/skill/skillfile.go | Reads prompt-layer tars, detects SKILL.md, parses YAML frontmatter |
| pkg/lib/skill/skillfile_test.go | Unit tests for skill-layer reading and frontmatter parsing |
| pkg/lib/skill/sanitize.go | Skill-name sanitization and name derivation rules |
| pkg/lib/skill/sanitize_test.go | Tests for sanitization/derivation behavior |
| pkg/lib/skill/install.go | Installs extracted tar entries into per-agent skill directories; strips prompt path prefixes |
| pkg/lib/skill/install_test.go | Installation tests (overwrite/ignore/dedup/prefix stripping) |
| pkg/lib/skill/agents.go | Registry of supported agents + detection and path resolution |
| pkg/lib/skill/agents_test.go | Minimal registry/config test coverage |
| pkg/lib/kitfile/generate/filesystem.go | Adds ContextDir so generated listings can resolve paths correctly |
| pkg/lib/kitfile/generate/skill.go | Switches frontmatter parsing to shared skill package; uses ContextDir |
| pkg/lib/kitfile/generate/skill_test.go | Updates tests for new parsing signature and SKILL filename expectations |
| pkg/lib/filesystem/unpack/options.go | Adds SkillOptions to enable skill-mode behavior |
| pkg/lib/filesystem/unpack/core.go | Implements prompt-layer “install as skill” path and summary/error handling |
| pkg/cmd/unpack/cmd.go | Adds --as-skill CLI flag and parses agent auto-detect / explicit agent list |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fail fast in GetGlobalSkillsDir and DetectInstalledAgents when user home directory cannot be determined - Fix stale comment referencing path.Rel in stripPromptPrefix - Align copyright year to 2026 in sanitize_test.go Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
5688676 to
76e2183
Compare
amisevsk
reviewed
Apr 9, 2026
Return prefix-strip errors from InstallSkill so unpack fails fast on misaligned prompt paths. Validate skill names and tar entry paths before writes to prevent unsafe or partial installs. Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
Handle single-file prompts only when the layer contains exactly one matching file entry, preventing directory prompt layers from being misclassified and stripped incorrectly. Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
Make sanitizeName return empty for invalid/blank input and move "unnamed-skill" fallback into DeriveSkillName so fallback priority is preserved before defaulting. Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
a66b694 to
770971c
Compare
amisevsk
reviewed
Apr 16, 2026
Make sanitizeName return empty for invalid/blank input and move "unnamed-skill" fallback into DeriveSkillName so fallback priority is preserved before defaulting. Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
770971c to
72fc15f
Compare
amisevsk
approved these changes
Apr 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--as-skillflag tokit unpackthat installs SKILL.md prompt layers as agent skills for 45+ coding agents (Claude Code, Cursor, Windsurf, etc.)--as-skill=claude-code,cursor-dis specifiedpkg/lib/skillpackage, fixing a pre-existing bug wherekit initcouldn't read SKILL.md when run from a parent directoryNew package:
pkg/lib/skill/agents.gosanitize.goskillfile.goinstall.go