OP

opencode-config

Helper tool for editing opencode.json and AGENTS.md files to configure agent behavior and environment variables.

Install

mkdir -p .claude/skills/opencode-config && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/6526" && unzip -o skill.zip -d .claude/skills/opencode-config && rm skill.zip

Installs to .claude/skills/opencode-config

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Edit opencode.json, AGENTS.md, and config files. Use proactively for provider setup, permission changes, model config, formatter rules, or environment variables.

Examples:
- user: "Add Anthropic as a provider" → edit opencode.json providers, add API key baseEnv var, verify with opencode run test
- user: "Restrict this agent's permissions" → add permission block to agent config, set deny/allow for tools/fileAccess
- user: "Set GPT-5 as default model" → edit global or agent-level model preference, verify model name format
- user: "Disable gofmt formatter" → edit formatters section, set languages.gofmt.enabled = false
623 chars · catalog descriptionno explicit “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Beginner

Key capabilities

  • Auto-format opencode.json configurations
  • Manage project-specific vs global AGENTS.md rules
  • Validate provider and model settings
  • Update agent-specific file access permissions
  • Modify formatter configuration blocks

How it works

Uses a guided Q&A interface to identify the correct scope (Global vs Project) before programmatically updating YAML or JSON files based on predefined schemas.

Inputs & outputs

You give it
Desired configuration change
You get back
Validated and updated configuration files

When to use opencode-config

  • Set Anthropic as default provider
  • Restrict agent tool access permissions
  • Toggle formatter settings like gofmt
  • Update model preferences for specific agents

About this skill

OpenCode Configuration

Help users configure OpenCode through guided setup of config files and rules.

<question_tool>

Batching Rule: Use only for 2+ related questions; single questions use plain text.

Syntax Constraints: header max 12 chars, labels 1-5 words, mark defaults with (Recommended).

Purpose: Clarify config scope (models/permissions/rules), validate approach, and handle multiple valid options.

</question_tool>

<reference>

File Locations

TypeGlobalProject
Config~/.config/opencode/opencode.json./opencode.json
Rules~/.config/opencode/AGENTS.md./AGENTS.md

Precedence: Project > Global. Configs are merged, not replaced.

</reference> <workflow>

Question Tool

Batching: Use the question tool for 2+ related questions. Single questions → plain text.

Syntax: header ≤12 chars, label 1-5 words, add "(Recommended)" to default.

When to ask: Vague request ("configure opencode"), permission/security changes, or multiple valid options exist.

Workflow

Ask the user what they want to configure:

  1. "What would you like to set up?"
    • Config file (models, tools, permissions, theme)
    • Rules (project instructions via AGENTS.md)

Then guide them through the relevant section below.

</workflow>

<config_file>

Config File (opencode.json)

Basic Setup

{
  "$schema": "https://opencode.ai/config.json",
  "model": "anthropic/claude-sonnet-4-20250514",
  "theme": "opencode",
  "autoupdate": true
}

Key Options

OptionPurposeExample
modelDefault model"anthropic/claude-sonnet-4-20250514"
small_modelLightweight tasks"anthropic/claude-3-5-haiku-20241022"
themeUI theme"opencode", "catppuccin", "dracula"
autoupdateAuto-update OpenCodetrue / false
shareSession sharing"manual" / "auto" / "disabled"

Permissions

Control what requires approval using the permission field.

{
  "permission": {
    "edit": "allow",           // "allow" | "ask" | "deny"
    "bash": {
      "npm *": "allow",        // pattern matching
      "git *": "allow",
      "rm *": "ask",
      "*": "ask"               // default for this tool
    },
    "webfetch": "allow",
    "skill": {
      "*": "allow",
      "dangerous-*": "deny"
    }
  }
}

Legacy Configuration

Agents may occasionally work on legacy projects using outdated configuration fields (e.g., tools, maxSteps). You MUST correct these to the modern permission and steps fields when encountered.

Custom Instructions

Include additional instruction files:

{
  "instructions": [
    "CONTRIBUTING.md",
    "docs/guidelines.md",
    ".cursor/rules/*.md"
  ]
}

Full schema reference: See references/config-schema.md

</config_file>

<rules_file>

Rules (AGENTS.md)

Project instructions for all agents. Similar to CLAUDE.md or Cursor rules.

Create with /init

Run /init in OpenCode to auto-generate based on project analysis.

Manual Creation

# Project Name

This is a [framework] project using [language].

## Project Structure
- `src/` - Source code
- `tests/` - Test files

## Code Standards
- Use TypeScript strict mode
- Prefer functional patterns
- Write tests for all features

## Commands
- `npm run build` - Build project
- `npm test` - Run tests

Tips

  • SHOULD be specific about your project's patterns
  • SHOULD include common commands
  • SHOULD document any non-obvious conventions
  • SHOULD keep it concise (agents have limited context)

</rules_file>

<config_tips>

Comment Out, Don't Delete

OpenCode supports JSONC (JSON with comments). SHOULD comment out unused configs instead of deleting:

{
  "plugin": [
    "opencode-openai-codex-auth@latest",
    //"@tarquinen/opencode-dcp@latest",     // disabled for now
    //"@howaboua/[email protected]",     // only for GLM-4.6
    "@ramtinj95/opencode-tokenscope@latest"
  ]
}

Why: You might want to re-enable later. Keeps a record of what you've tried.

Validate After Major Changes

After editing opencode.json, you MUST run this validation (not just suggest it):

opencode run "test"

Execute it yourself using the Bash tool before telling the user the change is complete.

If broken, you'll see a clear error with line number:

Error: Config file at ~/.config/opencode/opencode.json is not valid JSON(C):
--- Errors ---
CommaExpected at line 464, column 5
   Line 464:     "explore": {
              ^
--- End ---

Common JSONC mistakes:

  • Missing comma after object (especially after adding new sections)
  • Trailing comma before }
  • Unclosed brackets

</config_tips>

<common_configurations>

Minimal Safe Config

{
  "$schema": "https://opencode.ai/config.json",
  "model": "anthropic/claude-sonnet-4-20250514",
  "permission": {
    "edit": "ask",
    "bash": "ask"
  }
}

Power User Config

{
  "$schema": "https://opencode.ai/config.json",
  "model": "anthropic/claude-sonnet-4-20250514",
  "autoupdate": true,
  "permission": {
    "edit": "allow",
    "bash": {
      "*": "allow",
      "rm -rf *": "deny",
      "sudo *": "ask"
    }
  },
  "instructions": ["CONTRIBUTING.md"]
}

Team Project Config

{
  "$schema": "https://opencode.ai/config.json",
  "model": "anthropic/claude-sonnet-4-20250514",
  "share": "auto",
  "instructions": [
    "docs/development.md",
    "docs/api-guidelines.md"
  ]
}

</common_configurations>

<troubleshooting>
IssueSolution
Config not loadingCheck JSON syntax, ensure valid path
Skill not foundVerify SKILL.md (uppercase), check frontmatter
Permission denied unexpectedlyCheck global vs project config precedence
</troubleshooting>

References

  • references/config-schema.md - Full config options

When not to use it

  • Manual editing of massive configuration files
  • If the project lacks an opencode.json

Limitations

  • Requires schema compliance
  • Limited by file system permissions

How it compares

It automates the file manipulation and validation process based on the hierarchical precedence rules of the OpenCode ecosystem.

Compared to similar skills

opencode-config side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
opencode-config (this skill)47moReviewBeginner
opencode-cli147moReviewAdvanced
claude-automation-recommender472moReviewBeginner
mcp-integration219moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

opencode-cli

SpillwaveSolutions

This skill should be used when configuring or using the OpenCode CLI for headless LLM automation. Use when the user asks to "configure opencode", "use opencode cli", "set up opencode", "opencode run command", "opencode model selection", "opencode providers", "opencode vertex ai", "opencode mcp servers", "opencode ollama", "opencode local models", "opencode deepseek", "opencode kimi", "opencode mistral", "fallback cli tool", or "headless llm cli". Covers command syntax, provider configuration, Vertex AI setup, MCP servers, local models, cloud providers, and subprocess integration patterns.

14174

claude-automation-recommender

anthropics

Analyze a codebase and recommend Claude Code automations (hooks, subagents, skills, plugins, MCP servers). Use when user asks for automation recommendations, wants to optimize their Claude Code setup, mentions improving Claude Code workflows, asks how to first set up Claude Code for a project, or wants to know what Claude Code features they should use.

47140

mcp-integration

anthropics

This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context Protocol", "connect external service", mentions "${CLAUDE_PLUGIN_ROOT} with MCP", or discusses MCP server types (SSE, stdio, HTTP, WebSocket). Provides comprehensive guidance for integrating Model Context Protocol servers into Claude Code plugins for external tool and service integration.

21123

hook-development

anthropics

This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.

11122

agent-factory

alirezarezvani

Claude Code agent generation system that creates custom agents and sub-agents with enhanced YAML frontmatter, tool access patterns, and MCP integration support following proven production patterns

8109

swarm-advanced

ruvnet

Advanced swarm orchestration patterns for research, development, testing, and complex distributed workflows

7110

Search skills

Search the agent skills registry