Skip to content

feat(AI-012): port Claude skills to OpenCode commands#43

Merged
mlorentedev merged 1 commit into
mainfrom
feat/AI-012-opencode-commands-port
May 18, 2026
Merged

feat(AI-012): port Claude skills to OpenCode commands#43
mlorentedev merged 1 commit into
mainfrom
feat/AI-012-opencode-commands-port

Conversation

@mlorentedev
Copy link
Copy Markdown
Owner

Summary

First concrete chunk of the AI-015-harness-parity-across-agents umbrella. Ports the 17 Claude Code skills under ai/skills/<name>/SKILL.md into 12 OpenCode commands under ai/opencode/commands/<name>.md. 5 Claude-only skills are deliberately skipped.

What

  • scripts/skills-to-opencode.sh — deterministic AWK-based transform. Drops name: from frontmatter (OpenCode uses the filename as command identifier), keeps description:, copies body verbatim.
  • ai/opencode/commands/*.md — 12 generated files committed to repo, in sync with their ai/skills/ sources.
  • setup-linux.sh deploy block — copies the commands directory to ~/.config/opencode/commands/ alongside the existing opencode.jsonc deploy; idempotent; removes orphans.
  • --check CI gate in lint job — fails the build if a SKILL.md is edited without regenerating its matching command.
  • 23 bats assertions in tests/skills-to-opencode.bats + 1 in tests/verify-setup.bats (integration container).

Skip-list (Claude-only primitives, would not work in OpenCode)

Skill Reason
creating-skills Meta-skill for Claude skill anatomy itself
dispatching-parallel-agents Uses Task subagent_type (Claude-specific harness primitive)
crystallize Depends on claude-mem MCP (Anthropic-only)
insights Depends on claude-mem MCP
executing-plans Depends on TaskCreate primitive

The 12 portable skills cover the bulk of the daily workflow: audit, debug-hardware, docker, prd-to-issues, project-maturation, systematic-debugging, test, test-driven-development, using-git-worktrees, vault-doctor (Hive MCP works in OpenCode too), verification-before-completion, writing-plans.

Out of scope (deferred)

  • Windows side. setup-windows.ps1 has no opencode bootstrap yet (AI-014 pending). When AI-014 lands, it will add the equivalent deploy block + optionally a scripts/skills-to-opencode.ps1 regen script.
  • Re-evaluating the skip-list. crystallize/insights could be adapted to use Hive vault instead of claude-mem in the future. Out of scope for this PR — pure port, no rewrites.
  • Per-project .opencode/commands/. This PR deploys globally to ~/.config/opencode/commands/. Per-project override is supported by OpenCode but not addressed here.

Test plan

Cross-links

Adds scripts/skills-to-opencode.sh that mechanically transforms
ai/skills/<name>/SKILL.md into ai/opencode/commands/<name>.md.

Format transform (single AWK pass):
- Drop the `name:` line in YAML frontmatter (OpenCode uses the *filename*
  as the command identifier, so audit.md becomes /audit in the TUI).
- Keep `description:` and any other frontmatter fields.
- Copy the markdown body verbatim.

Skip-list (Claude-only primitives that would not work in OpenCode):
- creating-skills          meta-skill for Claude skill anatomy
- dispatching-parallel-agents  uses Task subagent_type
- crystallize, insights    depend on claude-mem (Anthropic-only MCP)
- executing-plans          depends on TaskCreate primitive

Result: 12 portable commands, 5 skipped. Each generated command is a
1:1 derivative of its SKILL.md source.

CLI:
- ./scripts/skills-to-opencode.sh           generate or sync
- ./scripts/skills-to-opencode.sh --check   CI gate: exit 1 if drift
- ./scripts/skills-to-opencode.sh --help    usage

Idempotence: re-running with identical inputs is a no-op. Orphan command
files (no matching skill, not on the skip-list) are removed on regen and
flagged on --check.

Deploy: setup-linux.sh now copies ai/opencode/commands/*.md to
~/.config/opencode/commands/ alongside the existing opencode.jsonc deploy.
Orphan removal at the deploy layer mirrors the same logic at the source
layer, so removing a skill from ai/skills/ propagates to the user's
machine on the next setup run.

CI: a new step in the `lint` job runs `./scripts/skills-to-opencode.sh
--check`, so a SKILL.md edit without a matching command regen fails CI
loudly rather than silently drifting.

Windows side deferred: setup-windows.ps1 has no opencode bootstrap yet
(AI-014 pending). When that lands, it will add the equivalent deploy
block and optionally a skills-to-opencode.ps1 regen script for parity.

Tests:
- tests/skills-to-opencode.bats: 23 assertions (script existence,
  syntax, generated file count, skip-list enforcement, frontmatter
  transform correctness, body preservation, drift detection on
  mutated/orphan files, idempotence, --help, unknown-arg rejection).
- tests/verify-setup.bats: new assertion in the integration container
  verifying the deploy block creates ~/.config/opencode/commands/ with
  the expected 12 portable files.

First concrete chunk of the AI-015-harness-parity-across-agents umbrella.
@mlorentedev mlorentedev merged commit 737be72 into main May 18, 2026
5 checks passed
@mlorentedev mlorentedev deleted the feat/AI-012-opencode-commands-port branch May 18, 2026 04:01
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.

1 participant