Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Install, authenticate, and use Claude Code CLI as a native coding tool for any OpenClaw agent system.
.claude/skills/leoyeai-claude-code-cli-for-openclaw/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 312% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 436% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 266% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 242% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 470% | 0% |
This skill teaches OpenClaw agents how to install, authenticate, configure, and use Claude Code CLI as a coding tool. Claude Code is an official Anthropic CLI that provides file-based context efficiency, reducing token usage by 80-90% compared to raw API calls for coding tasks.
Key Benefits:
Use Cases:
| Mode | Description | |------|-------------| | 🤖 OpenClaw Backend | Use as claude-cli model in any agent (claude-cli/sonnet-4.6, claude-cli/opus-4.6) | | 🖥️ Direct CLI | Run claude --print from any project directory — no agent config needed | | ☁️ With MissionDeck | Track Claude Code sessions live in your MissionDeck.ai dashboard via JARVIS integration |
pty: true with exec tool)bashnpm install -g @anthropic-ai/claude-code
bashwhich claude && claude --version
Expected output:
/usr/bin/claude
2.1.75Use the provided installation script:
bashcd /root/.openclaw/workspace/skills/claude-code bash scripts/install.sh
The script handles:
Claude Code requires browser-based OAuth authentication using a Claude Max subscription. Raw API keys (sk-ant-api03-) will NOT work.
Run this in a PTY terminal (requires TTY):
bashclaude setup-token
Flow:
https://claude.ai/oauth/authorize?code=true&client_id=...&code_challenge=...
Paste code here if prompted >✓ Long-lived authentication token created successfully!sk-ant-oat01-xxxxx (valid for 1 year)The token must be available as the CLAUDE_CODE_OAUTH_TOKEN environment variable.
Option 1: Shell RC Files (Recommended)
bashecho "export CLAUDE_CODE_OAUTH_TOKEN=YOUR_OAUTH_TOKEN_HERE" >> /root/.bashrc echo "export CLAUDE_CODE_OAUTH_TOKEN=YOUR_OAUTH_TOKEN_HERE" >> /root/.profile source /root/.bashrc
Option 2: System-Wide
bashecho "CLAUDE_CODE_OAUTH_TOKEN=YOUR_OAUTH_TOKEN_HERE" >> /etc/environment
Option 3: OpenClaw Config Only
Add to your openclaw.json config patch (see next section) — the token will be available during OpenClaw backend calls but not direct CLI usage.
CRITICAL: Never commit your CLAUDE_CODE_OAUTH_TOKEN to version control.
.env* files to .gitignoreAdd to your .gitignore:
gitignore.env .env.local .env.*.local openclaw.json config.patch
bashecho $CLAUDE_CODE_OAUTH_TOKEN # Should output: sk-ant-oat01-xxxxx
Integrate Claude Code as a CLI backend in OpenClaw, enabling it as a model option and fallback.
Create or append to ~/.openclaw/config.patch:
json{ "agents": { "defaults": { "cliBackends": { "claude-cli": { "command": "/usr/bin/claude", "env": { "CLAUDE_CODE_OAUTH_TOKEN": "YOUR_OAUTH_TOKEN_HERE" } } }, "models": { "claude-cli/opus-4.6": { "alias": "claude-cli-opus" }, "claude-cli/sonnet-4.6": { "alias": "claude-cli-sonnet" } } }, "list": [ { "id": "tank", "model": { "primary": "anthropic/claude-opus-4-5", "fallbacks": [ "google/gemini-3-flash-preview", "claude-cli/opus-4.6" ] } } ] } }
bashgateway config.patch
Verify in gateway logs or test by spawning a coding session.
claude-cli/sonnet-4.6 → Claude Sonnet 4.6 (fast, general coding)claude-cli/opus-4.6 → Claude Opus 4.6 (complex reasoning, architecture)Use as primary model, fallback, or invoke directly via exec.
Critical: Every project using Claude Code should have a CLAUDE.md file in its root directory. This is the "project brain" — Claude Code reads it automatically at session start.
markdown# Project: [Name] ## Overview [1-2 sentence project description] ## Tech Stack - Language: [e.g., TypeScript, Python, Rust] - Framework: [e.g., Next.js, FastAPI, Supabase] - Key Dependencies: [list major packages] ## Directory Structure
/ ├── src/ # Source code ├── public/ # Static assets ├── supabase/ # Database functions, migrations └── docs/ # Documentation
## Key Files
- `src/App.tsx` - Main app component, routing
- `src/lib/supabase.ts` - Database client
- `supabase/functions/` - Edge functions (24 total)
## Coding Standards
- Use TypeScript strict mode
- Functional components (React)
- Tailwind CSS for styling
- ESLint + Prettier configured
## Deployment
- Platform: Netlify (frontend), Supabase (backend)
- Deploy command: `npm run build`
- Environment: `.env.local` (never commit)
## Critical Rules
- Never commit API keys
- Always run `npm run build` before pushing
- All functions must have TypeScript types
## Testing
- `npm test` - Run Jest tests
- `npm run lint` - Check code styleCopy the provided template and customize:
bashcp /root/.openclaw/workspace/skills/claude-code/templates/CLAUDE.md.template /path/to/your/project/CLAUDE.md # Edit with project-specific details
For MissionDeck project, we created:
/root/.openclaw/workspace/missiondeck/CLAUDE.mdStep 1: Sync Project
bashcd /path/to/project git pull origin main
Step 2: Run Claude Code with Task
bashCLAUDE_CODE_OAUTH_TOKEN=$CLAUDE_CODE_OAUTH_TOKEN claude --print "Fix the signup redirect bug in src/pages/AuthVerify.tsx — users aren't being redirected to /dashboard after magic link verification"
Step 3: Review Proposed Changes
Claude Code will:
Step 4: Build Check
bashnpm run build # or npm test, cargo build, etc.
Step 5: Commit and Push
bashgit checkout -b agent/fix-signup-redirect git add . git commit -m "fix: redirect to /dashboard after magic link verification" git push origin agent/fix-signup-redirect
Step 6: Create PR (Optional)
bashgh pr create --title "Fix signup redirect" --body "Fixes redirect bug in AuthVerify.tsx"
For agents using the exec tool:
javascriptexec({ command: `cd /path/to/project && CLAUDE_CODE_OAUTH_TOKEN=$CLAUDE_CODE_OAUTH_TOKEN claude --print "Your task here"`, workdir: "/path/to/project", pty: false // PTY not needed for --print mode })
Once ACP harness is configured:
javascriptsessions_spawn({ runtime: "acp", agentId: "claude-code", message: "Fix the navbar bug in components/Navbar.tsx", label: "claude-code-navbar-fix" })
Effective prompts yield better results. Here are proven patterns:
"Show me your plan first. List every file you'll touch and what changes you'll make. Wait for my approval before implementing."Why: Prevents unwanted changes, gives you control
"Fix the authentication bug. After you're done, grill yourself — what edge cases did you miss? What could break?"Why: Forces deeper reasoning, catches edge cases
For complex tasks, use 3 separate prompts:
Prompt 1 (Research):
"Research how the payment flow works. Show me all relevant files and how they connect."Prompt 2 (Plan):
"Now plan how to add recurring billing. List the changes step-by-step."Prompt 3 (Implement):
"Implement the plan. Make the changes."Why: Breaks complexity into manageable phases
"In src/pages/AuthVerify.tsx, line 42, the redirect after magic link verification is broken. Expected behavior: redirect to /dashboard. Current behavior: stays on /verify. Fix it."Why: Clear context = precise fixes
"Refactor src/lib/database.ts — extract the connection pool logic into a separate file src/lib/db-pool.ts"Why: Claude Code excels at file-level operations
❌ Vague: "Make the app better" ❌ No context: "Fix the bug" ❌ Too broad: "Rewrite the entire codebase" ❌ Missing paths: "Update the config file" (which one?)
✅ Specific: "Fix the redirect bug in src/pages/AuthVerify.tsx — users should go to /dashboard after email verification" ✅ Scoped: "Refactor the authentication logic in src/lib/auth.ts to use async/await instead of promises" ✅ Clear paths: "Update the database connection pool size in src/config/database.ts from 10 to 20"
| Method | Tokens per Task | Cost Model | |--------|----------------|------------| | Raw API (full file dump) | 10,000 - 50,000 | Per-token ($) | | Claude Code (tool-based) | ~500 | Flat-rate (Claude Max subscription) |
Savings: 80-90% reduction in token usage
Raw API Approach:
User: "Fix the bug in App.tsx"
Agent: [reads entire App.tsx] [dumps 5,000 tokens into context] [generates fix] [writes back]
Cost: ~7,000 tokensClaude Code Approach:
User: "Fix the bug in App.tsx"
Claude Code: [uses file tool to read App.tsx] [analyzes in isolation] [generates fix] [uses edit tool]
Cost: ~500 tokensResult: Same quality, 90% fewer tokens, flat-rate billing
"Remove the offer/discount banner from MissionDeck navbar"
Claude Code Execution:
bashcd /root/.openclaw/workspace/missiondeck CLAUDE_CODE_OAUTH_TOKEN=$CLAUDE_CODE_OAUTH_TOKEN claude --print "Remove the discount banner from the navbar"
What Happened:
DiscountBanner component in src/components/Navbar.tsximport { DiscountBanner } from './DiscountBanner'<DiscountBanner /> JSX elementnpm run build ✓oracle/disable-discount-bannerToken Usage: ~450 tokens Time: 30 seconds Result: Precise, working, deployed
Cause: Token expired or invalid
Fix:
bashclaude setup-token # Re-authenticate # Update token in environment and OpenClaw config
Cause: NPM global bin not in PATH
Fix:
bashexport PATH="$PATH:$(npm bin -g)" echo 'export PATH="$PATH:$(npm bin -g)"' >> /root/.bashrc
Cause: Project missing CLAUDE.md file
Fix:
bashcp /root/.openclaw/workspace/skills/claude-code/templates/CLAUDE.md.template /path/to/project/CLAUDE.md # Edit with project details
Cause: claude setup-token needs TTY
Fix (with OpenClaw exec):
javascriptexec({ command: "claude setup-token", pty: true // Enable pseudo-terminal })
Cause: Running Claude Code from wrong directory
Fix: Always cd into project root first
bashcd /path/to/project CLAUDE_CODE_OAUTH_TOKEN=$CLAUDE_CODE_OAUTH_TOKEN claude --print "your task"
Cause: Claude Code proposes changes, but requires approval in interactive mode
Fix: Use --print flag for non-interactive mode (outputs to stdout)
bashclaude --print "your task" # No approval needed, just shows output
For interactive mode (approval required):
bashclaude # Interactive, will wait for y/n approval
Process multiple tasks sequentially:
bashcd /path/to/project CLAUDE_CODE_OAUTH_TOKEN=$CLAUDE_CODE_OAUTH_TOKEN claude --print "Task 1: Fix auth bug" CLAUDE_CODE_OAUTH_TOKEN=$CLAUDE_CODE_OAUTH_TOKEN claude --print "Task 2: Add new endpoint" CLAUDE_CODE_OAUTH_TOKEN=$CLAUDE_CODE_OAUTH_TOKEN claude --print "Task 3: Update tests"
Force specific model:
bashclaude --model opus-4.6 --print "Complex architecture refactor" claude --model sonnet-4.6 --print "Quick bug fix"
bash# Create feature branch git checkout -b feature/claude-code-implementation # Run Claude Code CLAUDE_CODE_OAUTH_TOKEN=$CLAUDE_CODE_OAUTH_TOKEN claude --print "Implement feature X" # Review changes git diff # Commit git add . git commit -m "feat: implement X using claude-code" # Push git push origin feature/claude-code-implementation
git pull to avoid conflictsNext Steps:
npm install -g @anthropic-ai/claude-codeclaude setup-tokenconfig.patchCLAUDE_CODE_OAUTH_TOKEN=$token claude --print "your task"bashclawhub install jarvis-mission-control # Free agent command center with Claude Code session tracking clawhub install openclaw-token-optimizer # Reduce token costs by 50-80% clawhub search Asif2BD # All skills
MissionDeck.ai · Free tier · No credit card required
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 6,398 | 3,915 | -39% | 1 | 1 | 0% | 1,365 | 5,620 | +312% | 0 | 0 | — |
case-02 | fail→pass | 5,918 | 4,382 | -26% | 1 | 1 | 0% | 1,036 | 5,556 | +436% | 0 | 0 | — |
case-03 | pass→pass | 11,140 | 3,274 | -71% | 1 | 1 | 0% | 1,706 | 5,344 | +213% | 0 | 0 | — |
case-04 | fail→pass | 6,679 | 4,942 | -26% | 1 | 1 | 0% | 1,588 | 5,812 | +266% | 0 | 0 | — |
case-05 | pass→pass | 4,521 | 2,797 | -38% | 1 | 1 | 0% | 759 | 5,342 | +604% | 0 | 0 | — |
case-06 | pass→pass | 12,500 | 9,794 | -22% | 1 | 1 | 0% | 2,123 | 6,719 | +216% | 0 | 0 | — |
case-07 | fail→pass | 6,792 | 2,804 | -59% | 1 | 1 | 0% | 1,585 | 5,423 | +242% | 0 | 0 | — |
case-08 | pass→pass | 6,481 | 3,252 | -50% | 1 | 1 | 0% | 1,101 | 5,171 | +370% | 0 | 0 | — |
case-09 | fail→pass | 22,610 | 5,460 | -76% | 1 | 1 | 0% | 996 | 5,682 | +470% | 0 | 0 | — |
case-10 | fail→pass | 9,468 | 2,649 | -72% | 1 | 1 | 0% | 1,517 | 5,238 | +245% | 0 | 0 | — |
case-11 | fail→pass | 8,513 | 3,593 | -58% | 1 | 1 | 0% | 1,435 | 5,211 | +263% | 0 | 0 | — |
case-12 | pass→pass | 3,347 | 3,023 | -10% | 1 | 1 | 0% | 504 | 5,047 | +901% | 0 | 0 | — |
case-13 | fail→pass | 7,684 | 3,305 | -57% | 1 | 1 | 0% | 1,243 | 5,099 | +310% | 0 | 0 | — |
case-14 | pass→pass | 8,403 | 5,565 | -34% | 1 | 1 | 0% | 1,358 | 5,727 | +322% | 0 | 0 | — |
case-15 | pass→pass | 7,597 | 3,385 | -55% | 1 | 1 | 0% | 1,269 | 5,310 | +318% | 0 | 0 | — |
case-16 | pass→pass | 7,749 | 3,520 | -55% | 1 | 1 | 0% | 1,388 | 5,504 | +297% | 0 | 0 | — |
case-17 | pass→pass | 10,589 | 2,372 | -78% | 1 | 1 | 0% | 1,622 | 5,171 | +219% | 0 | 0 | — |
case-18 | pass→pass | 16,972 | 8,964 | -47% | 1 | 1 | 0% | 3,055 | 6,564 | +115% | 0 | 0 | — |
case-19 | fail→pass | 9,145 | 1,805 | -80% | 1 | 1 | 0% | 1,607 | 5,165 | +221% | 0 | 0 | — |
case-20 | pass→pass | 6,788 | 6,400 | -6% | 1 | 1 | 0% | 1,251 | 5,889 | +371% | 0 | 0 | — |
case-21 | pass→pass | 7,764 | 6,714 | -14% | 1 | 1 | 0% | 1,243 | 6,178 | +397% | 0 | 0 | — |
case-22 | pass→pass | 11,173 | 7,204 | -36% | 1 | 1 | 0% | 1,687 | 6,125 | +263% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 21 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +41 percentage points is the difference between those two pass rates over the 21 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.