来源:Claude Code Cookbook · Part 47 · 原文标题:Part 47 — Recipes

面向所有读者。本章收录至少 60 个 Recipe,按 Beginner / Practitioner / Advanced / Enterprise 分类。每个 Recipe 可独立执行。简单 Recipe 保持简短,复杂 Recipe 给出完整工程细节。
说明:本目录是 Recipe 索引与精选展示;完整可执行 Recipe 分散于各 Part 正文与 examples/。每条标注指向详细来源。


47.0 如何阅读 Recipe

每个 Recipe 通常包含:Goal、Difficulty、Prerequisites、Steps、Prompt、Files、Expected Result、Verification、Failure Modes、Security Notes。按 Recipe 类型删减无意义字段。


47.1 Beginner(12)

#Recipe详细
B01安装(macOS/Linux/Windows/WSL)Part 1
B02登录 + 选模型Part 1 / 35
B03打开第一个项目Part 1
B04修改一个文件Part 3 / 14
B05Review Diff 并 Accept/RejectPart 3 / 28
B06退出与 ResumePart 12
B07安装第一个 SkillPart 17
B08添加 Skill/CommandPart 17
B09写第一条 CLAUDE.mdPart 5
B10claude -p 一次性任务Part 32
B11配置 ~/.claude/settings.jsonPart 8
B12升级与诊断(/doctor)Part 44

47.2 Practitioner(18)

#Recipe详细
P01探索陌生代码库Part 14 / 18
P02修复 BugPart 14
P03添加测试Part 14
P04重构模块Part 14
P05升级依赖Part 14
P06跨文件 FeaturePart 14
P07SQL migrationPart 14
P08Code Review 一段 diffPart 29
P09Checkpoint RewindPart 13
P10Worktree 并行Part 22 / 28
P11Path-scoped RulesPart 5
P12Auto Memory 与 ReviewPart 6
P13Permission profilePart 10 / 40
P14Sandboxed Bash 跑测试Part 11
P15Prompt LibraryPart 15
P16claude -c 续接Part 12 / 32
P17--resume 恢复Part 12
P18--from-pr 打开会话Part 12 / 28

47.3 Advanced(20)

#Recipe详细
A01Reviewer SubagentPart 18
A02Researcher SubagentPart 18
A03Tester SubagentPart 18
A04Security Reviewer SubagentPart 18 / 40
A05Debugger SubagentPart 18
A06Migration AgentPart 18 / 21
A07Subagent Worktree 隔离Part 18 / 22
A083 个并行后台 SubagentPart 18 / 19
A09Dynamic Workflow 审计Part 21
A10完整 Skill(SKILL.md)Part 17
A11完整 PluginPart 25
A12本地 stdio MCPPart 24
A13HTTP MCPPart 24
A14OAuth MCPPart 24
A15Hook 自动 formatPart 23
A16Hook 拦截危险命令Part 23 / 40
A17Hook Edit 后跑测试Part 23
A18Channels 推送 CI 通知Part 26
A19Scheduled Task 依赖审计Part 27
A20claude --worktree 3 并行Part 22

47.4 Enterprise(10)

#Recipe详细
E01Server-managed SettingsPart 41
E02Managed MCP allowlistPart 41
E03Amazon BedrockPart 36
E04GCP Agent PlatformPart 36
E05Microsoft FoundryPart 36
E06Proxy/CA/mTLSPart 41
E07Claude Apps GatewayPart 42
E08Self-hosted EnvironmentPart 42
E09ZDRPart 39 / 41
E10OTel 导出Part 43

合计 ≥ 60。


精选 Recipe 展示

这里展开两个有代表性的 Recipe,展示完整结构。

Recipe B04 精选版:让 Claude 修改一个文件

  • Goal:修改现有源码并 Review Diff。
  • Difficulty:🟢 Beginner
  • Prerequisites:已安装 Claude Code 并登录;在项目目录。
  • Steps:
    1. cd <项目> 然后 claude。
    2. 输入:把 src/utils.ts 里的 parseId 函数改成能处理 undefined 输入。
    3. Claude 读取文件并编辑;用 /diff 查看改动。
    4. 确认或让 Claude 调整。
  • Verification:/diff 显示的改动符合你的意图;必要时让 Claude 跑测试。
  • Failure Modes:Claude 编辑了错误位置 → /rewind 或让 Claude 撤销。
  • Security Notes:默认模式手动批准写入;确认改动内容再放行。

Recipe A09 精选版:用 Dynamic Workflow 审计代码库

  • Goal:并行审查多模块 + 交叉验证发现。
  • Difficulty:🔴 Advanced
  • Prerequisites:v2.1.154+,付费 plan,Anthropic API 或支持 Provider。
  • Steps:
    1. 输入 用一个 workflow 审计这个仓库,每个模块一个 agent,交叉验证每条发现。
    2. 批准脚本。
    3. /workflows 看进度。
    4. 检查汇总。
  • Verification:汇总含模块级发现 + 每条验证结论 + 未证实条目。
  • Failure Modes:超 16 并发自动排队;超预算用范围/effort 控制。
  • Security Notes:脚本须审查后再跑;subagent 继承 allowlist,未允许的 shell/web/MCP 仍提示。

Official References

  • 各 Recipe 详细实现见对应 Part 的 Official References。

索引结束

站内搜索

没有找到内容!