rulesync icon indicating copy to clipboard operation
rulesync copied to clipboard

Support current Claude Code skill frontmatter fields

Open saitota opened this issue 6 months ago • 2 comments

Claude Code skills now document more frontmatter fields than Rulesync preserves for claudecode skills.

  • Docs: https://code.claude.com/docs/en/skills#frontmatter-reference
  • Docs: https://code.claude.com/docs/en/skills#run-skills-in-a-subagent
  • Current Claude Code skill schema: https://github.com/dyoshikawa/rulesync/blob/main/src/features/skills/claudecode-skill.ts#L21-L28
  • Current Rulesync skill schema: https://github.com/dyoshikawa/rulesync/blob/main/src/features/skills/rulesync-skill.ts#L12-L23

Missing examples from the docs include when_to_use, argument-hint, arguments, user-invocable, effort, context, agent, hooks, and shell. The docs also say allowed-tools accepts a space-separated string or a YAML list, while Rulesync currently models it as an array.

Expected behavior:

  • rulesync generate -t claudecode -f skills should preserve/generate the current Claude Code skill frontmatter fields where possible.
  • allowed-tools should accept both documented forms, or the limitation should be documented.

saitota avatar May 12 '26 06:05 saitota

Came across this while looking at how different tools handle the Claude Code skill schema. I maintain a multi-skill repo that uses most of these frontmatter fields in production, so figured I'd share what I've found in practice:

Fields that matter most for discoverability:

  • when_to_use is probably the highest-impact field to support — Claude uses it to decide whether to auto-load a skill, so if Rulesync strips it during generate, skills become invisible unless manually invoked.
  • allowed-tools as a YAML list (vs space-separated) is what most published skills use now. The space-separated form seems to be a legacy holdover.

Fields you might deprioritize:

  • hooks and shell are fairly niche (I've only seen them in CI-focused skills).
  • effort is rarely set manually — Claude infers it unless you explicitly override.

Re: the arguments + argument-hint pair: These are essential for invocable skills but irrelevant for auto-loaded ones. So the generation logic might need to branch based on whether user-invocable: true is set.

If it helps as a real-world reference, gingiris-skills has 11 skills using the current frontmatter format across different when_to_use patterns and invocation styles — might be useful as test fixtures when you're validating the expanded schema support.

Gingiris avatar May 22 '26 07:05 Gingiris

Upstream update (re-check on 2026-06-09)

This issue tracks skill frontmatter fields. A re-check found the parallel gap for subagents, which is the same class of issue (documented frontmatter fields not explicitly modeled).

Additional or changed gaps

  • subagents — current Claude Code subagent frontmatter fields not modeled. ClaudecodeSubagentFrontmatterSchema (src/features/subagents/claudecode-subagent.ts:20-27) validates only name, description, model, tools, permissionMode, skills. The official subagent reference documents additional fields: disallowedTools (denylist applied before tools), maxTurns, mcpServers, hooks, memory (user/project/local), background, effort (low…max), isolation (worktree), color, initialPrompt. Because the schema is z.looseObject and the round-trip spreads unknown keys (claudecode-subagent.ts:74-87, 107-117), a user can hand-author these in the claudecode: section and they survive — but they are not modeled, validated, or documented, and disallowedTools in particular has no first-class mapping alongside tools. Same remediation shape as the skills work here: add the documented fields to the schema, surface them in docs/reference/file-formats.md (the subagent section is currently absent for claudecode), and give disallowedTools first-class treatment.

References

  • https://code.claude.com/docs/en/sub-agents — "Supported frontmatter fields" + the --agents JSON list (current v2.1.x), enumerating disallowedTools/maxTurns/mcpServers/hooks/memory/background/effort/isolation/color/initialPrompt.

dyoshikawa avatar Jun 09 '26 07:06 dyoshikawa