--- description: Ensure every Claude skill has a corresponding OpenCode skill alias allowed-tools: [Read, Write, Glob, Grep, Bash] --- # Sync Claude skills to OpenCode Ensure that every Claude command has a corresponding OpenCode skill and command that delegates to it. ## Steps 1. **List all Claude commands** — Glob `.claude/commands/*.md` (excluding `opencode-sync.md` itself) and `.claude/commands/includes/*.md`. 2. **List existing OpenCode skills** — Glob `.opencode/skills/*/SKILL.md` and `.opencode/commands/*.md`. 3. **For each Claude command**, determine the OpenCode skill name: - For `.claude/commands/.md` → skill name is `` - For `.claude/commands/includes/.md` → skill name is `recipe-` (following the existing convention, e.g. `guidelines` → `recipe-guidelines`) 4. **Read each Claude command's YAML frontmatter** to extract: - `description` — reuse as the OpenCode description - `argument-hint` — use to generate the argument context line 5. **For each missing OpenCode skill**, create `.opencode/skills//SKILL.md`: ```markdown --- name: description: --- Read and follow the full instructions in `.claude/commands/.md`. ``` The argument context line should describe what arguments are expected based on the `argument-hint`: - If `argument-hint` contains `recipe-name` → `The recipe name will be provided by the user or calling agent.` - If `argument-hint` contains `b1cc|t1cc` → `The instance name will be provided by the user or calling agent.` - If there is an `argument-hint` but no specific pattern matched → `Arguments will be provided by the user or calling agent.` - If there is no `argument-hint` → omit the argument context line entirely 6. **For each missing OpenCode command**, create `.opencode/commands/.md`: ```markdown --- description: --- Load the `` skill and execute it for $ARGUMENTS. ``` 7. **Detect orphaned OpenCode skills** — For each existing OpenCode skill/command, check whether it references a Claude command (by reading the `SKILL.md` body for the `.claude/commands/...` path). If the referenced Claude command no longer exists: - Check if the content/description closely matches a current Claude command that lacks an OpenCode equivalent (i.e., it was likely renamed). - If a rename is detected: delete the old OpenCode skill directory and command file, then create new ones under the correct name. - If no rename match is found: delete the orphaned OpenCode skill directory and command file (it references a dead Claude command). 8. **Update stale descriptions** — For each existing OpenCode skill/command that maps to a valid Claude command, read the Claude command's current `description`. If the OpenCode description differs, update it to match. 9. **Report results** — Print a summary of: - Skills created (new) - Skills renamed (old name → new name) - Skills deleted (orphaned, no rename match) - Skills updated (description changed) - Skills unchanged (already in sync) ## Important - Every Claude command must have exactly one corresponding OpenCode skill — no exceptions, including this `opencode-sync` command itself. - The includes (`guidelines.md`, `logging.md`) use the `recipe-` prefix convention for their OpenCode skill names.