| name | sync-commands |
| description | Synchronize OpenCode command markdown files from ~/.config/opencode/commands and generate docs/opencode/commands documentation. |
| license | MIT |
| compatibility | Reads command files from ~/.config/opencode/commands. |
| metadata | {"author":"hadenlabs","version":"0.1.0"} |
Synchronize slash command markdown files and generate command documentation.
Input: None required. The skill reads directly from ~/.config/opencode/commands.
Steps
-
Read source command files
Read all .md files from:
~/.config/opencode/commands
-
Synchronize command source into repository
Synchronize source files into:
Requirements:
- Create target directory when it does not exist
- Create missing files
- Update existing files when content changed
- Do not rewrite files when content is identical
-
Extract command metadata from each synchronized file
For each file in data/opencode/commands/*.md:
- Use deterministic kebab-case filename stem as command ID
- Command name:
/<command-id>
- Command description: frontmatter
description value (if present)
- Command content: preserve full markdown body for generated docs
-
Generate per-command documentation
For each synchronized command, generate one file in:
docs/opencode/commands/<command-id>.md
Include:
- Command name
- Command description
- Source file path (
data/opencode/commands/<file>.md)
- Command content
Use deterministic kebab-case file names.
-
Generate command index
Generate:
docs/opencode/commands/README.md
Index content:
- Title and short sync description
- Total command count
- List of generated commands with links and descriptions
-
Preserve idempotence
For synchronized files and generated docs/index:
- Update when output differs
- Skip rewriting when output is unchanged
Output
## OpenCode Commands Synchronization
Source read: ~/.config/opencode/commands/*.md
Synchronized: data/opencode/commands/
Generated docs: docs/opencode/commands/*.md
Generated index: docs/opencode/commands/README.md
Guardrails
- If source directory does not exist, return an explicit error
- Ignore non-markdown files in source directory
- Keep filename mapping deterministic (kebab-case)
- Do not modify source files under
~/.config/opencode/commands