.opencode/MIGRATION.md
This guide helps you migrate from Claude Code to OpenCode while using the Everything Claude Code (ECC) configuration.
OpenCode is an alternative CLI for AI-assisted development that supports all the same features as Claude Code, with some differences in configuration format.
| Feature | Claude Code | OpenCode | Notes |
|---|---|---|---|
| Configuration | CLAUDE.md, plugin.json | opencode.json | Different file formats |
| Agents | Markdown frontmatter | JSON object | Full parity |
| Commands | commands/*.md | command object or .md files | Full parity |
| Skills | skills/*/SKILL.md | instructions array | Loaded as context |
| Hooks | hooks.json (3 phases) | Plugin system (20+ events) | Full parity + more! |
| Rules | rules/*.md | instructions array | Consolidated or separate |
| MCP | Full support | Full support | Full parity |
OpenCode fully supports hooks via its plugin system, which is actually MORE sophisticated than Claude Code with 20+ event types.
| Claude Code Hook | OpenCode Plugin Event | Notes |
|---|---|---|
PreToolUse | tool.execute.before | Can modify tool input |
PostToolUse | tool.execute.after | Can modify tool output |
Stop | session.idle or session.status | Session lifecycle |
SessionStart | session.created | Session begins |
SessionEnd | session.deleted | Session ends |
| N/A | file.edited | OpenCode-only: file changes |
| N/A | file.watcher.updated | OpenCode-only: file system watch |
| N/A | message.updated | OpenCode-only: message changes |
| N/A | lsp.client.diagnostics | OpenCode-only: LSP integration |
| N/A | tui.toast.show | OpenCode-only: notifications |
Claude Code hook (hooks.json):
{
"PostToolUse": [{
"matcher": "tool == \"Edit\" && tool_input.file_path matches \"\\\\.(ts|tsx|js|jsx)$\"",
"hooks": [{
"type": "command",
"command": "prettier --write \"$file_path\""
}]
}]
}
OpenCode plugin (.opencode/plugins/prettier-hook.ts):
export const PrettierPlugin = async ({ $ }) => {
return {
"file.edited": async (event) => {
if (event.path.match(/\.(ts|tsx|js|jsx)$/)) {
await $`prettier --write ${event.path}`
}
}
}
}
The ECC OpenCode configuration includes translated hooks:
| Hook | OpenCode Event | Purpose |
|---|---|---|
| Prettier auto-format | file.edited | Format JS/TS files after edit |
| TypeScript check | tool.execute.after | Run tsc after editing .ts files |
| console.log warning | file.edited | Warn about console.log statements |
| Session notification | session.idle | Notify when task completes |
| Security check | tool.execute.before | Check for secrets before commit |
# Install OpenCode CLI
npm install -g opencode
# or
curl -fsSL https://opencode.ai/install | bash
The .opencode/ directory in this repository contains the translated configuration:
.opencode/
├── opencode.json # Main configuration
├── plugins/ # Hook plugins (translated from hooks.json)
│ ├── ecc-hooks.ts # All ECC hooks as plugins
│ └── index.ts # Plugin exports
├── tools/ # Custom tools
│ ├── run-tests.ts # Run test suite
│ ├── check-coverage.ts # Check coverage
│ └── security-audit.ts # npm audit wrapper
├── commands/ # All 23 commands (markdown)
│ ├── plan.md
│ ├── tdd.md
│ └── ... (21 more)
├── prompts/
│ └── agents/ # Agent prompt files (12)
├── instructions/
│ └── INSTRUCTIONS.md # Consolidated rules
├── package.json # For npm distribution
├── tsconfig.json # TypeScript config
└── MIGRATION.md # This file
# In the repository root
opencode
# The configuration is automatically detected from .opencode/opencode.json
Claude Code:
---
name: planner
description: Expert planning specialist...
tools: ["Read", "Grep", "Glob"]
model: opus
---
You are an expert planning specialist...
OpenCode:
{
"agent": {
"planner": {
"description": "Expert planning specialist...",
"mode": "subagent",
"model": "anthropic/claude-opus-4-5",
"prompt": "{file:prompts/agents/planner.txt}",
"tools": { "read": true, "bash": true }
}
}
}
Claude Code:
---
name: plan
description: Create implementation plan
---
Create a detailed implementation plan for: {input}
OpenCode (JSON):
{
"command": {
"plan": {
"description": "Create implementation plan",
"template": "Create a detailed implementation plan for: $ARGUMENTS",
"agent": "planner"
}
}
}
OpenCode (Markdown - .opencode/commands/plan.md):
---
description: Create implementation plan
agent: planner
---
Create a detailed implementation plan for: $ARGUMENTS
Claude Code: Skills are loaded from skills/*/SKILL.md files.
OpenCode: Skills are added to the instructions array:
{
"instructions": [
"skills/tdd-workflow/SKILL.md",
"skills/security-review/SKILL.md",
"skills/coding-standards/SKILL.md"
]
}
Claude Code: Rules are in separate rules/*.md files.
OpenCode: Rules can be consolidated into instructions or kept separate:
{
"instructions": [
"instructions/INSTRUCTIONS.md",
"rules/common/security.md",
"rules/common/coding-style.md"
]
}
| Claude Code | OpenCode |
|---|---|
opus | anthropic/claude-opus-4-5 |
sonnet | anthropic/claude-sonnet-4-5 |
haiku | anthropic/claude-haiku-4-5 |
After migration, ALL 23 commands are available:
| Command | Description |
|---|---|
/plan | Create implementation plan |
/tdd | Enforce TDD workflow |
/code-review | Review code changes |
/security | Run security review |
/build-fix | Fix build errors |
/e2e | Generate E2E tests |
/refactor-clean | Remove dead code |
/orchestrate | Multi-agent workflow |
/learn | Extract patterns mid-session |
/checkpoint | Save verification state |
/verify | Run verification loop |
/eval | Run evaluation |
/update-docs | Update documentation |
/update-codemaps | Update codemaps |
/test-coverage | Check test coverage |
/setup-pm | Configure package manager |
/go-review | Go code review |
/go-test | Go TDD workflow |
/go-build | Fix Go build errors |
/skill-create | Generate skills from git history |
/instinct-status | View learned instincts |
/instinct-import | Import instincts |
/instinct-export | Export instincts |
/evolve | Cluster instincts into skills |
/promote | Promote project instincts to global scope |
/projects | List known projects and instinct stats |
| Agent | Description |
|---|---|
planner | Implementation planning |
architect | System design |
code-reviewer | Code review |
security-reviewer | Security analysis |
tdd-guide | Test-driven development |
build-error-resolver | Fix build errors |
e2e-runner | E2E testing |
doc-updater | Documentation |
refactor-cleaner | Dead code cleanup |
go-reviewer | Go code review |
go-build-resolver | Go build errors |
database-reviewer | Database optimization |
The .opencode/ directory contains everything pre-configured.
npm install ecc-universal
Then in your opencode.json:
{
"plugin": ["ecc-universal"]
}
This only loads the published ECC OpenCode plugin module (hooks/events and exported plugin tools).
It does not automatically inject ECC's full agent, command, or instructions config into your project.
If you want the full ECC OpenCode workflow surface, use the repository's bundled .opencode/opencode.json as your base config or copy these pieces into your project:
.opencode/commands/.opencode/prompts/.opencode/instructions/INSTRUCTIONS.mdagent and command sections from .opencode/opencode.json.opencode/opencode.json exists in the repository rootcat .opencode/opencode.json | jq ..opencode/plugins/plugin array in opencode.json includes the pathopencode.json under the agent objectopencode.json or as .md file in .opencode/commands/$ARGUMENTS for user inputplugin: ["ecc-universal"], note that npm plugin install does not auto-add ECC commands or agents to your project configopencode.json loads without errorsIf you need to switch back:
claude instead of opencodeCLAUDE.md, plugin.json, etc.).opencode/ directory won't interfere with Claude Code| Feature | Claude Code | OpenCode | Status |
|---|---|---|---|
| Agents | PASS: 12 agents | PASS: 12 agents | Full parity |
| Commands | PASS: 23 commands | PASS: 23 commands | Full parity |
| Skills | PASS: 16 skills | PASS: 16 skills | Full parity |
| Hooks | PASS: 3 phases | PASS: 20+ events | OpenCode has MORE |
| Rules | PASS: 8 rules | PASS: 8 rules | Full parity |
| MCP Servers | PASS: Full | PASS: Full | Full parity |
| Custom Tools | PASS: Via hooks | PASS: Native support | OpenCode is better |
For issues specific to: