oc-convert
v0.1.3
Published
Convert **Claude Code** configs (settings, subagents, MCP, skills) into **OpenCode** config + agents + skills.
Downloads
356
Readme
oc-convert
Convert Claude Code configs (settings, subagents, MCP, skills) into OpenCode config + agents + skills.
- Input (Claude):
- Settings
~/.claude/settings.json~/.claude/settings.local.json./.claude/settings.json
- Agents
~/.claude/agents/*.(json|md)./.claude/agents/*.(json|md)
- Skills
~/.claude/skills/<skill-name>/SKILL.md./.claude/skills/<skill-name>/SKILL.md
- MCP
~/.mcp.json./.mcp.json
- Memory/Rules (optional)
CLAUDE.md.claude/CLAUDE.mdCLAUDE.local.md.claude/rules/*.md.cursor/rules/*.md.cursor/rules/*.mdc
- Settings
- Output (OpenCode):
- Config:
opencode.json - Agents:
.opencode/agent/<agent-name>.md - Skills:
.opencode/skill/<skill-name>/SKILL.md
- Config:
Usage
Run without installing (recommended)
# Bun
bunx oc-convert@latestYou can choose:
- Everything (settings + agents + MCP + skills)
- Only settings / only agents / only MCP / only skills
- Which files to include
Convert one file (non-interactive)
# Convert one Claude agent file → one OpenCode agent markdown
bunx oc-convert --agent .claude/agents/my-agent.md
# Convert ONE Claude settings file → opencode.json
bunx oc-convert --settings .claude/settings.json
# Convert ONE Claude skill → one OpenCode skill folder
bunx oc-convert --skills .claude/skills/my-skillOutput directory
By default, output is written to the directory where you run the CLI. To write elsewhere:
bunx oc-convert --output ./my-output-dirWhat gets converted (important behavior)
- Settings:
permission→ OpenCode permission map (including bash command wildcards)- Model is intentionally not carried over (Claude/OpenCode model names differ)
- Agents:
- Markdown + frontmatter and JSON agents are supported
- Model is intentionally not carried over
- MCP:
stdio→ OpenCodelocalhttp→ OpenCoderemoteenvironment/headers/url/command/argsenv interpolation is converted (see below)
- Skills:
- Writes
.opencode/skill/<skill-name>/SKILL.md - OpenCode only recognizes
name,description,license,compatibility,metadatain YAML frontmatter - Claude’s
allowed-toolsis preserved undermetadata.claudeAllowedToolsand added as a short note in the body
- Writes
Env interpolation conversion (Claude → OpenCode)
Claude-style strings like:
"${API_BASE_URL:-https://api.example.com}/mcp"are converted to OpenCode-style tokens:
"{env:API_BASE_URL}/mcp"Note: Claude’s default/fallback (:-...) is dropped because OpenCode doesn’t support fallback syntax.
Permission conversion notes
- Bash command permissions:
Bash(npm run lint)→"bash": { "npm run lint": "allow" }Bash(git:*)→"bash": { "git *": "allow" }
- WebFetch:
- Claude can specify domains (e.g.
WebFetch(domain:github.com)), but OpenCode is tool-level only. - We convert WebFetch rules to tool-level
webfetchallow/deny.
- Claude can specify domains (e.g.
Overwrites
If a target file already exists (opencode.json or an agent markdown), the CLI will warn and ask before overwriting.
Development / build
# Install deps
bun install
# Dev (runs directly with Bun)
bun run start:dev
# Bundle for publishing (tsup)
bun run build