Skip to content

Workflows

Proven loops: plan, implement, verify, and review.

Advanced12 min read

Claude Code works best when you follow a consistent loop: explore the code, plan your approach, implement with Claude's help, then verify the result. This lesson shows you the proven patterns that keep that loop tight and your sessions productive.

Explore first, then plan

Before asking Claude to change anything, let it read the relevant code. This gives Claude accurate context and prevents it from guessing at structure it hasn't seen. Once you understand the territory, switch to plan mode — Claude proposes a written plan and makes no file edits until you approve it.

text
# Option 1: start in plan mode from the terminal
claude --permission-mode plan

# Option 2: toggle plan mode mid-session
# Press Shift+Tab to cycle through permission modes
Why plan mode matters
Plan mode lets you catch misunderstandings before any file is touched. Read Claude's plan, correct wrong assumptions with a follow-up message, then approve. It costs nothing to iterate on a plan.

Test-driven workflow

Writing tests before or alongside implementation keeps Claude honest — passing tests are proof the code actually does what you intended, not just that it compiles. Claude reads your existing test files to match your project's style and framework.

text
find functions in UserService.ts that are not covered by tests
add tests for the uncovered functions
add edge cases for invalid input and empty states
run the new tests and fix any failures

Review the diff before moving on

After Claude makes changes, always read the diff before continuing. Claude shows you proposed edits and asks for approval — use that moment. You can also ask Claude to summarize what changed and why before you commit.

text
summarize the changes you just made and flag anything I should double-check

Clear context between tasks

Every message you send sits in Claude's context window. After you finish one task and move to an unrelated one, run /clear to start fresh. This prevents earlier conversation details from confusing Claude's understanding of the new task.

text
/clear
Do not use /clear mid-task
/clear wipes everything Claude currently knows about the current task. Use it only when you are fully done with one piece of work and ready to start something new.

Resume sessions across sittings

Claude Code saves every conversation locally. You never have to re-explain your project from scratch when you come back after a break.

bash
# Resume the most recent session in this directory
claude --continue

# Open a picker to choose from previous sessions
claude --resume
Note
Inside a running session, type /resume to open the same picker without leaving Claude Code. If --continue finds no prior session in the current directory, it exits with a message — that just means nothing has been saved here yet.

Dynamic workflows for large jobs

For tasks that span dozens of files or need many simultaneous investigations — a codebase-wide audit, a 500-file migration, deep research with cross-checked sources — Claude Code can write and run a dynamic workflow: a script that orchestrates many subagents working in parallel while your session stays responsive. Run /workflows to see running and completed workflow runs.

Workflows use significantly more tokens
A single workflow run can spawn dozens of agents. Test on a small slice of your project first (one directory, one file) to gauge cost before running it at full scale.
Key takeaways
The core loop: explore with Claude first, plan before editing (Shift+Tab), implement, verify with tests, review the diff, then commit. Use /clear between tasks. Use --continue or --resume to pick up where you left off. Reach for dynamic workflows only when a task is genuinely too large for a single conversation. Full reference: code.claude.com/docs/en/common-workflows.