Guidance for AI agents working in this repository.
This is the opencode-plugins package — a port of the
datum-cloud/claude-code-plugins
Claude Code marketplace to OpenCode. It ships a single npm
package (@datum-cloud/opencode-plugins) containing agents, skills, commands, and
one TypeScript hook plugin, distributed via the opencode.json plugin array.
The three source Claude Code plugins are merged flat into one collection:
- datum-platform — Kubernetes platform engineering (aggregated API servers,
controller patterns, GitOps deployment). Contributes 7 agents, 32 skills, 8
commands, and two hooks (
auto-validatewarn +pr-op-gateblock). - datum-gtm — Go-to-market automation. Contributes 4 agents, 4 skills, 1 command.
- milo-activity — Milo Activity service (audit logs, incidents, policies). Contributes 2 agents, 7 skills, 0 commands.
opencode-plugins/
├── package.json # @datum-cloud/opencode-plugins; postinstall copies markdown global
├── postinstall.mjs # copies agents/commands/skills/scripts into ~/.config/opencode/
├── tsconfig.json
├── src/
│ └── auto-validate.ts # TS hook plugin (tool.execute.before/after): auto-validate + pr-op-gate
├── scripts/
│ └── pr-op-gate # unchanged gh pr/issue body gate (invoked by the plugin)
├── agents/*.md # 13 opencode subagents (filename = agent name)
├── commands/*.md # 9 slash commands (namespaced: platform-*, gtm-*)
├── skills/<name>/ # 42 skill dirs, each with SKILL.md + topic files + optional scripts/
├── docs/
│ ├── porting-guide.md # claude→opencode field mapping reference
│ └── troubleshooting.md
├── README.md
└── CHANGELOG.md
- Skills:
skills/<name>/SKILL.mddiscovered from.opencode/skills/or~/.config/opencode/skills/(opencode also reads.claude/skills/). Frontmatter requiresname(must match dir, regex^[a-z0-9]+(-[a-z0-9]+)*$) anddescription(1–1024 chars). - Agents:
agents/<name>.md(filename = name). Frontmatter:description(required),mode(subagent/primary),permission, optionalmodel,temperature,hidden. The built-inbuild/planprimaries exist; all ported agents here aremode: subagentand omitmodel(inherit the user's configured model). - Commands:
commands/<name>.md(filename = command). Frontmatter:description, optionalagent,model,subtask. Body = prompt template supporting$ARGUMENTS,$1..$N,!backtick`` shell output,@filerefs. - Plugins (TS): a JS/TS module exporting a
Pluginfunction returning event hooks. Loaded from.opencode/plugins/or via theopencode.jsonpluginnpm array. This package's only TS plugin issrc/auto-validate.ts, which wires two datum-platform hooks:tool.execute.after(auto-validate, warn) andtool.execute.before(pr-op-gate, block, which shells out toscripts/pr-op-gate).
# Typecheck the TS hook plugin
npm run typecheck
# or: bunx tsc --noEmit
# Dry-run the postinstall into a temp dir
OPENCODE_CONFIG_DIR=/tmp/oc-test node postinstall.mjsThere is no marketplace validation (claude plugin validate) equivalent in
opencode — discovery is implicit from the .opencode/ / ~/.config/opencode/
directory layout.
- Skills: 1:1 copy. Verify
namefrontmatter matches the directory and the opencode name regex. Trimdescriptionto ≤1024 chars if needed. Unknown frontmatter fields are ignored by opencode (left in place). - Agents: drop
name/tools/model; keepdescription; setmode: subagent; maptools→permission(full tools →edit/bash/read/glob/grep: allow; read-only reviewers →edit: deny, bash: deny). Rewrite body references:CLAUDE.md→AGENTS.md,.claude/pipeline/→.opencode/pipeline/,${CLAUDE_PLUGIN_ROOT}→.opencode/skills/<skill>/...relative paths. - Commands: drop
name/tools/model/disable-model-invocation/context/argument-hint; keepdescriptionandagent(mapgeneral-purpose→general); setsubtask: truewhere the source usedcontext: fork. Namespace filenames to avoid collisions (e.g.discover→platform-discover/gtm-discover). - TS hook: port
auto-validate.sh's dispatch table to atool.execute.afterevent handler. Resolve validator scripts via theworktree/directorycontext (no${CLAUDE_PLUGIN_ROOT}). Keep warn-only (non-blocking) behavior matching the sourceexit 0. - pr-op-gate hook: ship the unchanged
scripts/pr-op-gateand invoke it from atool.execute.beforehandler. The wrapper feedsgh pr|issue create|editas Claude-protocol JSON stdin, reads the script'shookSpecificOutput, throws to block onpermissionDecision: "deny", and logsadditionalContext/errors otherwise. The plugin setsCLAUDE_PLUGIN_ROOT(the installed config dir) so the script locatesskills/clear-writing/SKILL.mdfor its phrase table.
Follow semantic versioning in package.json:
- Patch (1.0.x): frontmatter fixes, typo corrections, doc updates.
- Minor (1.x.0): new skills, agents, or commands; significant doc additions.
- Major (x.0.0): breaking changes to agent/command/skill contracts or the TS hook.
Maintain CHANGELOG.md. Update README.md if pack contents change. Publish with
npm publish (the postinstall script runs automatically for consumers).
This package has no ${CLAUDE_PLUGIN_ROOT} equivalent. Validator scripts live at
skills/<skill>/scripts/*.sh and are resolved at hook runtime relative to the
opencode worktree (.opencode/skills/... or ~/.config/opencode/skills/...).
Agent/skill bodies reference them as .opencode/skills/<skill>/scripts/<script>.sh.
The pr-op-gate hook script ships at scripts/pr-op-gate and is installed to
~/.config/opencode/scripts/. At runtime the plugin exports CLAUDE_PLUGIN_ROOT
pointing at the installed config dir so the script can resolve
skills/clear-writing/SKILL.md for its phrase table.