安装方式
手动下载安装
下载 ZIP 后解压到技能目录即可安装。若在桌面客户端 WebView中直接下载出现异常,本站会改为提示页 + 原始链接,请按页内说明操作。
下载 ZIP (shub-openclaw-claude-code-v1.0.0.zip)触发指令
/claude-code-skill
跨平台安装指引
该技能声明兼容以下 1 个平台,将 ZIP 解压到对应目录即可被识别。
unzip shub-openclaw-claude-code-v1.0.0.zip -d ~/.claude/skills/
mkdir -p 创建;启用 Skill 后请重启对应 Agent 让配置生效。
使用指南
MCP 控制 Claude Code
围绕 MCP 控制 Claude Code:经 MCP 协议驱动 Claude Code:执行命令、读写文件、代码搜索及工具链接入,并支持代理团队模式。 无需在每次任务前把零散英文说明手工拼进上下文,也 减少 与客户端默认行为脱节的试错;具体命令、钩子与 JSON 参数仍以 ZIP 包内 SKILL.md 为权威。下文结构与站内 MCP CLI 类专题稿相同:何时用、前置、流程、速查与故障。
何时使用
- 经 MCP 协议驱动 Claude Code:执行命令、读写文件、代码搜索及工具链接入,并支持代理团队模式
- 已获取本技能 ZIP,并准备在 Claude Code / OpenClaw 中按 SKILL.md 挂载。
- 希望用中文专题稿快速判断「该不该启用」,再深入英文 SKILL 查参数与边界。
- 需要与团队对齐同一套触发方式、目录约定或回调格式时。
前置条件
- 通用:可运行 Claude Code 或文档要求的客户端;有可读写的项目工作区(或 SKILL.md 指定的沙箱目录)。
- 权威细节:API Key / OAuth、钩子路径、环境变量以 ZIP 内 SKILL.md 为准。
- OpenClaw:实例可访问本机或远端的 Claude Code / 脚本路径,网络与权限与当前部署一致。
- MCP:宿主(IDE / Desktop)或
mcpCLI 能连到文档中的 MCP 端点;工具列表以mcp tools或等价方式核对。
典型流程
- 从 ClawHub / 站内分发获取技能 ZIP,校验版本与校验和(若提供)。
- 阅读 SKILL.md 的安装段落:目录落点、客户端类型(Claude Code / OpenClaw / 脚本)。
- 在 MCP 宿主中注册服务器,或用
mcp tools <启动命令>核对工具清单后再mcp call。 - 确认工作目录、权限边界与输出路径后,再处理多文件或长耗时任务。
- 需要回调 / Webhook / 通知时,按 SKILL.md 配置端点并在测试环境先验通。
与 ZIP / SKILL.md 的关系
站内专题稿与 MCP CLI 类 oss 稿同样:概括何时用、怎么接、怎么排错;命令模板、钩子名、JSON 字段、版本矩阵一律以 ZIP 内 SKILL.md 与 ClawHub 上游为准。
命令示例(摘自包内 SKILL.md)
以下为从上游 SKILL.md(或入库正文)自动抽取的终端/脚本片段;路径、环境变量与参数以当前 ZIP 与官方说明为准。
ClawHub slug:openclaw-claude-code(安装命令以 SKILL.md / claw CLI 为准)。
# Start a persistent Claude session for your project
claude-code-skill session-start myproject -d ~/project \
--permission-mode plan \
--allowed-tools "Bash,Read,Edit,Write,Glob,Grep" \
--max-budget 2.00
# Send a complex task (Claude will autonomously use tools)
claude-code-skill session-send myproject "Find all TODO comments and create GitHub issues" --stream
# Check progress
claude-code-skill session-status myproject
# Connect to Claude Code MCP
claude-code-skill connect
claude-code-skill status
claude-code-skill tools
# Direct tool calls (no persistent session)
claude-code-skill bash "npm test"
claude-code-skill read /path/to/file.ts
claude-code-skill glob "**/*.ts" -p ~/project
claude-code-skill grep "TODO" -p ~/project -c
claude-code-skill call Write -a '{"file_path":"/tmp/test.txt","content":"Hello"}'
# Disconnect
claude-code-skill disconnect
# Basic start
claude-code-skill session-start myproject -d ~/project
# With custom API endpoint (for Gemini/GPT proxy)
claude-code-skill session-start gemini-task -d ~/project \
--base-url http://127.0.0.1:8082 \
--model gemini-2.0-flash
# With permission mode (plan = preview changes before applying)
claude-code-skill session-start review -d ~/project --permission-mode plan
# With tool whitelist (auto-approve these tools)
claude-code-skill session-start safe -d ~/project \
--allowed-tools "Bash(git:*),Read,Glob,Grep"
# With budget limit
claude-code-skill session-start limited -d ~/project --max-budget 1.50
# Full configuration
claude-code-skill session-start advanced -d ~/project \
--permission-mode acceptEdits \
--allowed-tools "Bash,Read,Edit,Write" \
--disallowed-tools "Task" \
--max-budget 5.00 \
--model claude-opus-4-5 \
--append-system-prompt "Always write tests" \
--add-dir "/tmp,/var/log"
# Basic send (blocks until complete)
claude-code-skill session-send myproject "Write unit tests for auth.ts"
# Streaming (see progress in real-time)
claude-code-skill session-send myproject "Refactor this module" --stream
# With custom timeout
claude-code-skill session-send myproject "Run all tests" -t 300000
# List active sessions
claude-code-skill session-list
# Get detailed status
claude-code-skill session-status myproject
# View conversation history
claude-code-skill session-history myproject -n 50
# Pause and resume
claude-code-skill session-pause myproject
claude-code-skill session-resume-paused myproject
# Fork a session (create a branch for experiments)
claude-code-skill session-fork myproject myproject-experiment
# Stop
claude-code-skill session-stop myproject
# Restart a failed session
claude-code-skill session-restart myproject
# Browse all Claude Code sessions
claude-code-skill sessions -n 20
# Search sessions by project
claude-code-skill session-search --project ~/myapp
# Search by time
claude-code-skill session-search --since "2h"
claude-code-skill session-search --since "2024-02-01"
# Search by query
claude-code-skill session-search "bug fix"
# Resume a historical session
claude-code-skill resume <session-id> "Continue where we left off" -d ~/project
# Read multiple files at once
claude-code-skill batch-read "src/**/*.ts" "tests/**/*.test.ts" -p ~/project
# Define a team of agents
claude-code-skill session-start team-project -d ~/project \
--agents '{
"architect": {
"description": "Designs system architecture",
"prompt": "You are a senior software architect. Design scalable, maintainable systems."
},
"developer": {
"description": "Implements features",
"prompt": "You are a full-stack developer. Write clean, tested code."
},
"reviewer": {
"description": "Reviews code quality",
"prompt": "You are a code reviewer. Check for bugs, style issues, and improvements."
}
}' \
--agent architect
# Switch between agents mid-conversation
claude-code-skill session-send team-project "Design the authentication system"
# (architect responds)
claude-code-skill session-send team-project "@developer implement the design"
# (developer agent takes over)
claude-code-skill session-send team-project "@reviewer review the implementation"
# (reviewer agent takes over)
# Code review team
claude-code-skill session-start review -d ~/project \
--agents '{
"security": {"prompt": "Focus on security vulnerabilities"},
"performance": {"prompt": "Focus on performance issues"},
"quality": {"prompt": "Focus on code quality and maintainability"}
}' \
--agent security
# Full-stack team
claude-code-skill session-start fullstack -d ~/project \
--agents '{
"frontend": {"prompt": "React/TypeScript frontend specialist"},
"backend": {"prompt": "Node.js/Express backend specialist"},
"database": {"prompt": "PostgreSQL/Redis database specialist"}
}' \
--agent frontend
# Allow specific tools with patterns
--allowed-tools "Bash(git:*,npm:*),Read,Edit"
# Deny dangerous operations
--disallowed-tools "Bash(rm:*,sudo:*),Write(/etc/*)"
# Limit to specific tool set
--tools "Read,Glob,Grep"
# Disable all tools
--tools ""
站内入库时的触发命令(完整语义见 ZIP):
# 使用本技能时可在对话中引用或执行上述指令;完整参数与示例见下载包内 SKILL.md。
/claude-code-skill
最佳实践
- 先 SKILL.md 再猜参数;站内专题稿不替代 schema 与必填字段说明。
- 委派任务时写清验收标准(命令、文件路径、测试命令),减少来回追问。
- 长任务用文档推荐的回调 / 日志落盘代替高频轮询,省 Token 也省机器负载。
- 多技能同时启用时,注意钩子加载顺序与重复工具调用(以 SKILL.md 冲突说明为准)。
调试与排错
- 打开 stderr 与客户端日志;PTY/tmux 场景同时看面板最后几十行输出。
- 参数错误时对照 SKILL.md 中的 JSON/CLI 示例(引号、转义、工作目录)。
- 网络类失败:查代理、防火墙、MCP 传输方式(stdio / HTTP / SSE)。
- OpenClaw 侧核对 channel、路由与 Claude Code 进程是否仍在运行。
速查
| 动作 | 说明 |
|------|------|
| 获取技能包 | ClawHub / 站内 ZIP,核对版本 |
| 权威步骤 | 优先阅读 ZIP 内 SKILL.md |
| 首次试跑 | 使用 SKILL.md 最小示例 |
| 验收 | 对照路径、测试命令或回调负载 |
| MCP | mcp tools / mcp call 或宿主内工具面板 |
| OpenClaw | 路由、channel 与远端进程状态 |
常见故障
- 无输出或立即退出 → 工作目录错误、依赖未装、或 Claude Code 未登录;按 SKILL.md 自检清单执行。
- 权限被拒绝 → 检查沙箱路径、
--permission-mode与工具白名单。 - 与简介不符 → 以英文 SKILL 与上游仓库为准,站内稿仅作结构化导读。
# Claude Code Skill
Control Claude Code via MCP (Model Context Protocol). This skill unleashes the full power of Claude Code for openclaw agents, including persistent sessions, agent teams, and advanced tool control.
## ⚡ Quick Start
```bash
# Start a persistent Claude session for your project
claude-code-skill session-start myproject -d ~/project \
--permission-mode plan \
--allowed-tools "Bash,Read,Edit,Write,Glob,Grep" \
--max-budget 2.00
# Send a complex task (Claude will autonomously use tools)
claude-code-skill session-send myproject "Find all TODO comments and create GitHub issues" --stream
# Check progress
claude-code-skill session-status myproject
```
## 🎯 When to Use This Skill
### Use Persistent Sessions When:
- ✅ Multi-step tasks requiring multiple tool calls
- ✅ Iterative development (write code → test → fix → repeat)
- ✅ Long conversations needing full context
- ✅ Agent needs to work autonomously
- ✅ You want streaming real-time feedback
### Use Direct MCP Tools When:
- ✅ Single command execution
- ✅ Quick file read/write
- ✅ One-off searches
- ✅ No context needed between operations
## 📚 Command Reference
### Basic MCP Operations
```bash
# Connect to Claude Code MCP
claude-code-skill connect
claude-code-skill status
claude-code-skill tools
# Direct tool calls (no persistent session)
claude-code-skill bash "npm test"
claude-code-skill read /path/to/file.ts
claude-code-skill glob "**/*.ts" -p ~/project
claude-code-skill grep "TODO" -p ~/project -c
claude-code-skill call Write -a '{"file_path":"/tmp/test.txt","content":"Hello"}'
# Disconnect
claude-code-skill disconnect
```
### Persistent Sessions (Agent Loop)
#### Starting Sessions
```bash
# Basic start
claude-code-skill session-start myproject -d ~/project
# With custom API endpoint (for Gemini/GPT proxy)
claude-code-skill session-start gemini-task -d ~/project \
--base-url http://127.0.0.1:8082 \
--model gemini-2.0-flash
# With permission mode (plan = preview changes before applying)
claude-code-skill session-start review -d ~/project --permission-mode plan
# With tool whitelist (auto-approve these tools)
claude-code-skill session-start safe -d ~/project \
--allowed-tools "Bash(git:*),Read,Glob,Grep"
# With budget limit
claude-code-skill session-start limited -d ~/project --max-budget 1.50
# Full configuration
claude-code-skill session-start advanced -d ~/project \
--permission-mode acceptEdits \
--allowed-tools "Bash,Read,Edit,Write" \
--disallowed-tools "Task" \
--max-budget 5.00 \
--model claude-opus-4-5 \
--append-system-prompt "Always write tests" \
--add-dir "/tmp,/var/log"
```
**Permission Modes:**
| Mode | Description |
|------|-------------|
| `acceptEdits` | Auto-accept file edits (default) |
| `plan` | Preview changes before applying |
| `default` | Ask for each operation |
| `bypassPermissions` | Skip all prompts (dangerous!) |
| `delegate` | Delegate decisions to parent |
| `dontAsk` | Never ask, reject by default |
#### Sending Messages
```bash
# Basic send (blocks until complete)
claude-code-skill session-send myproject "Write unit tests for auth.ts"
# Streaming (see progress in real-time)
claude-code-skill session-send myproject "Refactor this module" --stream
# With custom timeout
claude-code-skill session-send myproject "Run all tests" -t 300000
```
#### Managing Sessions
```bash
# List active sessions
claude-code-skill session-list
# Get detailed status
claude-code-skill session-status myproject
# View conversation history
claude-code-skill session-history myproject -n 50
# Pause and resume
claude-code-skill session-pause myproject
claude-code-skill session-resume-paused myproject
# Fork a session (create a branch for experiments)
claude-code-skill session-fork myproject myproject-experiment
# Stop
claude-code-skill session-stop myproject
# Restart a failed session
claude-code-skill session-restart myproject
```
### Session History & Search
```bash
# Browse all Claude Code sessions
claude-code-skill sessions -n 20
# Search sessions by project
claude-code-skill session-search --project ~/myapp
# Search by time
claude-code-skill session-search --since "2h"
claude-code-skill session-search --since "2024-02-01"
# Search by query
claude-code-skill session-search "bug fix"
# Resume a historical session
claude-code-skill resume <session-id> "Continue where we left off" -d ~/project
```
### Batch Operations
```bash
# Read multiple files at once
claude-code-skill batch-read "src/**/*.ts" "tests/**/*.test.ts" -p ~/project
```
## 🤝 Agent Team Features
Deploy multiple Claude agents working together on complex tasks.
### Basic Agent Team
```bash
# Define a team of agents
claude-code-skill session-start team-project -d ~/project \
--agents '{
"architect": {
"description": "Designs system architecture",
"prompt": "You are a senior software architect. Design scalable, maintainable systems."
},
"developer": {
"description": "Implements features",
"prompt": "You are a full-stack developer. Write clean, tested code."
},
"reviewer": {
"description": "Reviews code quality",
"prompt": "You are a code reviewer. Check for bugs, style issues, and improvements."
}
}' \
--agent architect
# Switch between agents mid-conversation
claude-code-skill session-send team-project "Design the authentication system"
# (architect responds)
claude-code-skill session-send team-project "@developer implement the design"
# (developer agent takes over)
claude-code-skill session-send team-project "@reviewer review the implementation"
# (reviewer agent takes over)
```
### Pre-configured Team Templates
```bash
# Code review team
claude-code-skill session-start review -d ~/project \
--agents '{
"security": {"prompt": "Focus on security vulnerabilities"},
"performance": {"prompt": "Focus on performance issues"},
"quality": {"prompt": "Focus on code quality and maintainability"}
}' \
--agent security
# Full-stack team
claude-code-skill session-start fullstack -d ~/project \
--agents '{
"frontend": {"prompt": "React/TypeScript frontend specialist"},
"backend": {"prompt": "Node.js/Express backend specialist"},
"database": {"prompt": "PostgreSQL/Redis database specialist"}
}' \
--agent frontend
```
## 🔧 Advanced Features
### Tool Control
```bash
# Allow specific tools with patterns
--allowed-tools "Bash(git:*,npm:*),Read,Edit"
# Deny dangerous operations
--disallowed-tools "Bash(rm:*,sudo:*),Write(/etc/*)"
# Limit to specific tool set
--tools "Read,Glob,Grep"
# Disable all tools
--tools ""
```
### System Prompts
```bash
# Replace system prompt completely
--system-prompt "You are a Python expert. Always use type hints."
# Append to existing prompt
--append-system-prompt "Always run tests after changes."
```
### Session Management
```bash
# Resume with fork (create a branch)
--resume <session-id> --fork-session
# Use custom UUID for session
--session-id "550e8400-e29b-41d4-a716-446655440000"
# Add additional working directories
--add-dir "/var/log,/tmp/workspace"
```
### Multi-Model Support (Proxy)
Use `--base-url` to route requests through a proxy, enabling other models (Gemini, GPT) to power Claude Code:
```bash
# Use Gemini via claude-code-proxy
claude-code-skill session-start gemini-task -d ~/project \
--base-url http://127.0.0.1:8082 \
--model claude-3-5-sonnet-20241022 # Proxy will map to Gemini
# Use GPT via proxy
claude-code-skill session-start gpt-task -d ~/project \
--base-url http://127.0.0.1:8082 \
--model claude-3-haiku-20240307 # Proxy will map to GPT
```
**Note:** Requires `claude-code-proxy` running on port 8082 with proper API keys configured.
```bash
# Start the proxy
cd ~/clawd/claude-code-proxy && source .venv/bin/activate
uvicorn server:app --host 127.0.0.1 --port 8082
```
## 🎓 Best Practices
### For OpenClaw Agents
1. **Always use persistent sessions for multi-step tasks**
```bash
# ❌ Bad: Multiple disconnect/reconnect cycles
claude-code-skill bash "step1"
claude-code-skill bash "step2"
# ✅ Good: Single persistent session
claude-code-skill session-start task -d ~/project
claude-code-skill session-send task "Do step1 then step2"
```
2. **Use `--stream` for long-running tasks**
```bash
claude-code-skill session-send task "Run full test suite" --stream
```
3. **Set budget limits for safety**
```bash
--max-budget 2.00 # Stop after $2 of API usage
```
4. **Use plan mode for critical changes**
```bash
--permission-mode plan # Preview before applying
```
5. **Fork before experiments**
```bash
claude-code-skill session-fork main experimental
claude-code-skill session-send experimental "Try risky refactor"
```
### Error Recovery
```bash
# If session fails:
claude-code-skill session-status myproject # Check what happened
claude-code-skill session-history myproject -n 20 # See recent events
claude-code-skill session-restart myproject # Restart from last good state
# If you need to start over:
claude-code-skill session-stop myproject
claude-code-skill session-start myproject -d ~/project --resume <old-session-id>
```
## 🏗️ Architecture
```
openclaw agent
↓
claude-code-skill CLI (this tool)
↓ HTTP
sasha-doctor API (:18795)
↓ MCP
claude mcp serve (Claude Code)
↓
Your files & tools
```
## 🔌 Available Tools (via MCP)
All Claude Code tools are accessible:
| Tool | Description |
|------|-------------|
| Bash | Execute shell commands |
| Read | Read file contents |
| Write | Create/overwrite files |
| Edit | Edit files with string replacement |
| Glob | Find files by pattern |
| Grep | Search file contents |
| Task | Launch sub-agents |
| WebFetch | Fetch web content |
| WebSearch | Search the web |
| Git* | Git operations |
| AskUserQuestion | Interactive prompts |
| ... | and 10+ more |
## 📊 Examples
### Example 1: Code Review
```bash
claude-code-skill session-start review -d ~/myapp \
--permission-mode plan \
--agents '{"security":{"prompt":"Focus on security"},"quality":{"prompt":"Focus on quality"}}' \
--agent security
claude-code-skill session-send review \
"Review all TypeScript files in src/, check for security issues and code quality problems" \
--stream
```
### Example 2: Automated Testing
```bash
claude-code-skill session-start test -d ~/myapp \
--allowed-tools "Bash(npm:*,git:*),Read,Write" \
--max-budget 1.00
claude-code-skill session-send test \
"Find all untested functions, write unit tests, run tests, fix failures"
```
### Example 3: Multi-Agent Debugging
```bash
claude-code-skill session-start debug -d ~/myapp \
--agents '{
"detective": {"prompt": "Find the root cause of bugs"},
"fixer": {"prompt": "Implement fixes"},
"tester": {"prompt": "Verify fixes work"}
}' \
--agent detective
claude-code-skill session-send debug "We have a memory leak in the API server" --stream
# Detective investigates, then hands off to fixer, then to tester
```
## 🔗 Integration with OpenClaw
When openclaw needs to perform complex coding tasks:
```bash
# From within openclaw agent context:
openclaw skills run claude-code-skill -- session-start task -d ~/project
openclaw skills run claude-code-skill -- session-send task "Implement feature X" --stream
openclaw skills run claude-code-skill -- session-status task
```
Or use the skill programmatically via sasha-doctor HTTP API (see TOOLS.md section 3).
## 📖 See Also
- **TOOLS.md section 3** - Full HTTP API documentation
- **sasha-doctor endpoints** - Backend integration details
- **Claude Code docs** - Official Claude Code documentation (query via `qmd` tool)