S1哥 今日赠品 · 2026-10-31
配套教程:https://x.com/swordBluesy/status/2116262060359373109
来源:Anthropic 官方文档《Best practices for Claude Code》前半部分。英文句子是官方原文示例,带“模板”的是 S1哥 按官方思路整理,把 <> 里换成你自己的。 一、具体提示词(官方对比) 差的:fix the login bug 好的:users report login fails after the session times out. look at token refresh in src/auth/, write a failing test that reproduces it, then fix it 模板:users report <症状>. look at <文件或目录>, write a failing test that reproduces it, then fix it. be ambitious. 二、把输出管道进去(官方示例) cat error.log | claude -p "what's going on here" 三、没想清楚,让它采访你(官方示例,存成 SPEC.md 后开新会话照做) I want to add rate limiting to the public API but haven't thought it through yet. Interview me until you could write the spec, then write it to SPEC.md 模板:I want to <想做的事> but haven't thought it through yet. Interview me until you could write the spec, then write it to SPEC.md 四、检查四档(从轻到严) 第一档,写进提示词(官方示例):run the auth tests after, and keep going until they pass 第二档:用 /goal 设定“什么条件才算完” 第三档:Stop 钩子,脚本以退出码 2 结束,就把 Claude 打回去继续 第四档:用 /code-review,让没看过你对话的新子助手审 diff 五、要证据 模板:做完后给我你跑过的命令和完整输出,不要只说“全部通过”。 做完还可以输入 /verify,让它真的把应用跑起来看结果。 六、CLAUDE.md 只放这四类(官方建议) 1. 怎么验证工作:测试、类型检查、代码规范命令,以及单独跑一个测试文件的方法 2. 代码里有误导的地方 3. 仓库里没有写下来的决定 4. 你已经纠正过它两次的事 一行一行问自己:删掉这行它会出错吗?不会就删。(这句是 S1哥 的自检办法,非官方原话)