中文 | English
claude-code-best-practice
从 vibe coding 走向 agentic engineering - practice makes claude perfect
= Agents · = Commands · = Skills

Boris Cherny 在 X 上的帖子(tweet 1 · tweet 2 · tweet 3)
🧠 CONCEPTS
| Feature | Location | Description |
|---|---|---|
| Subagents | .claude/agents/<name>.md | 在全新隔离上下文中运行的自治执行体,拥有自定义工具、权限、模型、记忆和持久身份 |
| Commands | .claude/commands/<name>.md | 注入到现有上下文中的知识,即用户主动调用的简单 prompt 模板,用于工作流编排 |
| Skills | .claude/skills/<name>/SKILL.md | 注入到现有上下文中的知识,可配置、可预加载、可自动发现,并支持上下文 fork 与渐进式披露 · Official Skills |
| Workflows | .claude/commands/weather-orchestrator.md | |
| Hooks | .claude/hooks/ | 在 agentic loop 之外、针对特定事件运行的用户自定义处理器(scripts、HTTP、prompts、agents)· Guide |
| MCP Servers | .claude/settings.json, .mcp.json | 连接外部工具、数据库和 API 的 Model Context Protocol |
| Plugins | distributable packages | skills、subagents、hooks、MCP servers 与 LSP servers 的打包分发形式 · Marketplaces · Create Marketplaces |
| Settings | .claude/settings.json | 分层配置系统 · Permissions · Model Config · Output Styles · Sandboxing · Keybindings · Fast Mode |
| Status Line | .claude/settings.json | 可自定义状态栏,显示上下文使用量、模型、成本与会话信息 |
| Memory | CLAUDE.md, .claude/rules/, ~/.claude/rules/, ~/.claude/projects/<project>/memory/ | 通过 CLAUDE.md 文件和 @path 导入实现持久上下文 · Auto Memory · Rules |
| Checkpointing | automatic (git-based) | 基于 git 的自动编辑追踪,支持回退(Esc Esc 或 /rewind)与定向摘要 |
| CLI Startup Flags | claude [flags] | 启动 Claude Code 的命令行 flags、subcommands 和环境变量 · Interactive Mode · Env Vars |
| AI Terms | Agentic Engineering · Context Engineering · Vibe Coding | |
| Best Practices | 官方最佳实践 · Prompt Engineering · Extend Claude Code |
🔥 Hot
| Feature | Location | Description |
|---|---|---|
| Power-ups | /powerup | 通过动画 demo 教学 Claude Code 功能的交互式课程(v2.1.90) |
| Ultraplan | /ultraplan | 在云端起草计划,可在浏览器中审阅、行内评论并灵活执行,可远程运行,也可“传送”回终端 |
| Claude Code Web | claude.ai/code | 在云基础设施上运行任务,适合长任务、PR 自动修复和无需本地搭建的并行会话 · Routines |
| Agent SDK | npm / pip package | 以 Claude Code 作为库来构建生产级 AI agent,提供 Python 与 TypeScript SDK,并内置 tools、hooks、subagents 和 MCP · Quickstart · Examples |
| No Flicker Mode | CLAUDE_CODE_NO_FLICKER=1 | 无闪烁 alt-screen 渲染,支持鼠标、稳定记忆和应用内滚动,属于可选研究预览 |
| Computer Use | computer-use MCP server | 让 Claude 控制你的屏幕,在 macOS 上打开应用、点击、输入并截图 · Desktop |
| Auto Mode | claude --enable-auto-mode | 后台安全分类器替代手动权限提示,Claude 自行判断什么是安全的,同时拦截 prompt injection 和高风险升级;可用 claude --enable-auto-mode(或 --permission-mode auto)启动,也可在会话中用 Shift+Tab 切换 · Blog |
| Channels | --channels, plugin-based | 把 Telegram、Discord 或 webhook 事件推入运行中的会话,让 Claude 在你离开时也能响应 · Reference |
| Slack | @Claude in Slack | 在团队聊天中 @Claude 提交编码任务,会被路由到 Claude Code web 会话执行 bug 修复、code review 和并行任务 |
| Code Review | GitHub App (managed) | 多 agent PR 分析,可在合并前捕捉 bug、安全问题和回归 · Blog |
| GitHub Actions | .github/workflows/ | 在 CI/CD 里自动化 PR 审查、issue 分流和代码生成 · GitLab CI/CD |
| Chrome | --chrome, extension | 通过 Claude in Chrome 做浏览器自动化,可测试 web app、读取 console 调试、自动填表和抓取页面数据 |
| Scheduled Tasks | /loop, /schedule, cron tools | /loop 在本地按周期运行 prompt(最长 7 天);/schedule 在 Anthropic 云基础设施上运行 prompt,即便机器关机也能继续 · Announcement |
| Routines | claude.ai/code/routines, /schedule | 运行在 Anthropic 基础设施上的云自动化,可按计划、API 触发或 GitHub 事件驱动,即便机器关闭也能运行 · Desktop Tasks |
| Devcontainers | .devcontainer/ | 带安全隔离和防火墙规则的预配置开发容器,用于提供一致的 Claude Code 运行环境 |
| Voice Dictation | /voice | 按住说话输入 prompt,支持 20 种语言和可重绑定激活键 |
| Simplify & Batch | /simplify, /batch | 内置 skills,用于代码质量和批量操作;simplify 负责重构复用与效率,batch 负责跨文件批跑命令 |
| Agent Teams | built-in (env var) | 多个 agent 在同一代码库上并行协作,并共享任务协调机制 |
| Remote Control | /remote-control, /rc | 从任何设备继续本地会话,包括手机、平板和浏览器 · Headless Mode |
| Git Worktrees | built-in | 用隔离 git 分支支持并行开发,让每个 agent 拥有自己的工作副本 |
| Ralph Wiggum Loop | plugin | 面向长任务的自主开发循环,会持续迭代直到完成 |
参见 orchestration-workflow 了解 Command → Agent → Skill 模式的实现细节。
claude
/weather-orchestrator⚙️ DEVELOPMENT WORKFLOWS
所有主要工作流最终都收敛到同一个架构模式:Research → Plan → Execute → Review → Ship
| Name | ★ | Uniqueness | Plan | |||
|---|---|---|---|---|---|---|
| Everything Claude Code | 156k | planner | 48 | 143 | 230 | |
| Superpowers | 152k | writing-plans | 5 | 3 | 14 | |
| Spec Kit | 88k | speckit.plan | 0 | 9+ | 0 | |
| gstack | 72k | autoplan | 0 | 0 | 36 | |
| Get Shit Done | 53k | gsd-planner | 31 | 122 | 0 | |
| BMAD-METHOD | 45k | bmad-create-prd | 0 | 0 | 37 | |
| OpenSpec | 40k | opsx:propose | 0 | 10 | 0 | |
| oh-my-claudecode | 29k | ralplan | 19 | 0 | 37 | |
| Compound Engineering | 14k | ce-plan | 49 | 4 | 42 | |
| HumanLayer | 10k | create_plan | 6 | 27 | 0 |
Others
- Cross-Model (Claude Code + Codex) Workflow
- RPI
- Ralph Wiggum Loop
- Andrej Karpathy (Founding Member, OpenAI) Workflow
- Peter Steinberger (Creator of OpenClaw) Workflow
- Boris Cherny(Claude Code 创造者)工作流 — 13 Tips · 10 Tips · 12 Tips · 2 Tips · 15 Tips
💡 TIPS AND TRICKS (69)
🚫👶 = 不要 babysit
Prompting · Planning · CLAUDE.md · Agents · Commands · Skills · Hooks · Workflows · Advanced · Git / PR · Debugging · Utilities · Daily
■ Prompting (3)
| Tip | Source |
|---|---|
挑战 Claude:“狠狠质询我这次改动,在我通过你的测试前不要发 PR。”或者“向我证明这真的能工作”,并让 Claude 比较 main 和你的分支的 diff 🚫👶 | |
| 修了个平庸的方案之后,可以说:“基于你现在知道的一切,把这个废掉,重新实现那个优雅的方案。” 🚫👶 | |
| Claude 大多数 bug 都能自己修,把 bug 贴给它,说一句“fix”,不要 micromanage 它怎么做 🚫👶 |
■ Planning/Specs (6)
| Tip | Source |
|---|---|
| 总是先用 plan mode 开始 | |
| 从一个最小 spec 或 prompt 开始,让 Claude 用 AskUserQuestion 工具反向采访你,然后开一个新会话去执行这个 spec | |
| 总是先做按阶段 gated 的计划,每个阶段都配多个测试(unit、automation、integration) | |
| 启动第二个 Claude 以 staff engineer 身份审查你的计划,或者用 cross-model 做审查 | |
| 在交接工作前写清详细 specs、减少歧义;你越具体,输出越好 | |
| prototype > PRD,与其写 specs 不如先做 20-30 个版本;构建成本很低,所以要多打几枪 |
■ CLAUDE.md (7)
| Tip | Source |
|---|---|
| CLAUDE.md 每个文件最好控制在 200 行以内。humanlayer 用 60 行,但依然不是 100% 保证 | |
用 <important if="..."> tags 包住领域专属的 CLAUDE.md 规则,防止文件一长 Claude 就忽略它们 | |
| monorepo 用 多个 CLAUDE.md —— 祖先目录 + 子目录联动加载 | |
| 用 .claude/rules/ 拆分过大的指令 | |
memory.md 才是关键,constitution.md 不保证任何事情 | |
| 任意开发者都应该能启动 Claude,说一句“run the tests”就第一次成功;如果做不到,说明你的 CLAUDE.md 缺了必要的 setup/build/test 命令 | |
| 保持代码库整洁并及时完成迁移;迁了一半的框架会让模型误选错误模式 | |
用 settings.json 做 harness 级强约束行为(署名、权限、模型);不要把“NEVER add Co-Authored-By”写进 CLAUDE.md,因为 attribution.commit: "" 更确定 |
Agents (4)
| Tip | Source |
|---|---|
| 用面向具体 feature 的 sub-agents(额外上下文)配 skills(渐进式披露),而不是泛化的 QA、backend engineer | |
| 直接说“use subagents”来给问题砸更多算力,把任务卸载出去,保持主上下文干净聚焦 🚫👶 | |
| 用 agent teams with tmux 和 git worktrees 做并行开发 | |
| 用 test time compute —— 分离上下文窗口会让结果更好;一个 agent 可能引入 bug,另一个(同模型)能把它找出来 |
Commands (3)
| Tip | Source |
|---|---|
| 用 commands 来承载你的工作流,而不是 sub-agents | |
对每天都要反复做的“inner loop”工作流,全部做成 slash commands;这能省掉重复提示词,commands 放在 .claude/commands/ 里并随 git 管理 | |
一件事如果你一天会做不止一次,就把它变成 skill 或 command —— 比如 /techdebt、context-dump 或 analytics commands |
Skills (9)
| Tip | Source |
|---|---|
用 context: fork 在隔离 subagent 中运行 skill,主上下文只看到最终结果,不看到中间 tool calls;agent 字段可指定 subagent 类型 | |
| monorepo 用 skills in subfolders | |
skill 是文件夹,不是单文件;请使用 references/、scripts/、examples/ 等子目录做 progressive disclosure | |
| 每个 skill 都要有 Gotchas 小节,这是最高信号密度的内容,用来累计 Claude 的失败模式 | |
skill 的 description 字段是触发器,不是摘要,写给模型看,回答“什么时候该触发我?” | |
| skill 里不要写显而易见的话,要专注于把 Claude 从默认行为里推出来的东西 🚫👶 | |
| 不要在 skill 里把 Claude 轨道化到死,给它目标和约束,不要给死板步骤 🚫👶 | |
| 在 skill 里包含 scripts 和 libraries,让 Claude 去组合,而不是重建样板代码 | |
在 SKILL.md 中嵌入 !`command`,把动态 shell 输出注入 prompt;Claude 会在调用时执行它,而模型只看到结果 |
■ Hooks (5)
| Tip | Source |
|---|---|
在 skills 里用 on-demand hooks;/careful 阻止危险命令,/freeze 阻止越界编辑 | |
| 用 PreToolUse hook measure skill usage,找出哪些 skills 热门或触发不足 | |
| 用 PostToolUse hook 自动格式化代码;Claude 负责产出好代码,hook 补最后 10%,避免 CI 失败 | |
| 把 permission requests 路由给 Opus 处理,让它扫描攻击并自动批准安全请求 🚫👶 | |
| 用 Stop hook 在回合末推动 Claude 继续做完或验证自己的工作 |
■ Workflows (7)
| Tip | Source |
|---|---|
| 避开 agent dumb zone,在 50% 上下文前手动做 /compact;如果中途切换新任务,用 /clear 重置上下文 | |
| 对更小的任务,原生 vanilla cc 比各种工作流都更好 | |
| 用 /model 选模型和 reasoning,用 /context 看上下文使用量,用 /usage 查 plan 限额,用 /extra-usage 配 overflow billing,用 /config 管理设置;plan mode 用 Opus,写代码用 Sonnet,二者结合最好 | |
| 始终开启 thinking mode true(便于看到推理),并在 /config 里使用 Output Style 的 Explanatory(展示详细输出和 ★ Insight 框)以更好理解 Claude 的决策 | |
| 在 prompts 中使用 ultrathink 关键词触发 high effort reasoning | |
用 /rename 给重要会话命名(如 [TODO - refactor task]),并通过 /resume 之后恢复;同时运行多个 Claude 时,每个实例都要有标签 | |
| Claude 走偏时,用 Esc Esc 或 /rewind 回退,而不是尝试在同一上下文里硬修 |
■ Workflows Advanced (6)
| Tip | Source |
|---|---|
| 大量使用 ASCII 图来理解你的架构 | |
| 用 /loop 做本地周期监控(最长 3 天);用 /schedule 做云端周期任务,即便机器关闭也会运行 | |
| 用 Ralph Wiggum plugin 承接长时间自治任务 | |
用带通配符语法的 /permissions(如 Bash(npm run *), Edit(/docs/**)),不要用 dangerously-skip-permissions | |
| 用 /sandbox 通过文件和网络隔离减少权限提示,内部统计可降低 84% | |
值得花一周时间打磨 product verification skills(如 signup-flow-driver、checkout-verifier) |
■ Git / PR (5)
| Tip | Source |
|---|---|
| 保持 PR 小而聚焦 —— p50 为 118 行(一天 141 个 PR、45K 行变更),一项功能一个 PR,更容易 review 和回滚 | |
始终 squash merge PR,保持线性整洁历史,一个功能一个提交,方便 git revert 和 git bisect | |
| 经常提交,最好至少每小时一次,任务一完成就 commit | |
| 在同事 PR 上 @@claude,让它为重复 review 反馈自动生成 lint 规则,把自己从 code review 里自动化掉 🚫👶 | |
| 用 /code-review 做多 agent PR 分析,在合并前抓出 bug、安全问题和回归 |
■ Debugging (7)
| Tip | Source |
|---|---|
| 养成习惯:一旦卡住,就截图给 Claude 看 | |
| 用 mcp(Claude in Chrome、Playwright、Chrome DevTools)让 Claude 自己看到 Chrome console 日志 | |
| 调试时总是让 Claude 把你想看的终端作为后台任务运行起来,这样更容易排查 | |
| 用 /doctor 诊断安装、认证和配置问题 | |
| compact 时出错,可以先用 /model 切到 1M token 模型,再执行 /compact | |
| 用 cross-model 做 QA,比如用 Codex 来审查计划和实现 | |
| agentic search(glob + grep)优于 RAG;Claude Code 曾尝试过向量数据库又放弃了,因为代码会漂移失同步,而且权限太复杂 |
■ Utilities (5)
| Tip | Source |
|---|---|
| 优先使用 iTerm / Ghostty / tmux 这类终端,而不是 IDE(VS Code / Cursor) | |
| 用 /voice 或 Wispr Flow 做语音提示(10 倍生产力) | |
| 用 claude-code-hooks 处理 Claude 反馈 | |
| 用 status line 提升上下文感知和快速 compact | |
| 深挖 settings.json 的特性,例如 Plans Directory、Spinner Verbs,打造个性化体验 |
■ Daily (2)
| Tip | Source |
|---|---|
| 每天都要 update Claude Code | |
| 每天开始工作前先读 changelog |
🎬 VIDEOS / PODCASTS
| Video / Podcast | Source | YouTube |
|---|---|---|
| Everything We Got Wrong About Research-Plan-Implement (Dex) | 24 Mar 2026 | MLOps Community | YouTube | |
| Building Claude Code with Boris Cherny (Boris) | 04 Mar 2026 | The Pragmatic Engineer | YouTube | |
| Head of Claude Code: What happens after coding is solved (Boris) | 19 Feb 2026 | Lenny's Podcast | YouTube | |
| Inside Claude Code With Its Creator Boris Cherny (Boris) | 17 Feb 2026 | Y Combinator | YouTube | |
| Boris Cherny (Creator of Claude Code) On What Grew His Career (Boris) | 15 Dec 2025 | Ryan Peterman | YouTube | |
| The Secrets of Claude Code From the Engineers Who Built It (Cat) | 29 Oct 2025 | Every | YouTube |
🔔 SUBSCRIBE
☠️ STARTUPS / BUSINESSES
如果你有答案,请通过 shanraisshan@gmail.com 告诉我
Memory & Instructions (4)
- 你的
CLAUDE.md里究竟该放什么,不该放什么? - 如果你已经有了
CLAUDE.md,还需要单独的constitution.md或rules.md吗? - 你应该多久更新一次
CLAUDE.md?又该如何判断它已经 stale? - 为什么 Claude 还是会忽略
CLAUDE.md里的指令,即使里面用全大写写了 MUST?(reddit)
Agents, Skills & Workflows (6)
- 什么时候该用 command,什么时候该用 agent,什么时候该用 skill?以及什么时候原生 Claude Code 反而更好?
- 随着模型进步,你应该多频繁更新 agents、commands 和 workflows?
- 给 subagent 一个详细 persona 会提升质量吗?研究型 / QA 型 subagent 的“完美 persona/prompt”长什么样?
- 你应该依赖 Claude Code 内置的 plan mode,还是自己构建一个强制团队流程的 planning command/agent?
- 如果你有个人 skill(例如带你编码风格的
/implement),又想引入社区 skill(例如/simplify),该如何避免冲突?意见不一致时该听谁的? - 我们到那一步了吗?能不能把现有代码库转成 specs、删掉代码,再只靠 specs 让 AI 重新生成完全一样的代码?
Specs & Documentation (3)
- 你的仓库里每个 feature 都应该有一个 markdown spec 吗?
- 新 feature 实现之后,你需要多频繁更新 specs,才能不让它们过时?
- 实现一个新 feature 时,如何处理它对其他 feature specs 产生的连锁影响?
REPORTS
1. 像读课程一样读这个仓库,先理解 commands、agents、skills 和 hooks 是什么,再尝试真正使用它们。
2. clone 这个仓库并玩一遍示例,试试 /weather-orchestrator,听听 hook 音效,跑一下 agent teams,这样你才能看到它们究竟怎么工作。
3. 回到你自己的项目里,让 Claude 建议你应该从这个仓库吸收哪些 best practices,并把这个仓库作为参考给它,让它知道哪些事情是可能的。Other Repos
claude-code-hooks · codex-cli-best-practice ·
codex-cli-hooks
Developed by
# Workflow Description 1 /workflows:development-workflows 通过并行研究全部 10 个 workflow 仓库,更新 DEVELOPMENT WORKFLOWS 表和跨工作流分析报告 2 /workflows:best-practice:workflow-concepts 用最新 Claude Code 功能与概念更新 README 的 CONCEPTS 小节 3 /workflows:best-practice:workflow-claude-settings 跟踪 Claude Code settings 报告的变化并找出需要更新的地方 4 /workflows:best-practice:workflow-claude-subagents 跟踪 Claude Code subagents 报告的变化并找出需要更新的地方 5 /workflows:best-practice:workflow-claude-commands 跟踪 Claude Code commands 报告的变化并找出需要更新的地方 6 /workflows:best-practice:workflow-claude-skills 跟踪 Claude Code skills 报告的变化并找出需要更新的地方
Star History
stars and counting
Sponsor My Work
如果你喜欢我的工作,可以请我喝一杯 doodh patti 🍵:

