一键导入
opencode-config
Complete reference for configuring OpenCode (agents, tools, permissions, models)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Complete reference for configuring OpenCode (agents, tools, permissions, models)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | opencode-config |
| description | Complete reference for configuring OpenCode (agents, tools, permissions, models) |
| license | MIT |
| compatibility | opencode |
| metadata | {"category":"reference","scope":"opencode-configuration"} |
I provide comprehensive configuration guidance for OpenCode, covering all aspects of setup and customization.
When you load me, you get instant access to detailed information about:
Use this skill when you need to:
OPENCODE_CONFIG_CONTENT env var (runtime overrides).opencode directories: Agents, commands, plugins (project-specific)opencode.json in project rootOPENCODE_CONFIG env var path~/.config/opencode/opencode.json.well-known/opencode (organizational defaults)theme, project sets model → both are activeopencode.jsonopencode.jsonc (supports comments)https://opencode.ai/config.json (enables autocomplete)Environment variables:
"model": "{env:OPENCODE_MODEL}"
File contents:
"instructions": "{file:./custom-instructions.md}"
Paths are relative to config file or absolute (/, ~)
Primary agents: Main assistants you interact with directly
build, plan, custom agentsSubagents: Specialized assistants invoked for specific tasks
@mentiongeneral, explore, custom subagentsVia JSON (opencode.json):
{
"agent": {
"my-agent": {
"description": "Brief description for when to use this agent",
"mode": "primary", // or "subagent" or "all"
"model": "anthropic/claude-sonnet-4-20250514",
"prompt": "{file:./prompts/my-agent.txt}",
"temperature": 0.2,
"hidden": false, // subagents only
"maxSteps": 10, // limit agentic iterations
"tools": {
"write": true,
"edit": true,
"bash": true,
"skill": true,
"task": true
},
"permission": {
"bash": {
"*": "ask",
"git status*": "allow"
},
"edit": "allow",
"task": {
"*": "deny",
"my-subagent": "allow"
}
}
}
}
}
Via Markdown (.opencode/agents/my-agent.md):
---
description: Brief description
mode: primary
model: anthropic/claude-sonnet-4-20250514
temperature: 0.2
color: "#FF6B35"
hidden: false
maxSteps: 10
tools:
write: true
edit: true
bash: true
permission:
bash:
"*": "ask"
"git status*": "allow"
edit: allow
---
Your system prompt goes here.
Instructions for the agent's behavior.
| Option | Description | Values/Format |
|---|---|---|
description | What the agent does (REQUIRED) | String, brief |
mode | Agent type | "primary", "subagent", "all" |
model | Override model for this agent | "provider/model-id" |
prompt | Custom system prompt | String or {file:path} |
temperature | Response randomness | 0.0-1.0 (0.0=deterministic) |
hidden | Hide from @ autocomplete (subagents) | true/false |
maxSteps | Max agentic iterations before text-only | Number |
color | Agent color in UI | Hex code "#RRGGBB" |
tools | Tool access control | Object (see tools section) |
permission | Action permissions | Object (see permissions section) |
Set which primary agent starts by default:
{
"default_agent": "plan" // Must be a primary agent
}
| Tool | Purpose | Permission Key |
|---|---|---|
bash | Execute shell commands | permission.bash |
edit | Modify existing files | permission.edit |
write | Create/overwrite files | Controlled by permission.edit |
read | Read file contents | permission.read |
grep | Search file contents (regex) | permission.grep |
glob | Find files by pattern | permission.glob |
list | List directory contents | permission.list |
patch | Apply patches | Controlled by permission.edit |
skill | Load skill definitions | permission.skill |
task | Launch subagents | permission.task |
todowrite | Manage todo lists | permission.todowrite |
todoread | Read todo lists | permission.todoread |
webfetch | Fetch web content | permission.webfetch |
question | Ask user questions | permission.question |
lsp | LSP code intelligence (experimental) | permission.lsp |
Global:
{
"tools": {
"write": true,
"bash": true,
"skill": false
}
}
Per agent:
{
"agent": {
"plan": {
"tools": {
"write": false,
"edit": false,
"bash": false
}
}
}
}
Wildcards (MCP tools):
{
"agent": {
"readonly": {
"tools": {
"mymcp_*": false,
"write": false
}
}
}
}
"allow" — Run without approval"ask" — Prompt for approval"deny" — Block the actionSimple:
{
"permission": "allow" // All tools allowed
}
Specific tools:
{
"permission": {
"*": "ask", // Default for all
"bash": "allow",
"edit": "deny"
}
}
{
"permission": {
"bash": {
"*": "ask", // Default: ask
"git *": "allow", // Allow all git commands
"git push*": "deny", // Deny git push
"npm install*": "allow",
"rm *": "deny"
},
"edit": {
"*": "deny", // Default: deny
"packages/*/src/**/*.ts": "allow", // Allow specific paths
"*.md": "allow" // Allow markdown
},
"read": {
"*": "allow",
"*.env": "deny", // Block .env files
"*.env.*": "deny",
"*.env.example": "allow" // Except examples
},
"task": {
"*": "deny", // Block all subagents
"android-compilation": "allow" // Except specific one
},
"skill": {
"*": "allow",
"internal-*": "deny", // Block internal skills
"experimental-*": "ask" // Ask for experimental
}
}
}
* matches zero or more of any character? matches exactly one character* first, specific rules afterexternal_directory — Triggered when accessing files outside projectdoom_loop — Triggered when same tool call repeats 3x identically"ask"Agent permissions override global config:
{
"permission": {
"bash": "ask"
},
"agent": {
"build": {
"permission": {
"bash": {
"*": "ask",
"git status*": "allow"
}
}
}
}
}
In markdown agents:
---
permission:
edit: deny
bash:
"*": ask
"git diff": allow
---
{
"model": "anthropic/claude-sonnet-4-20250514",
"small_model": "anthropic/claude-haiku-4-20250514"
}
Format: "provider/model-id"
small_model is used for lightweight tasks (title generation, etc.)
{
"provider": {
"anthropic": {
"options": {
"timeout": 600000, // 10 min (default: 300000)
"setCacheKey": true,
"apiKey": "{env:ANTHROPIC_API_KEY}"
}
}
}
}
Common options:
timeout: Request timeout in ms (or false to disable)setCacheKey: Ensure cache key always setapiKey: API key (use env vars!)baseURL: Custom API endpointAmazon Bedrock:
{
"provider": {
"amazon-bedrock": {
"options": {
"region": "us-east-1",
"profile": "my-aws-profile",
"endpoint": "https://bedrock-runtime.vpce-xxx.amazonaws.com"
}
}
}
}
{
"disabled_providers": ["openai", "gemini"],
"enabled_providers": ["anthropic", "openai"]
}
Note: disabled_providers takes priority over enabled_providers
Pass provider-specific params directly:
{
"agent": {
"deep-thinker": {
"model": "openai/gpt-5",
"reasoningEffort": "high", // OpenAI-specific
"textVerbosity": "low"
}
}
}
Directory: .opencode/skills/<skill-name>/SKILL.md
SKILL.md format:
---
name: skill-name
description: What this skill does (1-1024 chars)
license: MIT
compatibility: opencode
metadata:
key1: value1
key2: value2
---
Skill content goes here.
Instructions, examples, reference material.
---^[a-z0-9]+(-[a-z0-9]+)*$.opencode/skills/<name>/SKILL.md~/.config/opencode/skills/<name>/SKILL.md.claude/skills/<name>/SKILL.md (both project and global){
"permission": {
"skill": {
"*": "allow",
"pr-review": "allow",
"internal-*": "deny",
"experimental-*": "ask"
}
}
}
Per agent:
{
"agent": {
"plan": {
"permission": {
"skill": {
"internal-*": "allow"
}
}
}
}
}
{
"agent": {
"plan": {
"tools": {
"skill": false
}
}
}
}
JSON:
{
"command": {
"test": {
"template": "Run the full test suite with coverage report.\nFocus on failing tests and suggest fixes.",
"description": "Run tests with coverage",
"agent": "build",
"model": "anthropic/claude-haiku-4-20250514"
},
"component": {
"template": "Create a new React component named $ARGUMENTS with TypeScript.\nInclude proper typing and basic structure.",
"description": "Create a new component"
}
}
}
Markdown (.opencode/commands/test.md):
---
description: Run tests with coverage
agent: build
model: anthropic/claude-haiku-4-20250514
---
Run the full test suite with coverage report.
Focus on failing tests and suggest fixes.
Use $ARGUMENTS for command arguments.
{
"theme": "opencode"
}
Place custom themes in .opencode/themes/ or ~/.config/opencode/themes/
{
"keybinds": {
"switch_agent": "Tab",
"session_child_cycle": "<Leader>+Right"
}
}
{
"tui": {
"scroll_speed": 3,
"scroll_acceleration": {
"enabled": true
},
"diff_style": "auto" // or "stacked"
}
}
{
"server": {
"port": 4096,
"hostname": "0.0.0.0",
"mdns": true,
"cors": ["http://localhost:5173"]
}
}
{
"formatter": {
"prettier": {
"disabled": true
},
"custom-prettier": {
"command": ["npx", "prettier", "--write", "$FILE"],
"environment": {
"NODE_ENV": "development"
},
"extensions": [".js", ".ts", ".jsx", ".tsx"]
}
}
}
{
"instructions": [
"CONTRIBUTING.md",
"docs/guidelines.md",
".cursor/rules/*.md"
]
}
Supports paths and glob patterns.
{
"mcp": {
"server-name": {
"type": "remote",
"url": "https://api.example.com/mcp",
"enabled": true
}
}
}
{
"plugin": ["opencode-helicone-session", "@my-org/custom-plugin"]
}
Also place in .opencode/plugins/ or ~/.config/opencode/plugins/
{
"compaction": {
"auto": true, // Auto compact when context full
"prune": true // Remove old tool outputs
}
}
{
"watcher": {
"ignore": ["node_modules/**", "dist/**", ".git/**"]
}
}
{
"share": "manual" // "manual", "auto", or "disabled"
}
{
"autoupdate": false // true, false, or "notify"
}
{
"experimental": {
// Experimental options here (unstable)
}
}
{
"agent": {
"plan": {
"mode": "primary",
"permission": {
"edit": "deny",
"bash": "deny"
}
}
}
}
{
"agent": {
"android-compilation": {
"mode": "subagent",
"hidden": false,
"tools": {
"write": false,
"edit": false,
"bash": true
},
"permission": {
"bash": "allow"
}
}
}
}
{
"agent": {
"integrator": {
"mode": "primary",
"tools": {
"task": true
},
"permission": {
"task": {
"*": "deny",
"android-compilation": "allow"
}
}
}
}
}
{
"permission": {
"bash": {
"*": "ask",
"git status": "allow",
"git diff*": "allow",
"rm *": "deny",
"sudo *": "deny"
},
"read": {
"*": "allow",
"*.env": "deny",
"*.env.*": "deny",
"**/secrets/**": "deny"
},
"edit": {
"*": "ask",
"src/**/*.ts": "allow",
"package*.json": "ask"
}
}
}
Global (~/.config/opencode/opencode.json):
{
"theme": "opencode",
"autoupdate": true,
"model": "anthropic/claude-sonnet-4-20250514"
}
Project (opencode.json):
{
"model": "anthropic/claude-haiku-4-20250514", // Override: use cheaper model
"instructions": ["CONTRIBUTING.md"],
"agent": {
"android-builder": {
"mode": "primary",
"prompt": "{file:.opencode/prompts/android-builder.txt}"
}
}
}
Result: Merged config uses haiku model, opencode theme, and project-specific agent.
mode is set correctly (primary or subagent).opencode/agents/ or ~/.config/opencode/agents/hidden: true (subagents only)SKILL.md (all caps)name and descriptionpermission.skill not set to denytools.<tool-name> is not falsepermission.<tool-name> is not "deny"{env:VAR} for env vars, not direct references* wildcard correctly* rule first, specific after"cmd *" not just "cmd"~/.config/opencode/opencode.json<project-root>/opencode.json.opencode/agents/*.md.opencode/skills/<name>/SKILL.md.opencode/commands/*.md{
"permission": {
"bash": {
"*": "ask",
"git status": "allow",
"git diff*": "allow"
},
"edit": "allow",
"read": {
"*": "allow",
"*.env": "deny"
},
"task": {
"*": "deny",
"my-subagent": "allow"
}
}
}
0.0-0.2: Very focused (code analysis, builds, error diagnosis)0.3-0.5: Balanced (general development)0.6-1.0: Creative (brainstorming, exploration)provider/model-id
Examples:
- anthropic/claude-sonnet-4-20250514
- openai/gpt-4
- google-vertex-anthropic/claude-sonnet-4-5@20250929
- opencode/claude-haiku-4-5 (via OpenCode Zen)
For detailed documentation on any topic, refer to the accompanying docs in the docs/ folder of this skill.
Standard progress report format, location conventions, and handoff documentation for all agents
ESP32-C6 hardware specifics - register addresses, peripherals, and RISC-V considerations
Hardware test automation patterns for ESP32-C6, similar to Tock's existing test infrastructure
Global issue tracker management - creating issues, severity levels, and tech debt tracking
Test-Driven Development methodology for embedded Rust - Red-Green-Refactor cycle with host testing focus
Tock kernel patterns, HIL traits, and embedded Rust conventions for chip implementation