Call Claude Code CLI from OpenClaw to read codebase, edit files, run commands, and automate coding tasks.
This skill provides integration with Claude Code CLI, allowing OpenClaw to leverage Claude Code's powerful coding capabilities including:
Install Claude Code CLI: bash
curl -fsSL https://claude.ai/install.sh | bash
Authenticate: bash
claude auth login
Verify installation: bash
claude --version
Ask Claude Code a question about your codebase:
text
/claude-code What does the auth module do?
Execute a coding task:
text
/claude-code write tests for the login function
Resume the most recent conversation:
text
/claude-code --continue
Resume a session by name or ID:
text
/claude-code --resume auth-fix
Review code changes:
text
/claude-code review the recent changes
Commit changes with a descriptive message:
text
/claude-code commit my changes
Use a specific model:
text
/claude-code --model opus explain this code
Get structured JSON output for scripting:
text
/claude-code --output-format json --print "list all functions"
CommandDescriptionclaude -p "query"Query via SDK, then exitclaude -cContinue most recent conversationclaude -r "session" "query"Resume session by ID or nameclaude --print "query"Print response without interactive modeclaude updateUpdate to latest versionclaude auth statusShow authentication status
FlagDescriptionExample--print, -pNon-interactive modeclaude -p "query"``--continue, -cContinue sessionclaude -c``--resume, -rResume specific sessionclaude -r session-id "task"``--modelSpecify modelclaude --model opus "task"``--output-formatOutput format (text/json/stream-json)claude -p --output-format json "task"``--max-turnsLimit agentic turnsclaude -p --max-turns 3 "task"``--max-budget-usdMax API spendclaude -p --max-budget-usd 5 "task"``--add-dirAdditional directoriesclaude --add-dir ../lib "task"``--mcp-configLoad MCP serversclaude --mcp-config ./mcp.json
VariableDescriptionANTHROPIC_API_KEYAPI key for authenticationCLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MDEnable CLAUDE.md from additional dirs
This skill is designed to work with OpenClaw's exec tool. Here's how it integrates:
Use OpenClaw's exec tool to run Claude Code commands:
bash
claude -p "What files were changed in the last commit?"
Manage Claude Code sessions through OpenClaw:
bash
# Continue last session
claude -c
# Resume specific session
claude -r my-session "Continue working on the feature"
For advanced integration, configure MCP servers:
bash
claude mcp add <server-name> <config>
text
/claude-code Explore the project structure and tell me what the main components are
text
/claude-code Find and fix the login bug - users can't log in with correct credentials
text
/claude-code Write unit tests for the payment module
text
/claude-code Refactor the auth middleware to use async/await
text
/claude-code Review this PR for security issues
text
/claude-code /batch migrate all API endpoints to use the new error handler
bash
# Check auth status
claude auth status
# Re-authenticate
claude auth login
bash
# Run with specific permission mode
claude --permission-mode plan "task"
bash
# List available sessions
claude --resume
# Fork a session (create new)
claude -r old-session --fork-session "new task"
Run multiple Claude Code instances in parallel:
bash
claude --agents '{
"reviewer": {
"description": "Code reviewer",
"prompt": "You are a senior code reviewer",
"tools": ["Read", "Grep", "Bash"]
}
}'
Automate actions before/after Claude Code runs:
Connect Claude Code to external tools:
bash
claude mcp add github '{"github_token": "..."}'
Note: Claude Code requires authentication. Run claude auth login before first use.