TL;DR
Anthropic’s own recommended loop is four phases: Explore → Plan → Implement → Commit. Stay in plan mode while you research and plan, switch out to execute, and commit small. The two habits that matter most past week one are (1) managing context aggressively with /clear and /compact, and (2) giving Claude a check it can run (tests, build, lint) so it self-corrects instead of waiting for you. Everything below is the day-to-day version of that, with the exact keystrokes, commands, and June 2026 plan details.
What this covers
Repeatable patterns for using Claude Code on real projects — the ones that still apply six months in, not the demo-day tricks. Most people learn the basics, run a few impressive demos, then drift into habits that quietly erode trust: giant tasks, no commits between steps, a stale CLAUDE.md, and one bloated session that runs all day. This guide names the patterns that keep an agent useful indefinitely and ties each one to the exact command or keystroke.
A few terms used throughout:
- Claude Code: Anthropic’s command-line AI coding agent. It reads, edits, and runs code in your terminal, and as of June 2026 it is bundled into the Claude Pro plan ($20/mo, $17/mo annual) alongside Claude Cowork.
- Plan mode: a mode where Claude can read, search, and fetch but cannot edit, write, or run shell commands. You toggle it with
Shift+Tab. - Context window: Claude’s working memory. Opus 4.7 and Sonnet 4.6 ship with a 1M-token window, but performance degrades well before that fills, which is why context hygiene is the whole game.
Who this is for
Developers already shipping with Claude Code. It is most useful if you have hit the wall where the first three weeks went great and now you are getting more rework than progress. If you are brand new, start with the Claude Code beginner guide and come back here.
When to reach for this loop
Daily project work: features, refactors, bug fixes, test additions, dependency upgrades. Skip the full loop for one-line fixes (a typo, a log line, a rename) — Anthropic’s own guidance is “if you could describe the diff in one sentence, skip the plan.” And keep greenfield architecture decisions with a human; the agent is fast at execution, not opinionated about what is right.
Before you start a session
- Treat each session like a tiny PR. Pick one goal, write it in a single sentence, and resist scope creep.
- Make sure CLAUDE.md reflects current reality. An out-of-date convention confuses the agent more than no convention. Run
/initonce to generate a starter file from your project, then prune it. - Ensure tests pass on
mainbefore you start. Otherwise you cannot tell whether the agent broke something or you inherited a break. - Decide which commands the agent may run without asking. Use
/permissionsto allowlist safe ones likenpm run lintorgit commit, or run a whole task in--permission-mode autoso a classifier blocks only risky calls.
The core loop: Explore, Plan, Implement, Commit
This is the workflow Anthropic documents as its default, and it maps cleanly onto a daily task.
1. Explore (plan mode)
Press Shift+Tab to cycle into plan mode. Tell Claude to read the relevant code without changing anything:
read /src/auth and explain how we handle sessions and login.
also look at how we manage environment variables for secrets.
In plan mode Claude can use Read, Glob, Grep, WebSearch, WebFetch, and subagents, but not Edit, Write, or Bash. If the exploration would read dozens of files, delegate it to a subagent so it does not flood your main context (more on that below). Front-load the right files using an AI coding context management workflow so the plan is grounded in real code.
2. Plan (still in plan mode)
Ask for a concrete plan, not code:
I want to add Google OAuth. What files change? What's the session flow?
List files to change, files to create, tests to add, and what's out of scope.
Then review it critically. Cut scope if the plan touches more than about 5 files. Push back on anything you did not ask for. You can press Ctrl+G to open the plan in your editor and edit it directly before Claude proceeds.
3. Implement (default mode)
Switch out of plan mode and let Claude execute against its own plan. Pair every implementation request with a verification step in the same message:
implement the OAuth flow from your plan. write tests for the callback
handler, run the test suite, and fix any failures. address root causes,
don't suppress errors.
The verification instruction is the highest-leverage line in the whole workflow. Claude stops when work “looks done”; a test or build it can run turns that into a real pass/fail it iterates against, so the loop closes without you babysitting it.
4. Commit
Ask for small, descriptive commits — easy to revert, easy to bisect, easy to write a PR description from:
commit with a descriptive message and open a PR
If you have the gh CLI installed and authenticated, Claude uses it directly to open the PR. See the Claude GitHub integration workflow for the end-to-end setup.
Context hygiene: the habit that actually scales
Context is the fundamental constraint. As the window fills, Claude starts forgetting earlier instructions and making more mistakes — long before you hit the 1M-token ceiling. Three commands keep it clean:
| Command | What it does | When to run it |
|---|---|---|
/clear | Wipes the context window entirely | Between unrelated tasks, or after two failed corrections on the same bug |
/compact [focus] | Summarizes history, keeping what matters | Proactively at ~60% capacity, not 95%; add a focus like /compact focus on the API changes and modified files |
Esc / Esc Esc (/rewind) | Stops mid-action / restores a previous checkpoint | The moment you see Claude going off track |
Two rules of thumb from Anthropic’s failure-pattern list: the “kitchen sink” session (one task, then an unrelated one, then back) is fixed by /clear; and if you have corrected Claude more than twice on the same issue, the context is polluted with failed approaches — /clear and start over with a sharper prompt that incorporates what you learned. A clean session with a better prompt almost always beats a long one with accumulated corrections.
You can also tell Claude to preserve specific things during auto-compaction by adding a line to CLAUDE.md, for example: When compacting, always preserve the full list of modified files and any test commands.
Subagents for investigation
When Claude researches your codebase it reads many files, and every one consumes your context. Subagents run in their own separate context window and report back only a summary:
use subagents to investigate how our auth system handles token refresh,
and whether we have existing OAuth utilities I should reuse.
Use the same pattern for a fresh-eyes review after implementing something — a reviewer in a clean context evaluates the diff on its own terms, not biased toward code it just wrote: use a subagent to review this diff for edge cases. The bundled /code-review skill does exactly this for correctness bugs. Define reusable specialists in .claude/agents/ (a security-reviewer, a test-writer) when you keep reaching for the same role.
TODO anchors across sessions
Use TODO comments as bookmarks the agent can navigate to next time: // TODO(claude): extract this into a separate function. In a later session, point Claude at the marker by name instead of re-explaining the location. This is how you keep multi-session work coherent without keeping one giant session open.
CLAUDE.md upkeep
CLAUDE.md is loaded at the start of every conversation, so treat it like code: prune it regularly. Anthropic’s blunt warning is that a bloated CLAUDE.md causes Claude to ignore your actual instructions, because the important rules get lost in the noise. For each line, ask: “Would removing this cause Claude to make a mistake?” If not, cut it.
| Include | Exclude |
|---|---|
| Bash commands Claude can’t guess | Anything Claude can infer from the code |
| Code style rules that differ from defaults | Standard language conventions Claude already knows |
| Preferred test runner and how to run a single test | Detailed API docs (link to them instead) |
| Branch naming and PR conventions | Information that changes frequently |
| Required env vars and environment quirks | File-by-file descriptions of the codebase |
| Non-obvious gotchas | Self-evident advice like “write clean code” |
Audit it monthly. Remove rules the agent now follows by default; add a rule each time a new mistake recurs. For knowledge that is only relevant sometimes, use a skill in .claude/skills/ instead so it loads on demand rather than bloating every session. If a rule keeps getting ignored despite being in the file, the file is probably too long.
Quality check before you call a task done
- Each commit passes tests and lints. The agent should not move to the next step on a broken state.
- The diff is scoped — only the files the plan mentioned. If extras appear, ask why before merging.
- The PR description is coherent in three sentences. If you cannot summarize it that tightly, you bundled too much.
- Claude showed evidence, not assertions: the actual test output, the command it ran and what it returned. Reviewing evidence is faster than re-running the check yourself.
Make the workflow reusable
- Save your favorite planning prompt as a skill:
.claude/skills/plan/SKILL.md. (In 2026 Anthropic merged custom slash commands into skills; files in.claude/commands/still work, but.claude/skills/is the recommended path.) See every Claude Code slash command, explained for the full surface. - For repeat workflows with side effects, set
disable-model-invocation: truein the skill so it only fires when you call it explicitly. - Use hooks for things that must happen every time with zero exceptions (run the linter after every edit, block writes to a migrations folder). Hooks are deterministic where CLAUDE.md is only advisory; run
/hooksto browse what is configured. - Name long-lived sessions with
/rename(e.g.oauth-migration) and resume them withclaude --resume, treating each workstream like a branch with its own context.
Plans and models, as of June 2026
| Plan | Price (USD/mo) | What you get for Claude Code |
|---|---|---|
| Free | $0 | Limited Sonnet 4.6 in chat; Claude Code access is gated to paid plans |
| Pro | $20 ($17 annual) | Claude Code + Cowork bundled; Sonnet 4.6 workhorse, with Opus available within a shared 5-hour usage pool |
| Max 5x | $100 | 5x the Pro usage limits |
| Max 20x | $200 | 20x the Pro usage limits |
Notes that matter for daily use:
- Usage is shared across Claude chat and Claude Code on Pro and Max — everything in both counts against the same rolling 5-hour pool.
- Opus 4.7 costs roughly 5x more per token than Sonnet 4.6, so reaching for Opus on every task burns your allowance much faster. Use Sonnet 4.6 as the default and Opus for the genuinely hard reasoning. Switch with
/model, which is also the source of truth for what your account currently has. - In May 2026 Anthropic doubled Claude Code rate limits and removed peak-hour restrictions, so the practical ceiling is higher than older write-ups suggest.
- Claude Code runs Anthropic models only. If you need to route the same task through GPT-5.5 or Gemini 3.1 Pro, that is a different tool (for example Cursor). Pricing and limits change often; confirm against Anthropic’s pricing page before quoting them.
FAQ
- How big should a single agent task be? 1–3 files, under ~200 lines of diff. Larger and review breaks down. If a plan exceeds that, split it into separate PRs.
- Should the agent run my tests? Yes — and have it show the output, not just claim “tests pass.” Some agents have summarized a green run that actually skipped. Verify the test count and pass/fail yourself.
- When can I skip plan mode? For changes you could describe in one sentence (typo, log line, rename). Anything touching multiple files or code you do not know well: plan first.
- What about long unattended runs? Give the run a verifiable goal (tests or a
/goalcondition) and a clean context, then check the evidence. Without a check it can run, every mistake waits for you to notice it. - How do I handle merge conflicts? Resolve them yourself first, then ask the agent for the next change. Agents resolve conflicts unreliably.
- Can Claude Code open PRs for me? Yes, with the
ghCLI installed and authenticated. See the Claude GitHub integration workflow.
Common mistakes
- Asking for huge multi-file changes at once — you get a diff you cannot review.
- No commits between tasks — when something breaks two tasks later, you cannot bisect.
- Letting one session run all day — context fills, performance degrades, bad diffs slip through.
/clearbetween tasks. - An over-specified CLAUDE.md — important rules get buried and ignored. Prune ruthlessly.
- Skipping verification — a plausible implementation that does not handle edge cases ships because nothing failed it.
- Auto-approving every command — the dangerous one slips through eventually. Allowlist deliberately, or use auto mode’s classifier.
- Treating the agent as authoritative on design decisions — it executes fast, but “should we” is still your call.
Related
- Claude Code intro
- Every Claude Code Slash Command, Explained: /usage to /agents
- Claude Code Beginner Guide
- Claude Code Project Setup
- Project Prompts for Claude Code
Tags: #Claude #Tutorial #Claude Code