This guide helps you migrate from Claude Code to OpenCode while using the 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 | bashThe .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.jsonClaude 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: everything-claude-code:planner
---
Create a detailed implementation plan for: $ARGUMENTSClaude 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-universalThen 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.md- the
agentandcommandsections from.opencode/opencode.json
- Verify
.opencode/opencode.jsonexists in the repository root - Check JSON syntax is valid:
cat .opencode/opencode.json | jq . - Ensure all referenced prompt files exist
- Verify plugin file exists in
.opencode/plugins/ - Check TypeScript syntax is valid
- Ensure
pluginarray inopencode.jsonincludes the path
- Check the agent is defined in
opencode.jsonunder theagentobject - Verify the prompt file path is correct
- Ensure the prompt file exists at the specified path
- Verify the command is defined in
opencode.jsonor as.mdfile in.opencode/commands/ - Check the referenced agent exists
- Ensure the template uses
$ARGUMENTSfor user input - If you installed only
plugin: ["ecc-universal"], note that npm plugin install does not auto-add ECC commands or agents to your project config
- Start Fresh: Don't try to run both Claude Code and OpenCode simultaneously
- Check Configuration: Verify
opencode.jsonloads without errors - Test Commands: Run each command once to verify it works
- Use Plugins: Leverage the plugin hooks for automation
- Use Agents: Leverage the specialized agents for their intended purposes
If you need to switch back:
- Simply run
claudeinstead ofopencode - Claude Code will use its own configuration (
CLAUDE.md,plugin.json, etc.) - The
.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:
- OpenCode CLI: Report to OpenCode's issue tracker
- ECC Configuration: Report to github.com/affaan-m/ECC