@fwdslsh/crosstrain
v0.1.0
Published
OpenCode plugin that loads Claude Code extension points (skills, agents, commands, hooks) into OpenCode
Downloads
8
Maintainers
Readme
Crosstrain
CLI tool and OpenCode plugin for converting Claude Code extensions to OpenCode format.
What It Does
Crosstrain bridges Claude Code's extension ecosystem to OpenCode:
| Claude Code | → | OpenCode |
|-------------|---|----------|
| Skills (.claude/skills/) | → | Plugin tools |
| Agents (.claude/agents/) | → | Agents (.opencode/agent/) |
| Commands (.claude/commands/) | → | Commands (.opencode/command/) |
| Hooks (settings.json) | → | Event handlers |
| MCP Servers (.mcp.json) | → | MCP config (opencode.json) |
Installation
Quick Install
# Install globally with bun
bun install -g @fwdslsh/crosstrain"
# Or run directly
bunx crosstrain --helpFrom Source
git clone https://github.com/fwdslsh/crosstrain.git
cd crosstrain
bun install
bun link # Makes 'crosstrain' available globallyCLI Usage
crosstrain <command> [path] [options]Commands
| Command | Description |
|---------|-------------|
| command <path> | Convert a Claude Code command (.md file) |
| skill <path> | Convert a skill to OpenCode plugin tool |
| agent <path> | Convert an agent to OpenCode format |
| hook | Display Claude Code hooks configuration |
| mcp [path] | Convert MCP servers to OpenCode config |
| plugin <source> | Convert a full plugin (local or remote) |
| list <source> | List plugins in a marketplace |
| all | Convert all Claude Code assets in project |
| init | Initialize a new skills plugin |
| settings | Import Claude Code settings to opencode.json |
Options
| Option | Description |
|--------|-------------|
| -o, --output-dir <path> | Output directory (default: .opencode) |
| -p, --prefix <prefix> | File prefix for generated files (default: claude_) |
| -v, --verbose | Enable verbose output |
| --dry-run | Preview changes without writing files |
| --no-user | Skip user-level assets from ~/.claude |
Examples
# Convert all assets in current project
crosstrain all
# Preview changes without writing
crosstrain all --dry-run
# Convert a single command
crosstrain command .claude/commands/create-feature.md
# Convert a skill to a plugin tool
crosstrain skill .claude/skills/pdf-extractor
# Convert a plugin from GitHub
crosstrain plugin anthropics/claude-plugins/code-review
# Browse a marketplace
crosstrain list anthropics/claude-plugins
# Convert a specific version
crosstrain plugin org/repo/[email protected]OpenCode Plugin
Crosstrain also works as an OpenCode plugin, exposing tools that let the AI agent assist with conversion.
Plugin Installation
# Clone to your plugin directory
git clone https://github.com/fwdslsh/crosstrain.git .opencode/plugin/crosstrain
cd .opencode/plugin/crosstrain
bun installPlugin Tools
When installed as a plugin, the AI agent can use these tools:
crosstrain- Run any CLI commandcrosstrain_convert_all- Convert all assetscrosstrain_convert_plugin- Convert a plugincrosstrain_list_marketplace- Browse marketplacescrosstrain_convert_command- Convert single commandcrosstrain_convert_skill- Convert single skillcrosstrain_convert_agent- Convert single agentcrosstrain_convert_mcp- Convert MCP serverscrosstrain_show_hooks- Display hooks configcrosstrain_init- Initialize skills plugincrosstrain_import_settings- Import Claude Code settings to opencode.json
Plugin Configuration
Optional settings in .opencode/plugin/crosstrain/settings.json:
{
"enabled": true,
"verbose": false
}Asset Conversion Details
Skills → Plugin Tools
Claude Code skills become OpenCode plugin tools:
.claude/skills/commit-helper/SKILL.md → .opencode/plugin/crosstrain-skills/tools/skill_commit_helper.tsAgents → Agents
.claude/agents/code-review.md → .opencode/agent/claude_code-review.mdModel mapping:
sonnet→anthropic/claude-sonnet-4-20250514opus→anthropic/claude-opus-4-20250514haiku→anthropic/claude-haiku-4-20250514
Commands → Commands
.claude/commands/run-tests.md → .opencode/command/claude_run-tests.mdHooks → Event Handlers
Event mapping:
PreToolUse→tool.execute.beforePostToolUse→tool.execute.afterSessionStart→session.createdSessionEnd→session.idle
MCP Servers → OpenCode Config
.mcp.json → opencode.json (mcp section)Settings → opencode.json
Claude Code settings are converted to OpenCode configuration:
# Import settings
crosstrain settings
# Preview first
crosstrain settings --dry-runPermission mode mapping:
acceptEdits→{ edit: "allow" }bypassPermissions→{ edit: "allow", bash: "allow" }plan→{ edit: "deny", bash: "deny" }
Not converted (no direct equivalent):
hooks- Use OpenCode plugins insteadenv- Set environment variables before running OpenCodecompanyAnnouncements- Not supportedsandbox- OpenCode uses different sandboxing
Remote Plugins
Convert plugins directly from GitHub:
# GitHub shorthand
crosstrain plugin org/repo/plugin-name
# With version tag
crosstrain plugin org/repo/[email protected]
# Full URL
crosstrain plugin https://github.com/org/repoBrowsing Marketplaces
List available plugins in a Claude Code marketplace:
crosstrain list anthropics/claude-pluginsOutput shows plugin names, descriptions, and the command to convert each one.
Crosstrainer Configuration
Plugin authors can customize conversion by adding a crosstrainer.json or crosstrainer.js file to their plugin root.
JSON Configuration
For simple customization (model mappings, asset filtering):
{
"name": "my-plugin",
"prefix": "myplugin_",
"models": {
"sonnet": "anthropic/claude-sonnet-4-20250514"
},
"agents": {
"exclude": ["deprecated-agent"]
}
}JavaScript Configuration
For full control with transform hooks:
export default {
name: "my-plugin",
transformAgent(agent, ctx) {
// Modify agent before conversion
agent.model = "opus"
return agent
},
transformCommand(command, ctx) {
// Return null to skip
if (command.name.startsWith("internal-")) return null
return command
},
onConversionComplete(ctx, results) {
console.log(`Converted ${results.agents.length} agents`)
}
}Only one crosstrainer file per plugin. See CLI Reference for full documentation.
Development
bun install # Install dependencies
bun test # Run tests
bun run typecheck # Type check
bun run build # BuildDocumentation
- CLI Reference - Full CLI documentation
- CLAUDE.md - Architecture and development guide
License
CC-BY-4.0
