Skip to content

Enhance SKILL.md skill support in Kitfile generation#1092

Merged
gorkem merged 4 commits into
mainfrom
enhanced-skill
Mar 4, 2026
Merged

Enhance SKILL.md skill support in Kitfile generation#1092
gorkem merged 4 commits into
mainfrom
enhanced-skill

Conversation

@gorkem
Copy link
Copy Markdown
Member

@gorkem gorkem commented Feb 25, 2026

Treat directories with SKILL.md as prompt skills and prompt metadata comes from frontmatter instead of filename-based prompt detection.

Changes

  • Detect directories containing SKILL.md and treat them as skill prompts.
  • Parse frontmatter fields (name, description, license) from SKILL.md.
  • Apply frontmatter metadata to generated prompt entries and package metadata (without overriding explicit user package values).
  • Give root-level SKILL.md precedence and generate a single prompt with path ..
  • Update prompt unpack filtering to match prompt name with path fallback.
  • Add tests

@gorkem gorkem requested a review from Copilot February 25, 2026 18:51
@gorkem gorkem force-pushed the enhanced-skill branch 2 times, most recently from ea112ef to 356b833 Compare February 25, 2026 18:52
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Feb 25, 2026

Deploying kitops-org with  Cloudflare Pages  Cloudflare Pages

Latest commit: 04ff014
Status: ✅  Deploy successful!
Preview URL: https://b5b52283.kitops-org.pages.dev
Branch Preview URL: https://enhanced-skill.kitops-org.pages.dev

View logs

@gorkem gorkem requested a review from amisevsk February 25, 2026 18:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md frontmatter parsing and apply metadata to generated prompt entries and (conditionally) to package metadata.
  • Add root-level SKILL.md precedence behavior (single prompt at path ".").
  • Extend unpack filter logic/tests to match prompts by name or path, 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.

Comment thread pkg/lib/kitfile/generate/skill.go Outdated
Comment thread pkg/lib/kitfile/generate/skill.go Outdated
Comment thread pkg/lib/kitfile/generate/generate.go Outdated
Comment thread pkg/cmd/kitimport/util.go Outdated
Comment thread pkg/lib/kitfile/generate/generate.go Outdated
Comment thread pkg/lib/kitfile/generate/skill.go Outdated
Comment on lines +113 to +127
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)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it is a bug. This should promote it only if it is a prompt only package.

Comment on lines +235 to +236
applySkillMetadataToPackage(kitfile, *dir)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@gorkem gorkem merged commit 2496126 into main Mar 4, 2026
14 checks passed
@gorkem gorkem deleted the enhanced-skill branch March 4, 2026 17:52
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.

3 participants