Lesson completed!
-

Claude Code Plan Mode (Shift+Tab): Think Before Coding

Plan Mode and Extended Thinking

Plan Mode activates Claude's Extended Thinking capability, allowing it to reason through complex problems before taking action.

What is Extended Thinking?

Extended Thinking gives Claude more "thinking time" to:

  • Analyze complex requirements
  • Consider multiple approaches
  • Plan multi-step implementations
  • Identify potential issues upfront

Activating Extended Thinking

Use these magic words in your prompts:

KeywordThinking Time
think~10 seconds
think hard~30 seconds
ultrathink~60+ seconds

Example:

> think hard about how to refactor our authentication
> system to support OAuth2 and SAML

The Planning Process

When you activate Plan Mode, Claude will:

  1. Analyze the current state
  2. Identify requirements and constraints
  3. Design an implementation strategy
  4. Create a step-by-step plan
  5. Present the plan for your approval
  6. Execute upon confirmation

When to Use Plan Mode

Complex Refactors

> ultrathink about migrating from REST to GraphQL

Architecture Decisions

> think hard about the best way to implement
> real-time notifications in our app

Debugging Complex Issues

> think about why our memory usage keeps increasing
> after processing large files

Multi-service Changes

> ultrathink about adding a new payment provider
> that needs changes to frontend, backend, and database

Best Practices

Provide Context

Extended Thinking works best with context:

> We have a Next.js app with Prisma ORM and Redis cache.
> think hard about implementing a new caching strategy
> for user profiles that invalidates properly.

Review the Plan

Always review the plan before execution:

Claude: Here's my plan:
1. Create new cache invalidation service
2. Update user profile queries
3. Add Redis pub/sub for real-time invalidation
4. Update tests

> Approve? (y/n/e)

Iterate on Plans

You can refine the plan:

> Good plan, but also consider backwards compatibility
> with the mobile app v1.x

When Claude Gets Stuck

Everyone faces this: Claude tries to fix something 3 times and each fix generates a new error. Here's how to break out of the loop:

Signs Claude Is Stuck

  • Same error appears after each "fix"
  • Claude starts undoing changes it already made
  • Responses become repetitive
  • Claude suggests things you already tried

Recovery Protocol

Step 1: STOP - Don't keep approving

# Press Esc to stop

Step 2: Ask for root cause analysis

STOP. You've tried to fix this 3 times.
ultrathink the ROOT CAUSE - not symptoms. What assumption are we making that's wrong?

Step 3: If still stuck, reset context

/clear
# Start fresh with a new problem description

Step 4: If nothing works, break it down

Let's break this into smaller parts:
1. First, just show me where the error originates (no fix yet)
2. Then explain why the previous fixes didn't work
3. Then propose ONE minimal fix

When to Code It Yourself

Sometimes the answer is: code it yourself. Signs:

  • Claude has made 5+ attempts without progress
  • The fix is obvious but Claude doesn't see it
  • It's faster to do manually (2-3 lines)

No shame in coding. Claude is a tool, not a replacement.

Cost of Extended Thinking

LevelReasoning TokensApprox CostJustified When
Normal0BaseSimple edits, questions
"think"2-5k+$0.01-0.02New features
"think hard"5-10k+$0.03-0.05Complex bugs, security
"ultrathink"10-16k++$0.05-0.10Critical architecture

Rule: If ultrathink saves you 30 minutes of debugging, that $0.10 is the best investment.

For Teams: When to Scale Plan Mode

If you lead a team, consider these patterns:

Mode Policies by Seniority

RoleDefault ModeAuto ModePlan Mode
JuniorAlways approveSupervised onlyRequired for features
MidUse judgmentOn feature branchesFor changes >5 files
SeniorFreeFreeFor architecture

When to Require Plan Mode

Have your team use Plan Mode mandatorily for:

  • Features touching >10 files
  • Changes to core modules (auth, payments, etc.)
  • Any data migration
  • Architectural decisions

The plan can be reviewed in PR as decision documentation.

Next Steps

In the next module, you'll learn about CLAUDE.md and memory systems for persistent context.