Claude Code Workflow
Workflow Orchestration
For recurring or self-iterating work (/goal, /loop, /schedule, proactive routines), pick the primitive with the designing-loops skill.
1. Plan Mode
- Use plan mode when the approach is open, the change is architectural, or a wrong direction would be costly to redo
- If the plan stops matching what you find, re-plan instead of patching forward
2. Subagent Strategy
- Use subagents liberally to keep main context window clean
- Offload research, exploration, and parallel analysis to subagents
- For complex problems, throw more compute at it via subagents
- One task per subagent for focused execution
3. Self-Improvement Loop
- When a user correction would apply to future sessions, save it to auto-memory as a rule with its reason
4. Verification Before Done
- Never mark a task complete without proving it works
- Diff behavior between main and your changes when relevant
- Ask yourself: "Would a staff engineer approve this?"
- Run tests, check logs, demonstrate correctness
- For high-risk changes (auth, data, infra): run
/codex:adversarial-review for cross-model review before shipping (see codex-review skill)
5. Demand Elegance (Balanced)
- For non-trivial changes, a fix that feels hacky isn't finished: replace it with the clean solution before presenting
- Skip this for simple, obvious fixes – don't over-engineer
- Challenge your own work before presenting it
6. Autonomous Bug Fixing
- When given a bug report: just fix it. Don't ask for hand-holding
- Point at logs, errors, failing tests – then resolve them
- Zero context switching required from the user
- Go fix failing CI tests without being told how
Context Management
Strategic Compaction
Don't rely on auto-compaction — it fires at arbitrary points. Use /compact deliberately at natural task boundaries.
When to compact:
- After exploration/research, before starting implementation
- After debugging a hard problem, before continuing feature work
- After completing a major subtask, before starting the next
- When context feels bloated with old search results or failed attempts
When NOT to compact:
- Mid-implementation — you'll lose the mental model of what you're building
- While debugging — you need the error context and what you've already tried
- Right after planning — the plan context is what drives implementation
Context Budget Awareness
Every loaded component costs tokens. Be deliberate about what's active.
- With many MCP tools enabled, Claude Code defers them: only tool names load until a schema is fetched through tool search
- Skill descriptions and agent-type descriptions ride in every request whether or not they are used
/usage breaks down spend by skills, subagents, and MCPs
- Quick estimate: prose =
words × 1.3 tokens, code = chars / 4 tokens
Hooks
Config Protection
Prevent Claude from weakening linter/formatter/type configs instead of fixing the actual code. Add to .claude/settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "bash -c 'PROTECTED=\".eslintrc .eslintrc.js .eslintrc.json eslint.config.js eslint.config.mjs .prettierrc .prettierrc.js prettier.config.js tsconfig.json biome.json\"; FILE=$(jq -r \".tool_input.file_path // empty\"); BASE=$(basename \"$FILE\" 2>/dev/null); for p in $PROTECTED; do if [ \"$BASE\" = \"$p\" ]; then echo \"BLOCKED: fix the code, not the config. do not weaken linter/formatter/type settings.\" >&2; exit 2; fi; done'"
}
]
}
]
}
}
Stop-Time Batch Processing
Instead of running prettier/tsc after every single edit, accumulate edited files and run format + typecheck once when Claude pauses. Add to .claude/settings.json:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{ "type": "command", "command": "jq -r '.tool_input.file_path // empty' >> /tmp/claude-edited-files.txt" }
]
}
],
"Stop": [
{
"hooks": [{ "type": "command", "command": "bash -c 'if [ -f /tmp/claude-edited-files.txt ]; then FILES=$(sort -u /tmp/claude-edited-files.txt | grep -E \"\\.(ts|tsx|js|jsx)$\"); if [ -n \"$FILES\" ]; then echo \"$FILES\" | xargs bunx prettier --write 2>/dev/null; echo \"$FILES\" | xargs bunx tsc --noEmit 2>&1 | head -20; fi; rm /tmp/claude-edited-files.txt; fi'" }]
}
]
}
}
Task Management
- For multi-step work, keep a checkable plan in
tasks/todo.md and mark items complete as you go
- Check in before implementing only when the plan changes scope or architecture, or would be costly to undo; bug reports go straight to a fix (see Autonomous Bug Fixing)
- Finish with what changed and how you verified it
- Save corrections as described in Self-Improvement Loop
Core Principles
- Simplicity First: Make every change as simple as possible. Impact minimal code.
- Root Causes: Fix the underlying cause, not the symptom; don't ship temporary fixes.
- Minimal Impact: Changes should only touch what's necessary.
1---2name: claude-workflow3description: Claude Code working patterns — plan mode, subagents, verification, context management, hooks4metadata:5 source: https://skillmd.com/skills/tommylower/claude-workflow6---78# Claude Code Workflow910## Workflow Orchestration1112For recurring or self-iterating work (`/goal`, `/loop`, `/schedule`, proactive routines), pick the primitive with the `designing-loops` skill.1314### 1. Plan Mode15- Use plan mode when the approach is open, the change is architectural, or a wrong direction would be costly to redo16- If the plan stops matching what you find, re-plan instead of patching forward1718### 2. Subagent Strategy19- Use subagents liberally to keep main context window clean20- Offload research, exploration, and parallel analysis to subagents21- For complex problems, throw more compute at it via subagents22- One task per subagent for focused execution2324### 3. Self-Improvement Loop25- When a user correction would apply to future sessions, save it to auto-memory as a rule with its reason2627### 4. Verification Before Done28- Never mark a task complete without proving it works29- Diff behavior between main and your changes when relevant30- Ask yourself: "Would a staff engineer approve this?"31- Run tests, check logs, demonstrate correctness32- For high-risk changes (auth, data, infra): run `/codex:adversarial-review` for cross-model review before shipping (see `codex-review` skill)3334### 5. Demand Elegance (Balanced)35- For non-trivial changes, a fix that feels hacky isn't finished: replace it with the clean solution before presenting36- Skip this for simple, obvious fixes – don't over-engineer37- Challenge your own work before presenting it3839### 6. Autonomous Bug Fixing40- When given a bug report: just fix it. Don't ask for hand-holding41- Point at logs, errors, failing tests – then resolve them42- Zero context switching required from the user43- Go fix failing CI tests without being told how4445## Context Management4647### Strategic Compaction4849Don't rely on auto-compaction — it fires at arbitrary points. Use `/compact` deliberately at natural task boundaries.5051**When to compact:**52- After exploration/research, before starting implementation53- After debugging a hard problem, before continuing feature work54- After completing a major subtask, before starting the next55- When context feels bloated with old search results or failed attempts5657**When NOT to compact:**58- Mid-implementation — you'll lose the mental model of what you're building59- While debugging — you need the error context and what you've already tried60- Right after planning — the plan context is what drives implementation6162### Context Budget Awareness6364Every loaded component costs tokens. Be deliberate about what's active.6566- With many MCP tools enabled, Claude Code defers them: only tool names load until a schema is fetched through tool search67- Skill descriptions and agent-type descriptions ride in every request whether or not they are used68- `/usage` breaks down spend by skills, subagents, and MCPs69- Quick estimate: prose = `words × 1.3` tokens, code = `chars / 4` tokens7071## Hooks7273### Config Protection7475Prevent Claude from weakening linter/formatter/type configs instead of fixing the actual code. Add to `.claude/settings.json`:7677```json78{79 "hooks": {80 "PreToolUse": [81 {82 "matcher": "Edit|Write",83 "hooks": [84 {85 "type": "command",86 "command": "bash -c 'PROTECTED=\".eslintrc .eslintrc.js .eslintrc.json eslint.config.js eslint.config.mjs .prettierrc .prettierrc.js prettier.config.js tsconfig.json biome.json\"; FILE=$(jq -r \".tool_input.file_path // empty\"); BASE=$(basename \"$FILE\" 2>/dev/null); for p in $PROTECTED; do if [ \"$BASE\" = \"$p\" ]; then echo \"BLOCKED: fix the code, not the config. do not weaken linter/formatter/type settings.\" >&2; exit 2; fi; done'"87 }88 ]89 }90 ]91 }92}93```9495### Stop-Time Batch Processing9697Instead of running prettier/tsc after every single edit, accumulate edited files and run format + typecheck once when Claude pauses. Add to `.claude/settings.json`:9899```json100{101 "hooks": {102 "PostToolUse": [103 {104 "matcher": "Edit|Write",105 "hooks": [106 { "type": "command", "command": "jq -r '.tool_input.file_path // empty' >> /tmp/claude-edited-files.txt" }107 ]108 }109 ],110 "Stop": [111 {112 "hooks": [{ "type": "command", "command": "bash -c 'if [ -f /tmp/claude-edited-files.txt ]; then FILES=$(sort -u /tmp/claude-edited-files.txt | grep -E \"\\.(ts|tsx|js|jsx)$\"); if [ -n \"$FILES\" ]; then echo \"$FILES\" | xargs bunx prettier --write 2>/dev/null; echo \"$FILES\" | xargs bunx tsc --noEmit 2>&1 | head -20; fi; rm /tmp/claude-edited-files.txt; fi'" }]113 }114 ]115 }116}117```118119## Task Management120121- For multi-step work, keep a checkable plan in `tasks/todo.md` and mark items complete as you go122- Check in before implementing only when the plan changes scope or architecture, or would be costly to undo; bug reports go straight to a fix (see Autonomous Bug Fixing)123- Finish with what changed and how you verified it124- Save corrections as described in Self-Improvement Loop125126## Core Principles127128- **Simplicity First**: Make every change as simple as possible. Impact minimal code.129- **Root Causes**: Fix the underlying cause, not the symptom; don't ship temporary fixes.130- **Minimal Impact**: Changes should only touch what's necessary.