Enhance SKILL.md skill support in Kitfile generation#1092
Conversation
ea112ef to
356b833
Compare
Deploying kitops-org with
|
| Latest commit: |
04ff014
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b5b52283.kitops-org.pages.dev |
| Branch Preview URL: | https://enhanced-skill.kitops-org.pages.dev |
There was a problem hiding this comment.
Pull request overview
Enhances Kitfile generation to treat directories containing SKILL.md as “skill prompts”, extracting prompt/package metadata from SKILL.md frontmatter and updating unpack filtering to support prompt selection by name (with path fallback).
Changes:
- Add skill detection +
SKILL.mdfrontmatter parsing and apply metadata to generated prompt entries and (conditionally) to package metadata. - Add root-level
SKILL.mdprecedence behavior (single prompt at path"."). - Extend unpack filter logic/tests to match prompts by
nameorpath, and add comprehensive skill-generation tests.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| testing/testdata/kitfile-generation/test_prompt-handling.yaml | Updates prompt-handling expectations to no longer treat SKILL.md as a special-cased prompt file in this fixture. |
| pkg/lib/kitfile/generate/skill_test.go | Adds tests covering frontmatter parsing, skill detection, root precedence, multi-skill behavior, and user overrides. |
| pkg/lib/kitfile/generate/skill.go | Implements SKILL.md frontmatter parsing, skill directory detection, prompt construction, and package metadata promotion. |
| pkg/lib/kitfile/generate/generate.go | Adds contextDir parameter, root skill precedence logic, and skill-directory handling during directory processing. |
| pkg/lib/filesystem/unpack/filter_test.go | Adds tests ensuring prompt unpack filtering works by name and by path fallback. |
| pkg/lib/filesystem/unpack/filter.go | Updates prompt filtering to match on Prompt.Name or Prompt.Path. |
| pkg/cmd/kitinit/cmd.go | Updates generator call site for new GenerateKitfile(..., contextDir) signature. |
| pkg/cmd/kitimport/util.go | Updates generator call site for new GenerateKitfile(..., contextDir) signature. |
| pkg/artifact/kitfile.go | Adds name field to artifact.Prompt for Kitfile serialization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
356b833 to
f910df9
Compare
| if len(skillFrontmatters) == 1 { | ||
| fm := skillFrontmatters[0] | ||
| if kitfile.Package.Name == "" { | ||
| kitfile.Package.Name = fm.Name | ||
| } | ||
| if kitfile.Package.Description == "" { | ||
| kitfile.Package.Description = fm.Description | ||
| } | ||
| } | ||
|
|
||
| first := skillFrontmatters[0] | ||
| if kitfile.Package.License == "" && first.License != "" { | ||
| kitfile.Package.License = first.License | ||
| output.Logf(output.LogLevelTrace, "Using license %q from skill %q", first.License, first.Name) | ||
| } |
There was a problem hiding this comment.
Hm, promoting skill details to the top-level package seems fragile. This is only called at the very end of the normal generation flow (excluding the short-cut "everything here is part of the skill" flow). Does it make sense to promote this information to the Kitfile's package if the Kitfile contains other content?
There was a problem hiding this comment.
Yeah, it is a bug. This should promote it only if it is a prompt only package.
| applySkillMetadataToPackage(kitfile, *dir) | ||
|
|
There was a problem hiding this comment.
Will this call ever have an effect? dir in this context is the directory used for kit init -- if it contains a skill.md, the block at the top
// SKILL.md: found at ROOT treat entire directory as a skill if found, skillPath := dirContainsSkillMD(*dir); found {
will early return on line 115.
There was a problem hiding this comment.
Yeap, when root has a SKILL.md this is unreachable — the early return on line 115 handles that case. This call covers the multi-skill layout where the root has no SKILL.md but immediate subdirectories do (e.g. docx/SKILL.md, xlsx/SKILL.md). Each subdir is added as a prompt by addDirToKitfile, and applySkillMetadataToPackage then promotes license to the package.
Treat directories with SKILL.md as prompt skills and prompt metadata comes from frontmatter instead of filename-based prompt detection. Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
Signed-off-by: Gorkem Ercan <gorkem.ercan@gmail.com>
2199b33 to
04ff014
Compare
Treat directories with SKILL.md as prompt skills and prompt metadata comes from frontmatter instead of filename-based prompt detection.
Changes