skills/opencode-config-workflow/SKILL.md
Workflow and methodology for API-efficient OpenCode configuration management (global + per-project). Use when modifying opencode.jsonc, creating agents/skills/commands/rules, deciding global vs project placement, validating schema compliance, or minimizing LLM turns for config tasks. Complements `opencode-configure` (surface details) and `customize-opencode` (schema shapes) by providing the decision framework and API-cost-minimization strategy.
npx skillsauth add Thomashighbaugh/opencode opencode-config-workflowInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Workflow methodology for working on global (~/.config/opencode/) and per-project (.opencode/)
OpenCode configurations with minimal API requests while ensuring schema compliance.
opencode.jsonc (any scope) — use this skill to decide the most API-efficient approachopencode.jsonc field — use customize-opencode skill or fetch https://opencode.ai/config.jsonopencode-configure skillopencode-agent-creator, skill-creator, opencode-command-creator)Every config task falls into one of these types. Each has a distinct optimal workflow.
Examples: New agent, skill, command, rule, tool, plugin, MCP server, provider model
Optimal Workflow (2-3 turns):
opencode.jsonc references (batch in parallel)API Cost: 2-3 turns Key Savings: Creator skills embed schema rules — no extra lookups needed.
Examples: Change model/provider, edit agent prompt, update permissions, add instruction path
Optimal Workflow (1-2 turns):
json-edit/EditAPI Cost: 1-2 turns
Key Savings: Read and edit in same turn. Use json-edit for JSONC (0 LLM turns per edit).
Examples: JSONC syntax check, schema compliance, reference integrity, frontmatter validation
Free validation commands:
# JSONC syntax check
node -e '
const fs = require("fs");
let c = fs.readFileSync("opencode.jsonc", "utf-8");
c = c.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
JSON.parse(c);
console.log("OK");
'
# Plugin path existence
for p in $(node -e '
const fs = require("fs");
let c = fs.readFileSync("opencode.jsonc", "utf-8");
c = c.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
const cfg = JSON.parse(c);
(cfg.plugin || []).forEach(p => console.log(p));
'); do
[ -f "$p" ] && echo "✓ $p" || echo "✗ $p NOT FOUND"
done
# Agent frontmatter check
for f in agents/*.md; do
head -1 "$f" | grep -q "^---" && echo "✓ $f" || echo "✗ $f missing frontmatter"
done
API Cost: 0 turns — all shell commands, no LLM calls.
Examples: opencode won't start, plugin not loading, MCP not connecting, skill not found
Optimal Workflow (1-3 turns):
OPENCODE_DISABLE_PROJECT_CONFIG=1 — skip broken project config, start from globalsOPENCODE_CONFIG_CONTENT='{"$schema":"https://opencode.ai/config.json"}' — inject inline JSONOPENCODE_DISABLE_DEFAULT_PLUGINS=1 — skip default pluginsOPENCODE_PURE=1 — skip external plugins entirelyAPI Cost: 1-3 turns Key Savings: Always try escape hatches before debugging — they cost 0 LLM turns and often bypass the broken config entirely, letting you see the error from outside the broken session.
Examples: Schema version upgrade, deprecated key replacement, structural reorganization
Optimal Workflow (2-3 turns):
config-sync script to detect drift (free)API Cost: 2-3 turns Key Savings: Batch ALL migration changes in one turn — never one-at-a-time.
| Tool | Best For | Why Efficient |
|------|----------|---------------|
| json-edit | opencode.jsonc field changes (set, merge, arrayAppend, delete) | 0 LLM turns per edit |
| Write | Creating new agent/skill/command/rule .md files | 1 turn per file (single write) |
| Edit | Modifying existing .md files (surgical changes) | 0 LLM turns per edit |
| conf-edit | .env key-value changes | 0 LLM turns |
| yaml-edit | YAML frontmatter in agent/command files | 0 LLM turns |
| multi-edit | Batch find-and-replace across multiple files | 0 LLM turns |
| Shell validation | JSONC check, file existence, frontmatter check | 0 LLM turns (free) |
| validate-delegation | Check delegation target integrity | 0 LLM turns |
Golden Rule: For JSONC edits, always prefer json-edit over reading + rewriting the entire file. A json-edit call costs 1 tool invocation (no LLM overhead). Rewriting a 120-line file costs all those tokens in context.
| Surface | Optimal Choice | Skip When |
|---------|---------------|-----------|
| opencode.jsonc field changes | customize-opencode skill or fetch schema URL | Edit is trivial (just json-edit directly) |
| Agent creation | opencode-agent-creator skill | Format is memorized (simple case) |
| Skill creation | skill-creator skill | Format is memorized |
| Command creation | opencode-command-creator skill | Format is memorized |
| Plugin creation | opencode-plugin-creator skill | Format is memorized |
| Multi-surface orchestration | config-orchestrator subagent | Only 1-2 files to change |
| Project .opencode/ init | provision skill | .opencode/ already exists |
| Schema compliance | config-sync script | Schema is up to date |
| Config workflow methodology | This skill (opencode-config-workflow) | Task is just a simple key-value change |
Efficiency Principle — Load Once, Apply Many: If you need multiple config changes in one session:
| Question | Answer → Action |
|----------|----------------|
| Would another project use this tool/plugin/rule? | → Global ~/.config/opencode/ |
| Is this specific to this project's domain? | → Project .opencode/ |
| Not sure? | → Start project-specific, promote to global at #2 reuse |
| Entity Type | Global? | Project? | Because |
|-------------|---------|----------|---------|
| Tools (.ts files) | ✅ Always | ❌ Never | Project .opencode/tools/ is NOT auto-discovered by OpenCode |
| Plugins (hook plugins) | ✅ Always | ❌ Never | Project .opencode/plugins/ is NOT auto-discovered |
| Core rules (shell, security, karpathy) | ✅ Always | ❌ Never | Shared conventions across all projects |
| Reusable agents | ✅ | ❌ | Put shared agents in global |
| Project-specific agents | ❌ | ✅ | .opencode/agents/*.md |
| Reusable skills | ✅ | ❌ | Put shared skills in global |
| Project-specific skills | ❌ | ✅ | .opencode/skills/*/SKILL.md |
| Project rules | ❌ | ✅ | .opencode/rules/*.md |
| Config overrides | ❌ | ✅ | .opencode/opencode.json — only set DIFFERENCES from global |
| Context (durable knowledge) | ❌ | ✅ | .opencode/context/ — committed to git |
| State (session data) | ❌ | ✅ | .opencode/state/ — gitignored |
Project .opencode/opencode.json is deep-merged into global ~/.config/opencode/opencode.jsonc.
Project takes precedence for overlapping keys. Only set keys that differ from global.
| Anti-Pattern | Problem | Correct |
|-------------|---------|---------|
| Duplicating global agents in project | Wastes writes + extra config entries | Just reference global agents by name |
| Overriding everything in project config | Unnecessary merges, harder to validate | Only override what differs |
| Inlining agent defs in opencode.json | Longer file = more tokens | Use file-based definitions (.opencode/agents/) |
| Creating project-specific tools | Not auto-discovered | Use global tools or skill scripts instead |
https://opencode.ai/config.json — Source of truth (authoritative JSON Schema)customize-opencode skill — Summary (may be slightly outdated)opencode-configure skill — Summary (may be slightly outdated)If unsure about a field shape, fetch the schema URL. One webfetch call saves 3+ edit-retry cycles.
Step 1: JSONC parses node -e "JSON.parse(fs.readFileSync('opencode.jsonc','utf-8')...)"
Step 2: References exist for p in plugin paths; do [ -f "$p" ]
Step 3: Frontmatter ok head -1 agents/*.md | grep "^---"
Step 4: Schema ok config-sync script
Always validate JSONC before writing to disk, not after.
json-edit operations are validated by the tool itself (no write happens on parse failure)| Scenario | Turns | Steps |
|----------|-------|-------|
| Simple key change (e.g., change default model) | 2 | Read + json-edit + validate (shell, free) + report |
| Add new provider/model | 2 | Read + json-edit merge + validate + report |
| New agent definition | 3 | Load creator skill (or proceed if format known) + Write file + validate + report |
| New skill | 3 | Load skill-creator + Write SKILL.md + validate + report |
| New MCP server | 2 | Read + json-edit merge + validate + report |
| New command | 2 | Write command.md + verify instructions path + report |
| New rule | 2 | Write rule.md + verify opencode.jsonc instructions path + report |
| Multi-surface change | 3 | Load skill once + batch all writes + validate + report |
| Schema migration | 2 | config-sync (free) + batch edits + validate + report |
| Fix broken config | 2 | Escape hatch (free) + targeted fix + validate + report |
| Full project .opencode/ init | 3 | provision skill + context dirs + .gitignore + validate |
Before any config operation, verify:
json-edit/Edit instead of LLM-powered file rewriting?Goal: Change model from opencode/deepseek-v4-flash-free to ollama/deepseek-v4-flash:cloud
Type: B (Modify) — Simple key change
Cost: 2 turns (optimal)
Turn 1:
1. json-edit { file: "opencode.jsonc", action: "set", path: "$.model",
value: "ollama/deepseek-v4-flash:cloud" }
Turn 2:
1. Validate: node -e 'JSON.parse(fs.readFileSync(...)...)'
2. Report: "Changed model from X to Y. Restart opencode to apply."
| Skill | Purpose |
|-------|---------|
| opencode-configure | Full config surface reference (all 8 surfaces) |
| customize-opencode | Schema shapes and field-level details for opencode.json |
| config-sync | Schema compliance checking and drift detection |
| opencode-agent-creator | Deep guide for creating agent definitions |
| skill-creator | Deep guide for creating skills |
| opencode-command-creator | Deep guide for creating commands |
| opencode-plugin-creator | Deep guide for creating plugins |
| config-orchestrator agent | Subagent for multi-surface config orchestration |
| provision | Auto-generate project .opencode/ from stack fingerprint |
tools
Create valid, type-safe TypeScript tools for OpenCode — generates correct boilerplate, typed interfaces, and handler stubs. Use when building new tools for global config or per-project .opencode/tools/.
testing
Explore multiple solution branches in parallel, evaluate each, and recommend the best path. Use when the user explicitly invokes /ideation tree-of-thoughts or asks for "tree of thought" / "branching exploration".
testing
Run multiple independent reasoning passes and find consensus. Use when the decision is critically important, the stakes are high, or the user explicitly requests "run it multiple times" / "check consistency" / "self-consistency".
testing
Optimization by PROmpting — generate candidate prompt variations, test each against a benchmark, and report the best performer. Use when the user invokes /ideation opro or asks for "prompt optimization" / "OPRO".