运行时依赖
版本
修改的文件列表
安装命令
点击复制技能文档
Claude Code Local 调用本机 Claude Code 作为非交互 coding agent。Orchestrator 负责指挥和验收,Claude Code 负责写代码。
快速参考
场景 | 命令模板
---|---
短任务 | cd && claude --bare -p "<任务>" --max-turns 10
长任务 | cd && claude --bare -p "<任务>" --output-format stream-json --verbose --include-partial-messages --max-turns 30
全权限 | cd && claude --bare -p "<任务>" --dangerously-skip-permissions --output-format stream-json --verbose --include-partial-messages --max-turns 30
只读分析 | cd && claude --bare -p "<任务>" --permission-mode plan --allowedTools "Read,Glob,Grep,LSP" --max-turns 10
JSON 输出 | cd && claude --bare -p "<任务>" --output-format json --max-turns 10
关键 Flag Flag | 用途 ---|--- --bare | 极简模式,跳过 hooks/LSP/plugins,启动更快 -p / --print | 非交互,输出到 stdout(不使用 PTY) --max-turns N | 限制轮数:短任务 10,长任务 30 --output-format stream-json | 流式输出,防止超时 --output-format json | 单 JSON,含 result 字段 --verbose | 详细日志(配合 stream-json) --include-partial-messages | 增量输出(配合 stream-json)
权限模式 默认使用能完成任务的最低级别。 级别 | 模式 | Flag | 场景 1 | Read | --permission-mode plan --allowedTools "Read,Glob,Grep,LSP" | 代码探索、文档审阅 2 | Analyze | 默认 --allowedTools "Read,Bash,Glob,Grep,LSP" | 运行诊断命令 3 | Edit | --permission-mode acceptEdits --allowedTools "Read,Edit,Write,Bash,Glob,Grep,LSP" | 修改源码 4 | Full | --dangerously-skip-permissions | 可信项目、批量操作
耗时预期 复杂度 | 时长 | max-turns 简单(回答问题) | 2-5 min | 5-10 中等(探索+单文件) | 5-15 min | 10-20 复杂(多文件+测试) | 15-30 min | 20-40
执行超时切勿直接杀 Claude Code,先 ps aux | grep claude 检查。
任务后检查清单
- 变更摘要
- 修改文件列表
- 已执行命令
git status --shortgit diff --stat- 测试结果
- 下一步行动
参考资料 references/streaming.md — Stream-JSON 事件类型与过滤 references/troubleshooting.md — 常见故障与修复