pro-workflow
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePro Workflow
专业工作流
Real-world Claude Code patterns from power users who ship production code daily. Not theory - workflows that compound over time.
来自每天交付生产代码的资深用户的真实Claude Code模式。绝非理论——这些工作流会随时间不断优化。
The Core Insight
核心洞察
"80% of my code is written by AI, 20% is spent reviewing and correcting it." — Karpathy
This skill optimizes for that ratio. Every pattern here reduces correction cycles.
"我80%的代码由AI编写,20%的时间用于审查和修正。" ——卡帕西
本技能正是为优化这一比例而设计。这里的每一种模式都能减少修正周期。
1. The Self-Correction Loop
1. 自修正循环
The single most powerful pattern. Your CLAUDE.md trains itself through corrections.
最强大的单一模式。你的CLAUDE.md会通过修正实现自我训练。
How It Works
工作原理
When you correct Claude:
- Claude acknowledges the mistake
- Proposes a rule to prevent it
- You approve → rule goes into memory
- Future sessions avoid the same mistake
当你修正Claude时:
- Claude会明确承认错误
- 提出一条避免再犯的规则
- 你批准后,规则将存入记忆
- 后续会话中会避免相同错误
Add to CLAUDE.md
添加至CLAUDE.md
markdown
undefinedmarkdown
undefinedSelf-Correction Protocol
Self-Correction Protocol
When the user corrects me or I make a mistake:
- Acknowledge specifically what went wrong
- Propose a concise rule:
[LEARN] Category: One-line rule - Wait for approval before adding to LEARNED section
When the user corrects me or I make a mistake:
- Acknowledge specifically what went wrong
- Propose a concise rule:
[LEARN] Category: One-line rule - Wait for approval before adding to LEARNED section
LEARNED
LEARNED
<!-- Auto-populated through corrections -->
undefined<!-- Auto-populated through corrections -->
undefinedTrigger Phrases
触发短语
- "Add that to your rules"
- "Remember this"
- "Don't do that again"
- "Add that to your rules"
- "Remember this"
- "Don't do that again"
Example Flow
示例流程
User: You edited the wrong file
Claude: I edited src/utils.ts when you meant src/lib/utils.ts.
[LEARN] Navigation: Confirm full path before editing files with common names.
Should I add this?User: You edited the wrong file
Claude: I edited src/utils.ts when you meant src/lib/utils.ts.
[LEARN] Navigation: Confirm full path before editing files with common names.
Should I add this?2. Parallel Sessions with Worktrees
2. 基于工作树的并行会话
Zero dead time. While one Claude thinks, work on something else.
零等待时间。当一个Claude在思考时,你可以处理其他任务。
Setup
设置步骤
bash
undefinedbash
undefinedCreate worktrees for parallel work
创建用于并行工作的工作树
git worktree add ../project-feat feature-branch
git worktree add ../project-fix bugfix-branch
git worktree add ../project-feat feature-branch
git worktree add ../project-fix bugfix-branch
Each gets its own Claude session
每个工作树对应独立的Claude会话
Terminal 1: cd ~/project && claude
终端1: cd ~/project && claude
Terminal 2: cd ~/project-feat && claude
终端2: cd ~/project-feat && claude
undefinedundefinedWhen to Parallelize
适用并行场景
| Scenario | Action |
|---|---|
| Waiting on tests | Start new feature in worktree |
| Long build | Debug issue in parallel |
| Exploring approaches | Try 2-3 simultaneously |
| 场景 | 操作 |
|---|---|
| 等待测试结果 | 在工作树中启动新功能开发 |
| 构建耗时较长 | 并行调试问题 |
| 探索多种方案 | 同时尝试2-3种思路 |
Add to CLAUDE.md
添加至CLAUDE.md
markdown
undefinedmarkdown
undefinedParallel Work
Parallel Work
When blocked on long operations, suggest starting a parallel session in a worktree.
---When blocked on long operations, suggest starting a parallel session in a worktree.
---3. The Wrap-Up Ritual
3. 收尾流程
End sessions with intention. Capture learnings, verify state.
有目的地结束会话。捕获经验,验证状态。
/wrap-up Checklist
/wrap-up 检查清单
- Changes Audit - List modified files, uncommitted changes
- State Check - Run , tests, lint
git status - Learning Capture - What mistakes? What worked?
- Next Session - What's next? Any blockers?
- Summary - One paragraph of what was accomplished
- 变更审计 - 列出修改的文件、未提交的变更
- 状态检查 - 运行、测试、代码检查
git status - 经验捕获 - 犯了哪些错误?哪些方法有效?
- 下一会话规划 - 接下来要做什么?有哪些障碍?
- 总结 - 用一段话概括完成的工作
Create Command
创建命令
~/.claude/commands/wrap-up.mdmarkdown
Execute wrap-up checklist:
1. `git status` - uncommitted changes?
2. `npm test -- --changed` - tests passing?
3. What was learned this session?
4. Propose LEARNED additions
5. One-paragraph summary~/.claude/commands/wrap-up.mdmarkdown
Execute wrap-up checklist:
1. `git status` - uncommitted changes?
2. `npm test -- --changed` - tests passing?
3. What was learned this session?
4. Propose LEARNED additions
5. One-paragraph summary4. Split Memory Architecture
4. 拆分式记忆架构
For complex projects, modularize Claude memory.
针对复杂项目,模块化Claude的记忆。
Structure
结构
.claude/
├── CLAUDE.md # Entry point
├── AGENTS.md # Workflow rules
├── SOUL.md # Style preferences
└── LEARNED.md # Auto-populated.claude/
├── CLAUDE.md # 入口文件
├── AGENTS.md # 工作流规则
├── SOUL.md # 风格偏好
└── LEARNED.md # 自动填充AGENTS.md
AGENTS.md
markdown
undefinedmarkdown
undefinedWorkflow Rules
Workflow Rules
Planning
Planning
Plan mode when: >3 files, architecture decisions, multiple approaches.
Plan mode when: >3 files, architecture decisions, multiple approaches.
Quality Gates
Quality Gates
Before complete: lint, typecheck, test --related.
Before complete: lint, typecheck, test --related.
Subagents
Subagents
Use for: parallel exploration, background tasks.
Avoid for: tasks needing conversation context.
undefinedUse for: parallel exploration, background tasks.
Avoid for: tasks needing conversation context.
undefinedSOUL.md
SOUL.md
markdown
undefinedmarkdown
undefinedStyle
Style
- Concise over verbose
- Action over explanation
- Acknowledge mistakes directly
- No features beyond scope
---- Concise over verbose
- Action over explanation
- Acknowledge mistakes directly
- No features beyond scope
---5. The 80/20 Review Pattern
5. 80/20审查模式
Batch reviews at checkpoints, not every change.
在检查点批量审查,而非每次变更都审查。
Review Points
审查节点
- After plan approval
- After each milestone
- Before destructive operations
- At /wrap-up
- 计划批准后
- 每个里程碑完成后
- 执行破坏性操作前
- /wrap-up阶段
Add to CLAUDE.md
添加至CLAUDE.md
markdown
undefinedmarkdown
undefinedReview Checkpoints
Review Checkpoints
Pause for review at: plan completion, >5 file edits, git operations, auth/security code.
Between: proceed with confidence.
---Pause for review at: plan completion, >5 file edits, git operations, auth/security code.
Between: proceed with confidence.
---6. Model Selection
6. 模型选择
Opus 4.6 with adaptive thinking calibrates reasoning depth automatically.
| Task | Model |
|---|---|
| Quick fixes | Haiku 4.5 |
| Features | Sonnet 4.5 |
| Refactors | Opus 4.6 |
| Architecture | Opus 4.6 + Extended Thinking |
| Hard bugs | Opus 4.6 + Extended Thinking |
Opus 4.6 自适应思考可根据任务自动调整推理深度。
| 任务 | 模型 |
|---|---|
| 快速修复 | Haiku 4.5 |
| 功能开发 | Sonnet 4.5 |
| 代码重构 | Opus 4.6 |
| 架构设计 | Opus 4.6 + 扩展思考 |
| 疑难bug排查 | Opus 4.6 + 扩展思考 |
Adaptive Thinking
自适应思考
Opus 4.6 automatically calibrates reasoning depth per task - lightweight for simple operations, deep analysis for complex problems. No configuration needed.
Opus 4.6会根据任务自动调整推理深度——简单操作使用轻量模式,复杂问题使用深度分析。无需额外配置。
Add to CLAUDE.md
添加至CLAUDE.md
markdown
undefinedmarkdown
undefinedModel Hints
Model Hints
Escalate to Opus+Thinking when: first attempt failed, multi-system coordination, non-obvious bugs.
Use subagents with Haiku for fast read-only exploration, Sonnet for balanced work.
---Escalate to Opus+Thinking when: first attempt failed, multi-system coordination, non-obvious bugs.
Use subagents with Haiku for fast read-only exploration, Sonnet for balanced work.
---7. Context Discipline
7. 上下文管理规范
200k tokens is precious. Manage it.
20万token十分宝贵,需合理管理。
Rules
规则
- Read before edit
- Compact at task boundaries
- Disable unused MCPs (<10 enabled, <80 tools)
- Summarize explorations
- Use subagents to isolate high-volume output (tests, logs, docs)
- 先阅读再编辑
- 在任务边界处压缩上下文
- 禁用未使用的MCP(启用数量<10,工具总数<80)
- 总结探索过程
- 使用子代理隔离高容量输出(测试、日志、文档)
Context Compaction
上下文压缩
- Auto-compacts at ~95% capacity (keeps long-running agents alive)
- Configure earlier compaction:
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=50 - Use PreCompact hooks to save state before compaction
- Subagents auto-compact independently from the main session
- 当容量达到~95%时自动压缩(保持长期运行的代理存活)
- 可配置更早的压缩阈值:
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=50 - 使用PreCompact钩子在压缩前保存状态
- 子代理独立于主会话自动压缩
Good Compact Points
合适的压缩节点
- After planning, before execution
- After completing a feature
- When context >70%
- Before switching task domains
- 规划完成后,执行前
- 功能开发完成后
- 上下文占用>70%
- 切换任务领域前
8. Learning Log
8. 学习日志
Auto-document insights from sessions.
自动记录会话中的洞察。
Add to CLAUDE.md
添加至CLAUDE.md
markdown
undefinedmarkdown
undefinedLearning Log
Learning Log
After tasks, note learnings:
[DATE] [TOPIC]: Key insightAppend to .claude/learning-log.md
---After tasks, note learnings:
[DATE] [TOPIC]: Key insightAppend to .claude/learning-log.md
---Learn Claude Code
学习Claude Code
Master Claude Code through built-in best practices and official documentation.
Pro-workflow teaches Claude Code concepts directly and links to official docs at https://code.claude.com/docs/ for deep dives.
通过内置最佳实践和官方文档掌握Claude Code。
专业工作流直接教授Claude Code概念,并链接至官方文档**https://code.claude.com/docs/**供深入学习。
What You'll Learn
你将学到
| Topic | Pro-Workflow Pattern | Official Docs |
|---|---|---|
| Sessions & context management | Pattern 7: Context Discipline | Common Workflows |
| Modes (Plan/Normal/Auto/Delegate) | Pattern 5: 80/20 Review | Common Workflows |
| CLAUDE.md & project memory | Pattern 4: Split Memory | Settings |
| Writing rules & constraints | Pattern 1: Self-Correction Loop | Settings |
| Effective prompting | Pattern 5: 80/20 Review | — |
| Skills & automation | Pattern 8: Learning Log | Settings |
| Custom subagents | Pattern 2: Parallel Worktrees | Sub-agents |
| Agent teams | Pattern 2: Parallel Worktrees | Agent Teams |
| Hooks & quality gates | All hooks in hooks.json | Hooks |
| Context compaction | Pattern 7: Context Discipline | Common Workflows |
| Adaptive thinking | Pattern 6: Model Selection | — |
| Security & permissions | — | Security |
| MCP configuration | Pattern 7: Context Discipline | MCP |
| 主题 | 专业工作流模式 | 官方文档 |
|---|---|---|
| 会话与上下文管理 | 模式7: 上下文管理规范 | 通用工作流 |
| 模式(计划/常规/自动/委托) | 模式5: 80/20审查 | 通用工作流 |
| CLAUDE.md与项目记忆 | 模式4: 拆分式记忆 | 设置 |
| 编写规则与约束 | 模式1: 自修正循环 | 设置 |
| 高效提示 | 模式5: 80/20审查 | — |
| 技能与自动化 | 模式8: 学习日志 | 设置 |
| 自定义子代理 | 模式2: 并行工作树 | 子代理 |
| 代理团队 | 模式2: 并行工作树 | 代理团队 |
| 钩子与质量门 | hooks.json中的所有钩子 | 钩子 |
| 上下文压缩 | 模式7: 上下文管理规范 | 通用工作流 |
| 自适应思考 | 模式6: 模型选择 | — |
| 安全与权限 | — | 安全 |
| MCP配置 | 模式7: 上下文管理规范 | MCP |
Learning Path
学习路径
- Start — CLI shortcuts, context management, modes
- Build — CLAUDE.md, writing rules, prompting, skills
- Scale — Custom subagents, agent teams, hooks, MCP, GitHub Actions
- Optimize — Pro-Workflow patterns 1-8, adaptive thinking, context compaction
- Reference — Official docs for deep dives on any topic
- 入门 — CLI快捷方式、上下文管理、模式
- 构建 — CLAUDE.md、编写规则、提示技巧、技能
- 规模化 — 自定义子代理、代理团队、钩子、MCP、GitHub Actions
- 优化 — 专业工作流模式1-8、自适应思考、上下文压缩
- 参考 — 官方文档深入学习任意主题
Use /learn
使用/learn
Run for a topic-by-topic guide with practices and official doc links.
/learn运行获取按主题分类的指南,包含实践方法和官方文档链接。
/learnQuick Setup
快速设置
Minimal
极简配置
Add to your CLAUDE.md:
markdown
undefined添加至你的CLAUDE.md:
markdown
undefinedPro Workflow
Pro Workflow
Self-Correction
Self-Correction
When corrected, propose rule → add to LEARNED after approval.
When corrected, propose rule → add to LEARNED after approval.
Planning
Planning
Multi-file: plan first, wait for "proceed".
Multi-file: plan first, wait for "proceed".
Quality
Quality
After edits: lint, typecheck, test.
After edits: lint, typecheck, test.
LEARNED
LEARNED
undefinedundefinedFull Setup
完整配置
bash
git clone https://github.com/rohitg00/pro-workflow.git /tmp/pw
cp -r /tmp/pw/templates/split-claude-md/* ./.claude/
cp -r /tmp/pw/commands/* ~/.claude/commands/bash
git clone https://github.com/rohitg00/pro-workflow.git /tmp/pw
cp -r /tmp/pw/templates/split-claude-md/* ./.claude/
cp -r /tmp/pw/commands/* ~/.claude/commands/Hooks
钩子
Pro-workflow includes automated hooks to enforce the patterns.
专业工作流包含自动化钩子以强制执行这些模式。
PreToolUse Hooks
PreToolUse钩子
| Trigger | Action |
|---|---|
| Edit/Write | Track edit count, remind at 5/10 edits |
| git commit | Remind to run quality gates |
| git push | Remind about /wrap-up |
| 触发条件 | 操作 |
|---|---|
| 编辑/写入 | 跟踪编辑次数,在5/10次编辑时提醒 |
| git commit | 提醒运行质量门检查 |
| git push | 提醒执行/wrap-up |
PostToolUse Hooks
PostToolUse钩子
| Trigger | Action |
|---|---|
| Code edit (.ts/.js/.py/.go) | Check for console.log, TODOs, secrets |
| Test commands | Suggest [LEARN] from failures |
| 触发条件 | 操作 |
|---|---|
| 代码编辑(.ts/.js/.py/.go) | 检查是否存在console.log、TODO、敏感信息 |
| 测试命令 | 从失败中建议添加[LEARN]规则 |
Session Hooks
会话钩子
| Hook | Action |
|---|---|
| SessionStart | Load LEARNED patterns, show worktree count |
| Stop | Periodic wrap-up/compact reminders |
| SessionEnd | Check uncommitted changes, prompt for learnings |
| 钩子 | 操作 |
|---|---|
| SessionStart | 加载已学习的模式,显示工作树数量 |
| Stop | 定期提醒收尾/压缩 |
| SessionEnd | 检查未提交变更,提示记录经验 |
Install Hooks
安装钩子
bash
undefinedbash
undefinedCopy hooks to your settings
复制钩子至你的设置
cp ~/skills/pro-workflow/hooks/hooks.json ~/.claude/settings.local.json
cp ~/skills/pro-workflow/hooks/hooks.json ~/.claude/settings.local.json
Or merge with existing settings
或与现有设置合并
undefinedundefinedHook Philosophy
钩子设计理念
Based on Twitter thread insights:
- Non-blocking - Hooks remind, don't block (except dangerous ops)
- Checkpoint-based - Quality gates at intervals, not every edit
- Learning-focused - Always prompt for pattern capture
基于Twitter线程的洞察:
- 非阻塞 - 钩子仅提醒,不阻塞操作(危险操作除外)
- 基于检查点 - 按间隔设置质量门,而非每次编辑都检查
- 聚焦学习 - 始终提示捕获模式
Contexts
上下文模式
Switch modes based on what you're doing.
| Context | Trigger | Behavior |
|---|---|---|
| dev | "Let's build" | Code first, iterate fast |
| review | "Review this" | Read-only, security focus |
| research | "Help me understand" | Explore, summarize, plan |
Use: "Switch to dev mode" or load context file.
根据当前工作切换模式。
| 上下文 | 触发词 | 行为 |
|---|---|---|
| 开发 | "Let's build" | 优先编码,快速迭代 |
| 审查 | "Review this" | 只读模式,聚焦安全 |
| 研究 | "Help me understand" | 探索、总结、规划 |
使用方式: "Switch to dev mode" 或加载上下文文件。
Agents
代理
Specialized subagents for focused tasks.
| Agent | Purpose | Tools |
|---|---|---|
| planner | Break down complex tasks | Read-only |
| reviewer | Code review, security audit | Read + test |
用于专注任务的专用子代理。
| 代理 | 用途 | 工具 |
|---|---|---|
| 规划师 | 拆分复杂任务 | 只读 |
| 审查者 | 代码审查、安全审计 | 只读+测试 |
When to Delegate
何时委托
Use planner agent when:
- Task touches >5 files
- Architecture decision needed
- Requirements unclear
Use reviewer agent when:
- Before committing
- PR reviews
- Security concerns
在以下场景使用规划师代理:
- 任务涉及>5个文件
- 需要做架构决策
- 需求不明确
在以下场景使用审查者代理:
- 提交前
- PR审查
- 安全相关问题
Custom Subagents
自定义子代理
Create project-specific subagents in or user-wide in :
.claude/agents/~/.claude/agents/- Define with YAML frontmatter + markdown system prompt
- Control tools, model, permission mode, hooks, and persistent memory
- Use to create, edit, and manage interactively
/agents - Preload skills into subagents for domain knowledge
在中创建项目专属子代理,或在中创建全局子代理:
.claude/agents/~/.claude/agents/- 使用YAML前置元数据+Markdown系统提示定义
- 控制工具、模型、权限模式、钩子和持久化记忆
- 使用交互式创建、编辑和管理
/agents - 预加载技能以获取领域知识
Agent Teams (Experimental)
代理团队(实验性)
Coordinate multiple Claude Code sessions as a team:
- Enable:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - Lead session coordinates, teammates work independently
- Teammates message each other directly (not just report back)
- Shared task list with dependency management
- Display: in-process (Shift+Up/Down) or split panes (tmux/iTerm2)
- Delegate mode (Shift+Tab): lead coordinates only, no code edits
- Best for: parallel reviews, competing hypotheses, cross-layer changes
- Docs: https://code.claude.com/docs/agent-teams
协调多个Claude Code会话组成团队:
- 启用:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 - 主会话负责协调,子会话独立工作
- 子会话可直接通信(不仅向主会话汇报)
- 共享任务列表,支持依赖管理
- 显示方式: 进程内(Shift+Up/Down)或分屏(tmux/iTerm2)
- 委托模式(Shift+Tab): 主会话仅协调,不编辑代码
- 最佳适用场景: 并行审查、竞争假设验证、跨层变更
- 文档: https://code.claude.com/docs/agent-teams
MCP Config
MCP配置
Keep <10 MCPs enabled, <80 tools total.
Essential:
- - PRs, issues
github - - Persist learnings
memory - - File ops
filesystem
See for setup.
mcp-config.example.json保持启用的MCP数量<10,工具总数<80。
必备MCP:
- - PR、议题
github - - 持久化经验
memory - - 文件操作
filesystem
查看获取设置示例。
mcp-config.example.jsonCommands
命令
| Command | Purpose |
|---|---|
| End-of-session ritual |
| Extract correction to memory |
| Worktree setup guide |
| Claude Code best practices & save learnings |
| Search learnings by keyword |
| List all stored learnings |
| Smart commit with quality gates and code review |
| Session analytics, learning patterns, correction trends |
| 命令 | 用途 |
|---|---|
| 会话收尾流程 |
| 将修正提取至记忆 |
| 工作树设置指南 |
| Claude Code最佳实践&保存经验 |
| 按关键词搜索经验 |
| 列出所有存储的经验 |
| 包含质量门和代码审查的智能提交 |
| 会话分析、学习模式、修正趋势 |
Philosophy
设计理念
- Compound improvements - Small corrections → big gains
- Trust but verify - Let AI work, review at checkpoints
- Zero dead time - Parallel sessions
- Memory is precious - Yours and Claude's
From Claude Code power users and real production use.
- 复利式改进 - 小修正带来大提升
- 信任但验证 - 让AI工作,在检查点审查
- 零等待时间 - 并行会话
- 记忆宝贵 - 你的和Claude的记忆都需珍惜
来自Claude Code资深用户和实际生产场景。