Install
openclaw skills install opencode-cliOpenCode CLI integration skill. Designed for AI agents like OpenClaw to execute coding tasks via OpenCode CLI. Core features: (1) Plan→Build workflow (2) Session management (3) MCP integration (4) Background task monitoring. Use this skill when you need: multi-step coding, Plan→Build workflow, MCP integration, or background task monitoring. NOT for: simple one-line edits (use edit tool directly), quick file reads (use read tool directly).
openclaw skills install opencode-cliThis skill is designed for AI agents like OpenClaw to execute coding tasks via OpenCode CLI.
OpenCode is an AI-powered code editor CLI. When called via OpenClaw, only CLI mode is used.
What this skill does:
What this skill does NOT do:
Credential access:
SUPABASE_URL, SUPABASE_ANON_KEY, CONTEXT7_API_KEYopencode run -m <provider/model> -- "<prompt>"
Example:
opencode run -m <provider/model> -- "Add error handling to the login function"
Correct approach:
# 1. Start Plan (creates session)
opencode run -m <model> -- 'Analyze task, output plan.'
# 2. Wait for user APPROVE
# 3. Switch to Build (continue same session)
opencode run --continue --agent build -- 'Implement approved plan.'
Wrong approach (context lost):
❌ opencode run --agent plan "..." # session A
❌ opencode run --agent build "..." # session B (separate!)
| Agent | Purpose |
|---|---|
plan | Planning, analysis, design |
build | Implementation, coding, modification |
explore | Codebase exploration |
opencode run --continue -- '<prompt>'
opencode run --session <id> -- '<prompt>'
opencode run --continue --fork -- '<prompt>'
opencode session list
opencode session delete <id>
opencode run -m <model> -- '<task>'
opencode run -m <model> -- '<task>'
process action:poll sessionId:<id> timeout:30000
process action:log sessionId:<id>
process action:kill sessionId:<id>
⚠️ Mandatory: After starting, must actively monitor. Do not wait for system event.
Start → Get sessionId
↓
Every 30-60s: poll + log
↓
Progress → Report
Error → Report immediately
Complete → Report result (do not wait for event)
Violation criteria:
OpenCode supports MCP integration to extend capabilities. Must run in project root directory.
Common tools: Playwright (UI automation), Supabase (database)
Scenario guide:
| Scenario | Reference |
|---|---|
| Need UI automation testing (Playwright) | references/mcp-config-guide.md |
| Need database operations (Supabase) | references/mcp-config-guide.md |
| MCP not loading, troubleshoot config | references/mcp-config-guide.md |
OpenCode Agent built-in tools: read/write/edit, bash, grep/glob, todowrite, skill, webfetch
Scenario guide:
| Scenario | Reference |
|---|---|
| Unsure if Agent can perform an operation | references/built-in-tools-guide.md |
| Plan Agent reports insufficient permissions | references/built-in-tools-guide.md (see tool permissions table) |
@filename to quickly reference files/undo to undo, /redo to restoreScenario guide:
| Scenario | Reference |
|---|---|
| Want to reference file instead of typing path | references/tips-guide.md (file reference) |
| Made mistake and want to rollback | references/tips-guide.md (undo/redo) |
| Want to learn TUI shortcuts | references/tips-guide.md (shortcuts) |
Scenario guide:
| Scenario | Reference |
|---|---|
| Want to add custom skill | references/skills-config-guide.md |
| Unsure where to place skill files | references/skills-config-guide.md |
Note: Examples use
openclaw system eventfor optional task notification. This is an OpenClaw platform command. Omit if running outside OpenClaw.
opencode run -m <model> -- 'Analyze task, output plan.'
For detailed plan format, see project workflow documentation.
opencode run -m <model> -- 'Execute approved plan.'
Verify with: npm run build && npm test
cd /path/to/project
opencode run -m <model> -- 'Use Supabase MCP for database operations.'
See: references/mcp-config-guide.md for MCP setup.
opencode run -m <model> -- 'Use Playwright MCP for UI testing.'
See: references/mcp-config-guide.md for MCP setup.
export PATH="/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
Ensure running in project root:
cd /path/to/project && opencode run ...
See: references/mcp-config-guide.md
Use --continue instead of separate starts:
✅ opencode run --continue --agent build "..."
❌ opencode run --agent build "..."
| Task | Command |
|---|---|
| Plan task | opencode run -m <model> -- 'Analyze...' |
| Build (continue session) | opencode run --continue --agent build -- 'Implement...' |
| Continue last session | opencode run --continue |
| Specific session | opencode run --session <id> |
| Fork session | opencode run --continue --fork |
| List sessions | opencode session list |
| Delete session | opencode session delete <id> |
| View models | opencode models |
| Task | Command |
|---|---|
| Background task | pty:true background:true command:"opencode run..." |
| Monitor progress | process action:poll sessionId:<id> |
| View logs | process action:log sessionId:<id> |
| Terminate task | process action:kill sessionId:<id> |
| Scenario | Reference |
|---|---|
| UI automation / Database operations | references/mcp-config-guide.md |
| Agent tool capabilities / Permissions | references/built-in-tools-guide.md |
| Shortcuts / File reference / Undo | references/tips-guide.md |
| Add custom skill | references/skills-config-guide.md |
CLI Integration v2.6 - 2026-04-05