Skip to content

fix(agent-core): relax directory skill frontmatter requirements to prevent silent skipping#657

Open
puppylpg wants to merge 1 commit into
MoonshotAI:mainfrom
puppylpg:main
Open

fix(agent-core): relax directory skill frontmatter requirements to prevent silent skipping#657
puppylpg wants to merge 1 commit into
MoonshotAI:mainfrom
puppylpg:main

Conversation

@puppylpg

Copy link
Copy Markdown

Related Issue

Closes #580

Problem

Kimi Code CLI creates a vicious cycle: the system prompt template does not explain the SKILL.md format, so the agent writes invalid skills for users, which are then silently discarded by the parser.

Root cause

packages/agent-core/src/skill/parser.ts enforced two strict checks on directory skills:

  1. Directory skills must start with a YAML frontmatter block (---).
  2. The frontmatter must contain both name and description.

If either check fails, a SkillParseError is thrown and caught in scanner.ts, where it is logged as a warning and the skill is skipped entirely. Users receive no visible feedback that their skills were ignored.

This is especially problematic because the code already contains fallback logic (name ?? skillDirName, description ?? firstBodyLine) that was unreachable due to the early throw.

Secondary cause

The system prompt template (system.md) does not mention frontmatter, required fields, or the directory-vs-flat distinction, so agents helping users write skills have no authoritative source for the correct format.

What changed

  1. parser.ts: Removed the strict frontmatter name/description requirements for directory skills. The existing fallback logic now works as intended: missing name falls back to the directory name, missing description falls back to the first non-empty body line.
  2. system.md: Added a "Skill format" section to the system prompt template that explains the optional YAML frontmatter block and its fields, so agents can author valid skills for users.
  3. scanner.test.ts: Updated the test that previously asserted skills were skipped; it now verifies the fallback behavior.
  4. Changeset: Generated .changeset/relax-skill-frontmatter-requirements.md with patch bumps for both @moonshot-ai/agent-core and @moonshot-ai/kimi-code.

Checklist

  • I have read the CONTRIBUTING document.
  • I have explained the problem above.
  • I have added tests that prove the fix works.
  • Ran gen-changesets skill.

@changeset-bot

changeset-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b38908c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/agent-core Patch
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

Agent-written user skills are silently discarded because system prompt omits SKILL.md format requirements

1 participant