Sanitized single-commit public mirror of recipe-maintainer. - Removed test-ssh/.testenv (live creds); added test-ssh/.testenv.example placeholders. - Removed plans/ and planned-updates/ (deployment-planning docs) so no client/ deployment domains appear in the public repo. - All other secret stores were already gitignored. - docs.coopcloud.tech retained as a submodule (public upstream).
68 lines
3.4 KiB
Markdown
68 lines
3.4 KiB
Markdown
---
|
|
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/<name>.md` → skill name is `<name>`
|
|
- For `.claude/commands/includes/<name>.md` → skill name is `recipe-<name>` (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-name>/SKILL.md`:
|
|
|
|
```markdown
|
|
---
|
|
name: <skill-name>
|
|
description: <description from Claude command>
|
|
---
|
|
Read and follow the full instructions in `.claude/commands/<path-to-claude-command>.md`.
|
|
<argument context line, if the Claude command has an argument-hint>
|
|
```
|
|
|
|
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/<skill-name>.md`:
|
|
|
|
```markdown
|
|
---
|
|
description: <description from Claude command>
|
|
---
|
|
Load the `<skill-name>` 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-<name>` prefix convention for their OpenCode skill names.
|