Skip to content

fix(skills): emit OpenCode-recognized SKILL.md frontmatter fields - #1800

Merged
dyoshikawa merged 2 commits into
mainfrom
resolve-scrap-issue-1787-opencode-skill-frontmatter
Jun 9, 2026
Merged

fix(skills): emit OpenCode-recognized SKILL.md frontmatter fields#1800
dyoshikawa merged 2 commits into
mainfrom
resolve-scrap-issue-1787-opencode-skill-frontmatter

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Summary

OpenCode's SKILL.md parser recognizes exactly five frontmatter fields: name, description, license, compatibility, and metadata (verified against https://opencode.ai/docs/skills.md). Unknown fields such as allowed-tools are ignored.

rulesync previously emitted only allowed-tools (ignored by OpenCode) and dropped the three recognized optional fields. This PR maps license/compatibility/metadata into the generated SKILL.md.

Changes

  • rulesync-skill.ts: extend the opencode section schema and input type with license/compatibility/metadata.
  • opencode-skill.ts:
    • Add license/compatibility/metadata to OpenCodeSkillFrontmatterSchema; keep allowed-tools as a lossless round-trip passthrough with a comment noting OpenCode ignores it.
    • fromRulesyncSkill: emit the three fields, preferring the opencode section value and falling back to top-level rulesync frontmatter (read safely from the loose object). Only defined keys are emitted.
    • toRulesyncSkill: carry the fields (and allowed-tools) back into the opencode section, only attaching it when non-empty.
  • Tests: round-trip coverage plus the issue scenario (top-level license: reaches the generated frontmatter) and section-over-top-level precedence.

Notes

  • Source precedence: opencode section value wins; otherwise top-level value is used.
  • allowed-tools is retained only for lossless round-trip (OpenCode does not recognize it).

Closes #1787
#1787

🤖 Generated with Claude Code

cm-dyoshikawa and others added 2 commits June 9, 2026 09:36
OpenCode's SKILL.md parser recognizes exactly five frontmatter fields:
name, description, license, compatibility, and metadata. The OpenCode
skill adapter previously emitted only allowed-tools (ignored by OpenCode)
and dropped the three recognized optional fields.

Map license/compatibility/metadata into the generated SKILL.md, sourcing
each from the opencode section first and falling back to the top-level
rulesync frontmatter. allowed-tools is kept as a lossless round-trip
passthrough even though OpenCode ignores it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add an opencode: section to the skill frontmatter reference (license,
compatibility, metadata, and the allowed-tools passthrough), keeping the
Each File Format docs in sync with the new mapping (review finding).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dyoshikawa
dyoshikawa merged commit 2274ed2 into main Jun 9, 2026
8 checks passed
@dyoshikawa
dyoshikawa deleted the resolve-scrap-issue-1787-opencode-skill-frontmatter branch June 9, 2026 16:50
@dyoshikawa

Copy link
Copy Markdown
Owner Author

@dyoshikawa Thank you!

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.

Follow up OpenCode upstream updates: skill SKILL.md frontmatter (license/compatibility/metadata vs allowed-tools)

2 participants