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
Ask these first — they shape everything else:
descriptionMUST NOT assume knowledge is current. After understanding the broad strokes:
Example: User wants an agent for "Next.js deployments" → Research current deployment patterns, Vercel vs self-hosted, App Router vs Pages Router, common pitfalls, etc.
"What permissions does this agent need?"
permission block entirely — rely on system defaultswrite, edit, bashbash: "*" only if needed"Should this agent use any skills?"
permission.skill with "*": "deny" and explicit allows"Is this a subagent?"
mode: subagentmode (defaults to all) or set mode: primary for main-list onlyKey principle: Start broad, get specific only where the user shows interest. Be flexible: If the user provides lots of info upfront, skip phases that are already answered.
read, write, edit, bash) unless the user requests restrictions or non-standard accesspermission.skill to whitelist specific skills# Standard Agent (minimal config)
permission:
skill:
"*": "deny"
"my-skill": "allow"
# Restricted Agent (explicit config)
permission:
edit: "ask"
bash:
"*": "deny"
skill:
"*": "deny"| Scope | Path |
|---|---|
| Project | .opencode/agents/<name>.md |
| Global | ~/.config/opencode/agents/<name>.md |
Use these as starting points. Each maps a common use case to the right configuration choices.
Use when the agent should inspect code but NEVER modify files:
---
description: Code quality analyst. Use when user says "review", "analyze", "check my code".
mode: all
permission:
edit: "deny"
bash: "deny"
---
You analyze code for quality, security, and performance issues.
You NEVER modify files directly. Provide specific, actionable findings.Use for specialized tasks invoked by other agents via the Task tool:
---
description: Test runner specialist. Use for parallel test execution during CI workflows.
mode: subagent
permission:
bash:
"*": "ask"
"npm test": "allow"
"npx jest": "allow"
skill:
"*": "deny"
---
You run test suites and report results. Focus on speed and clear failure summaries.Use when the agent should only access specific skills:
---
description: |-
Database migration expert. Use when user says "write migration", "alter table",
"create schema", "database change".
Examples:
- user: "add column" -> generate migration
- user: "index performance" -> suggest index migration
permission:
skill:
"*": "deny"
"supabase-postgres-best-practices": "allow"
"conventional-commits": "allow"
---
You design safe, reversible database migrations following best practices.Use when the agent must run shell commands but only specific, safe ones:
---
description: |-
Deployment helper. Use when user says "deploy to staging", "push to prod", "release".
Examples:
- user: "deploy" -> run deployment pipeline
- user: "rollback" -> revert last deployment
mode: subagent
permission:
bash:
"*": "deny"
"git tag *": "allow"
"npm run build": "allow"
"npm run deploy:staging": "allow"
"npm run deploy:production": "ask"
skill:
"*": "deny"
---
You handle deployments safely. Always confirm before production deploys.# Role and Objective
[Agent purpose and scope]
# Instructions
- Core behavioral rules
- What to always/never do
## Sub-instructions (optional)
More detailed guidance for specific areas.
# Workflow
1. First, [step]
2. Then, [step]
3. Finally, [step]
# Output Format
Specify exact format expected.
# Examples (optional)
<examples>
<example>
<input>User request</input>
<output>Expected response</output>
</example>
</examples>XML tags improve clarity and parseability across all models:
| Tag | Purpose |
|---|---|
<instructions> | Core behavioral rules |
<context> | Background information |
<examples> | Few-shot demonstrations |
<thinking> | Chain-of-thought reasoning |
<output> | Final response format |
<instructions>
1. Analyze the code in <code> tags
2. List issues in <findings> tags
3. Suggest fixes in <recommendations> tags
</instructions>The description determines when the agent triggers.
Template: [Role/Action]. Use when [triggers]. Examples: - user: "trigger" -> action
Find the balance between too rigid and too vague:
| Too Rigid | Right Altitude | Too Vague |
|---|---|---|
| Hardcoded if-else logic | Clear heuristics + flexibility | "Be helpful" |
| "If X then always Y" | "Generally prefer X, but use judgment" | No guidance |
For agents that use tools in a loop, SHOULD include:
# Tool Usage
If unsure about something, use tools to gather information.
Do NOT guess or make up answers.
# Planning (optional)
Think step-by-step before each action. Reflect on results before proceeding.| Pattern | How it works | Best for |
|---|---|---|
| ReAct | Reason → Act → Observe → Repeat | Tool use with reasoning |
| Self-Refine | Generate → Critique → Refine | Quality-focused (writing, review) |
| Reflexion | Reflect on failures → Improve | Adaptive/learning tasks |
| Pattern | How it works | Best for |
|---|---|---|
| Lead Agent | Orchestrator delegates to specialists | Multiple expertise domains |
| Router | Analyze request → Route to right agent | Diverse request types |
| Subagents | Main agent spawns focused sub-agents | Long-horizon tasks, parallel exploration |
Then propose targeted fixes:
| Symptom | Likely Cause | Fix |
|---|---|---|
| Triggers too often | Description too broad | Add specific contexts |
| Misses triggers | Description too narrow | Add trigger phrases |
| Wrong outputs | Prompt ambiguous | Add explicit instructions |
| Executes dangerous commands | Loose bash permissions | Restrict with patterns |
| Uses wrong skills | No skill restrictions | Configure permission.skill |
MUST show proposed changes and ask for confirmation before applying.
Before showing the final agent to the user:
description has concrete trigger examplesmode discussed and set appropriatelyAgents may occasionally use outdated frontmatter (e.g., tools:, maxSteps:). Correct these to modern permission: and steps: fields when encountered.