Complete toolkit for configuring and extending OpenCode: agent creation, custom slash commands, configuration management, plugin development, and SDK usage.
98
98%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Advisory
Suggest reviewing before use
Complete reference for command file frontmatter fields and template placeholders.
---
description: "Short summary shown in /help list" # RECOMMENDED
agent: build # Optional: build | plan | <custom-agent-name>
model: provider/model-id # Optional: override default model
subtask: true # Optional: run as background subagent
---descriptionShown in the /help command list. Write as a 3-7 word imperative phrase.
Good: Run tests and fix failures
Bad: This command runs tests
agentRoutes the command to a specific agent:
| Value | Behavior |
|---|---|
| (omitted) | Default build agent — can read, write, execute |
build | Explicit build agent — same as default |
plan | Read-only analysis agent — cannot modify files |
<name> | Any named agent from .opencode/agent/<name>.md |
Rule: Use agent: plan whenever the command should never write files.
modelOverrides the default model for this command only.
model: anthropic/claude-3-5-haiku-20241022 # Fast, cheap — for simple tasks
model: anthropic/claude-sonnet-4-5-20250514 # Balanced
model: openai/gpt-4o # Alternative providerUse a cheaper/faster model for subtasks that don't need full reasoning.
subtaskWhen true, the command runs as a background subagent:
Use for: lint checks, spell checks, coverage reports, search tasks. Do NOT use for: step-by-step workflows, anything requiring user input.
$ARGUMENTSEverything passed after the command name, as a single string.
/review src/api.ts --depth=deep→ $ARGUMENTS = "src/api.ts --depth=deep"
Rules:
$1, $2, $3Positional arguments split by whitespace.
/migrate UserCard class-component→ $1 = "UserCard", $2 = "class-component"
Use when: You need to distinguish two independent inputs (e.g., source and target).
!cmdInjects the output of a shell command at template load time.
!`git log --oneline -20`
!`git status`
!`cat package.json | jq .dependencies`Rules:
!`command`@filenameInjects the full content of a file.
@src/schema.ts
@prisma/schema.prisma
@.env.exampleRules:
The recommended template structure uses XML blocks to organize content:
| Block | Purpose |
|---|---|
<summary> | 3-line MUST/SHOULD/MUST summary of intent |
<context> | Dynamic data injected via !cmd or @file |
<target> | User-provided input ($ARGUMENTS, $1, $2) |
<objective> | Explicit success condition for the agent |
<constraints> | What NOT to do (optional) |
---
description: Do the thing
---
<summary>
You MUST [primary action].
You SHOULD [secondary action].
You MUST [success condition].
</summary>
<context>
!`some-command`
@some/file.ts
</context>
<target>
$ARGUMENTS
</target>
<objective>
You MUST accomplish [goal] using the context and target above.
</objective>