What you will be able to do
- Run a Claude Code task as four separate phases (explore, plan, implement, commit) and say why research and planning come before any code is written
- Choose the permission mode that matches how much the task should be allowed to change without your approval
- Write prompts that point Claude at exact files, sources and symptoms instead of describing them loosely
- Keep a session clean by interrupting, rewinding, clearing and delegating research to subagents
- Give Claude a check it can run (a test, a screenshot or a build) so it can verify its own work
Key concept
Explore, plan, implement, commit — A Claude Code workflow that keeps reading and planning apart from editing. Claude first learns the relevant code, then proposes a plan you can review, and only after that writes, tests and commits the change.
1.Explore, plan, implement, commit
Claude Code is an agent. It reads files, runs shell commands, edits code and uses git in your project, so a vague request such as "add Google OAuth" can turn straight into edits across a codebase it has not read yet. The explore, plan, implement, commit loop prevents that. Each phase is its own prompt, and no code is written until Claude understands the existing code and you have agreed on a plan.
Explore
read /src/auth and understand how we handle sessions and login.
also look at how we manage environment variables for secrets.
Plan
I want to add Google OAuth. What files need to change?
What's the session flow? Create a plan.
Implement
implement the OAuth flow from your plan. write tests for the
callback handler, run the test suite and fix any failures.
Commit
commit with a descriptive message and open a PRExplore asks Claude to read and explain, and nothing else. Plan asks which files will change and how the flow will work, and the answer is something you can review and correct while correcting it costs nothing. Implement refers back to "your plan" and includes its own check: write tests, run the suite, fix the failures. Commit turns the finished work into a commit and a pull request.
Plan mode makes the first two phases safe. If you start a session with claude --permission-mode plan, Claude can investigate and propose changes but cannot write to your source files. You review the proposal and then leave plan mode to implement it, so nothing reaches disk until you have seen the plan.
Checkpoint 1 of 7· Fill the gap
In the four-phase OAuth example, the Implement prompt ties the work back to an earlier phase. Which word completes it?
Explore
read /src/auth and understand how we handle sessions and login.
also look at how we manage environment variables for secrets.
Plan
I want to add Google OAuth. What files need to change?
What's the session flow? Create a plan.
Implement
implement the OAuth flow from your ? . write tests for the
callback handler, run the test suite and fix any failures.
Commit
commit with a descriptive message and open a PRThe Implement prompt builds on the plan you reviewed and agreed to in the previous phase, so no code is written until that plan is settled. The prompt then adds its own check: write tests, run the suite and fix any failures.
Source: code.claude.comCheckpoint 2 of 7· Check yourself
You want Claude to investigate a codebase and propose a change for you to review. Nothing should be written to your source files until you have seen the proposal. How should you start the session?
In plan mode, Claude can read the code and propose changes but cannot write to your source files. You review the plan and only then leave plan mode to implement it. A request in a prompt doesn't enforce anything, and skipping Explore makes the plan worse without protecting any files.
“Plan: Claude explores and proposes a plan without editing your source files”Source: code.claude.com
2.Matching the permission mode to the task
The permission mode sets which actions Claude takes on its own and which ones wait for you. Choosing a mode is a workflow decision. Exploring an unfamiliar repo, reviewing untrusted code and doing a routine refactor each need a different amount of freedom.
| Mode | Runs without asking | Waits for you | Best for |
|---|---|---|---|
| Manual (the default prompting mode) | Reading and searching | Every file edit and every shell command | Untrusted code, such as an external contributor's pull request |
| Accept edits | File edits and common filesystem commands like mkdir and mv | Other shell commands | Implementation work where you trust the edits but want to see commands |
| Plan | Exploration only; source files are not edited | Leaving plan mode to implement | The explore and plan phases |
| Auto | Most actions; a background classifier blocks the risky ones | Nothing routine, because the classifier decides instead of asking you | Long sessions where prompting on every step would slow you down |
Take a security engineer reviewing a pull request from outside the team. Claude should read the files and run analysis, but every edit and every command needs the engineer's approval first. Manual is the only mode in the table that meets this. Accept edits would apply file changes without asking. Auto would let a classifier approve most actions. Plan blocks edits, but it is a mode for proposing changes, not for approving them one at a time. bypassPermissions goes further than any of these and drops the prompts entirely. It is not even in the normal Shift+Tab cycle until you start Claude Code with --allow-dangerously-skip-permissions. In recent versions of Claude Code, Auto is the built-in starting mode for interactive sessions, so you switch to Manual deliberately when you need it.
Between these modes, permission allowlists let you pre-approve individual commands you know are safe, such as npm run lint or git commit. Claude then stops asking about those commands while still asking about everything else. Pre-approving a few specific commands is safer than switching the whole session to a more permissive mode.
Checkpoint 3 of 7· Match them up
Match each permission mode to the task it suits best.
Tap a term, then the definition that fits it.
Manual is the only mode that asks before every edit and every command. Accept edits applies edits and common filesystem commands without asking but still asks about other commands. Plan proposes changes without editing source files. Auto lets a classifier block risky actions instead of asking you.
“Accept edits: Claude edits files and runs common filesystem commands like mkdir and mv without asking, still asks for other commands”Source: code.claude.com
Checkpoint 4 of 7· Exam question
A security engineer wants Claude Code to review a pull request from an external contributor. Claude should be able to read files and run analysis commands, but the engineer must manually approve every file edit and shell command before it executes. Which permission mode satisfies this requirement?
Correct answer: A — default (Manual) mode, which prompts before any write or command beyond reads
- A. Correct. Manual mode, the default mode, only auto-approves reads and prompts before every edit, write, or shell command, matching the requirement that the engineer approve every action on an untrusted external contribution.
- B. Incorrect. acceptEdits auto-approves file edits and common filesystem Bash commands like mkdir or mv without a prompt, which violates the requirement to manually approve every edit and command.
- C. Incorrect. auto mode routes most actions through a classifier that approves them without a human prompt, which is the opposite of requiring manual approval for every edit and command.
- D. Incorrect. bypassPermissions disables prompts entirely, including for protected paths, so nothing would require the engineer's manual approval.
3.Pointing Claude at exact context
The precision of a prompt limits the precision of the result. If you ask "fix the login bug", Claude has to search for the bug, guess what it is, and decide for itself when the fix is done. If you name the location, the scenario and the fix condition, it has none of those to guess. The table below pairs vague requests with specific versions of the same request.
| Technique | Vague | Specific |
|---|---|---|
| Scope the task | add tests for foo.py | write a test for foo.py covering the edge case where the user is logged out. avoid mocks. |
| Point to sources | why does ExecutionFactory have such a weird api? | look through ExecutionFactory's git history and summarize how its api came to be |
| Reference existing patterns | add a calendar widget | look at how existing widgets are implemented on the home page; HotDogWidget.php is a good example |
| Describe the symptom | fix the login bug | login fails after session timeout; check the auth flow in src/auth/, write a failing test that reproduces the issue, then fix it |
Referencing a file with @ works better than describing where the code lives, because Claude reads the file before it responds. Explain the logic in @src/utils/auth.js puts that exact file in context. A directory reference such as @src/components gives Claude the list of files in that directory, not their contents. Use it to orient Claude, then reference the files that matter.
Context can arrive in other ways too. You can paste or drag in a screenshot of an error or a design mockup. You can pipe data straight into Claude with cat error.log | claude -p "explain this error". You can give a documentation URL. Or you can tell Claude to fetch what it needs itself with Bash commands, MCP tools or file reads, which saves you from pasting large amounts of text.
Checkpoint 5 of 7· Check yourself
A developer types "review the error handling in @src/api" and expects Claude to have the code of every handler in context before it answers. What does the directory reference actually give Claude, and what should the developer do?
A directory reference shows Claude which files are in the directory but not what is in them. To put a file's contents in context, reference that file directly. Using the directory reference first to orient Claude is fine, as long as you follow it with the files that matter.
“Directory references show file listings, not contents”Source: code.claude.com
4.Redirecting, clearing and delegating
Correct a session as soon as it drifts. Waiting means more wasted work to undo. Press Esc to stop Claude in the middle of an action: the running tool call is cancelled and the context is kept, so you can redirect it straight away. If Claude is heading the right way and only needs a nudge, type the correction and press Enter without stopping it. The message is queued, and Claude reads it as soon as its current tool calls finish, within the same turn. If the work has already gone wrong, press Esc twice or run /rewind to restore an earlier state of both the conversation and the code.
Leftover context also costs you. A long session full of material from an unrelated earlier task can make Claude perform worse. Run /clear between unrelated tasks to start from an empty context. For a quick side question, use /btw: its answer never enters the conversation history. When a session has to keep going, /compact Focus on the API changes summarizes it according to your instructions instead of whatever the automatic summary would choose to keep.
Subagents keep the main context clean in a different way. A prompt such as "use subagents to investigate how our authentication system handles token refresh" sends the file reading to a separate agent, and only its findings come back to your session. A subagent can also be a reusable specialist with a fixed tool set and its own instructions, defined in a file:
---
name: security-reviewer
description: Reviews code for security vulnerabilities
tools: Read, Grep, Glob, Bash
model: opus
---
You are a senior security engineer. Review code for:
- Injection vulnerabilities (SQL, XSS, command injection)
- Authentication and authorization flaws
- Secrets or credentials in code
- Insecure data handling
Provide specific line references and suggested fixes.Checkpoint 6 of 7· Fill the gap
Your team wants a reusable security-review subagent that can only read and search code and run Bash, so it can never edit files. Which frontmatter field sets that fixed tool set?
---
name: security-reviewer
description: Reviews code for security vulnerabilities
? : Read, Grep, Glob, Bash
model: opus
---
You are a senior security engineer. Review code for:
- Injection vulnerabilities (SQL, XSS, command injection)
- Authentication and authorization flaws
- Secrets or credentials in code
- Insecure data handling
Provide specific line references and suggested fixes.The tools field lists the only tools this subagent can use. Here that is the read and search tools plus Bash, so it can review code but not edit it. Like any subagent, it works in its own context and sends only its findings back to your main session.
5.Giving Claude a way to check its own work
Feedback loops and iterative refinement inside the system mean the system checks its own output and improves on it. In Claude Code, that requires giving Claude something concrete to check against. "Implement a function that validates email addresses" has no finish line. Adding example cases (user@example.com is true, invalid is false, user@.com is false) and the instruction "run the tests after implementing" gives Claude a result it can verify. UI work follows the same pattern: paste a screenshot of the design, ask Claude to screenshot its result, compare the two, and fix the differences. For a failing build, paste the actual error and ask for the root cause to be fixed, not for the error to be suppressed.
There are four ways to attach the check, depending on how long it needs to apply and how firmly it must hold:
- In one prompt: ask Claude to run the check and keep iterating in the same message.
- Across a session: set the check as a
/goalcondition. A separate evaluator re-checks it after every turn, and Claude keeps working until the goal is met. - As a deterministic gate: a Stop hook runs your check as a script and blocks the turn from ending until it passes.
- As a second opinion: a verification subagent has a fresh model try to refute the result, so the agent that did the work is not the one grading it.
Checkpoint 7 of 7· Match them up
A team wants Claude to check its own work in four different situations. Pick the way of attaching the check that fits each one.
Tap a term, then the definition that fits it.
The four options differ in how long the check applies and how firmly it holds. A prompt covers one message. /goal lasts the whole session and uses a separate evaluator. A Stop hook is a deterministic script that can block the turn from ending. A verification subagent gets an independent model to challenge the work.
“As a deterministic gate: a Stop hook runs your check as a script and blocks the turn from ending until it passes.”Source: code.claude.com
Sources4
Sources
(4)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Plan: Claude explores and proposes a plan without editing your source files”
↩︎ Explore, plan, implement, commit“Manual: Claude asks before file edits and shell commands”
↩︎ Matching the permission mode to the task“Auto: a classifier reviews most actions in the background and blocks the risky ones instead of asking you.”
↩︎ Matching the permission mode to the task“Type a correction and press Enter without stopping Claude.”
↩︎ Redirecting, clearing and delegating“Manual: Claude asks before file edits and shell commands”
↩︎ Exam trap 1“Accept edits: Claude edits files and runs common filesystem commands like mkdir and mv without asking, still asks for other commands”
↩︎ Prediction - 2.https://code.claude.com/docs/en/common-workflowsOfficial docs
“Plan before editing to review changes before they touch disk”
↩︎ Explore, plan, implement, commit“Directory references show file listings, not contents”
↩︎ Pointing Claude at exact context“Delegate research to subagents to keep your main context clean”
↩︎ Redirecting, clearing and delegating“Plan before editing to review changes before they touch disk”
↩︎ Key concept“Directory references show file listings, not contents”
↩︎ Exam trap 2 - 3.https://code.claude.com/docs/en/cli-referenceOfficial docs
“Add bypassPermissions to the Shift+Tab mode cycle without starting in it.”
↩︎ Matching the permission mode to the task - 4.https://code.claude.com/docs/en/best-practicesOfficial docs
“Permission allowlists: permit specific tools you know are safe, like npm run lint or git commit”
↩︎ Matching the permission mode to the task“Reference files with @ instead of describing where code lives. Claude reads the file before responding.”
↩︎ Pointing Claude at exact context“Esc: stop Claude mid-action with the Esc key. Context is preserved, so you can redirect.”
↩︎ Redirecting, clearing and delegating“/clear: reset context between unrelated tasks. Long sessions with irrelevant context can reduce performance.”
↩︎ Redirecting, clearing and delegating“The answer never enters conversation history, so you can check a detail without growing context.”
↩︎ Redirecting, clearing and delegating“a Stop hook runs your check as a script and blocks the turn from ending until it passes”
↩︎ Giving Claude a way to check its own work“a verification subagent or a dynamic workflow that checks its own findings has a fresh model try to refute the result”
↩︎ Giving Claude a way to check its own work“As a deterministic gate: a Stop hook runs your check as a script and blocks the turn from ending until it passes.”
↩︎ Checkpoint