Extended Thinking in Claude Code: Unlock Deeper Reasoning
Master Extended Thinking for Claude Code. Learn when to enable thinking mode, how to use effort levels, and how to leverage deep reasoning for complex development tasks.
Extended Thinking (also called “Thinking Mode”) gives Claude more time to reason through complex problems before responding. It’s like giving a developer time to think through architecture before writing code.
This guide covers when to use Extended Thinking, how to configure it, and patterns for maximum effectiveness.
What is Extended Thinking?
Extended Thinking allows Claude to:
- Deliberate longer before responding
- Consider multiple approaches to a problem
- Reason through edge cases systematically
- Plan multi-step implementations thoroughly
┌─────────────────────────────────────────────────────────────┐
│ Normal vs Extended Thinking │
│ │
│ Normal: │
│ ┌────────┐ ┌────────┐ │
│ │ Prompt │ ──► │Response│ │
│ └────────┘ └────────┘ │
│ │
│ Extended Thinking: │
│ ┌────────┐ ┌─────────────────┐ ┌────────┐ │
│ │ Prompt │ ► │ Internal Reason │ ► │Response│ │
│ └────────┘ │ (not visible) │ └────────┘ │
│ └─────────────────┘ │
│ ▲ │
│ │ │
│ Longer, deeper │
│ deliberation │
└─────────────────────────────────────────────────────────────┘
Model Support
| Model | Extended Thinking | Default | Notes |
|---|---|---|---|
| Opus 4.5 | Yes | ON (v2.0.67+) | Highest quality reasoning |
| Sonnet 4.5 | Yes | OFF | Enable for complex tasks |
| Haiku 4.5 | Yes | OFF | First Haiku with thinking |
Key insight: Opus 4.5 has thinking enabled by default since v2.0.67 because it significantly improves quality.
Enabling Extended Thinking
Via Config
In /config, enable thinking mode:
Thinking Mode: ON
Via Settings
In .claude/settings.json:
{
"model": "opus",
"thinking": true
}
Per-Session
Toggle during session:
"Enable thinking mode for this complex architecture discussion."
Quick Model Switch
Press Option+P (macOS) or Alt+P (Windows/Linux) to quickly switch models mid-prompt.
Effort Levels (Opus 4.5 Only)
Opus 4.5 supports effort levels for thinking depth:
| Effort | Thinking Time | Use Case |
|---|---|---|
low | Minimal | Quick tasks, batch operations |
medium | Balanced | Default, most tasks |
high | Maximum | Complex analysis, architecture |
Configuring Effort
In prompts:
"Analyze this authentication system with high effort.
I need thorough security analysis."
In Task tool:
Task({
subagent_type: "general-purpose",
model: "opus",
prompt: `
Effort: high
Analyze the payment integration architecture.
Consider all edge cases and failure modes.
`
})
When to Use Extended Thinking
Architecture Decisions
Without thinking:
"How should we structure our microservices?"
Claude: [Quick response, may miss considerations]
With thinking:
"Enable high-effort thinking.
How should we structure our microservices?
Consider: scalability, team structure, data ownership,
deployment complexity, and failure isolation."
Claude: [Thorough analysis of trade-offs]
Security Reviews
"Using Opus with high effort, review the authentication
implementation for vulnerabilities.
Consider: OWASP Top 10, JWT best practices, session
management, rate limiting, and common attack vectors."
Complex Refactoring
"Think through how to refactor the legacy payment system
to the new architecture. Consider:
- Backward compatibility
- Database migrations
- API versioning
- Rollback strategy
- Testing approach"
Debugging Complex Issues
"This bug only happens in production with high concurrency.
Use extended thinking to analyze potential causes.
Symptoms: [describe symptoms]
Environment: [describe environment]
Recent changes: [describe changes]"
Extended Thinking Patterns
Pattern 1: Architecture Review
"I need to design a new feature. Use extended thinking.
Feature: Real-time notifications
Requirements:
- Support 100K concurrent users
- < 100ms delivery latency
- Support mobile and web
- Handle offline users
Analyze options and recommend architecture."
Pattern 2: Trade-off Analysis
"Think deeply about this trade-off.
Option A: Monolith with modular structure
Option B: Microservices from start
Context:
- 3-person team
- MVP stage
- Unknown scale requirements
- Limited DevOps experience
Analyze both options with pros, cons, and recommendation."
Pattern 3: Security Audit
"Perform a deep security audit with high effort.
Focus areas:
- Authentication and authorization
- Input validation
- Data encryption
- API security
- Dependency vulnerabilities
For each issue found, provide:
- Severity (Critical/High/Medium/Low)
- Description
- Remediation steps
- Code examples"
Pattern 4: Performance Investigation
"The API is slow under load. Think through potential causes.
Observations:
- Response time increases from 50ms to 2s at 500 RPS
- CPU stays at 30%, memory at 60%
- Database connections spike
- No errors in logs
Analyze potential bottlenecks and suggest investigation steps."
Impact on Context
Important: Extended Thinking affects prompt caching efficiency.
┌─────────────────────────────────────────────────────────────┐
│ Context Usage Comparison │
│ │
│ Normal Mode: │
│ ├── Prompt Cache: Highly effective │
│ ├── Context usage: Predictable │
│ └── Token efficiency: High │
│ │
│ Extended Thinking: │
│ ├── Prompt Cache: Less effective │
│ ├── Context usage: Variable (thinking uses tokens) │
│ └── Token efficiency: Lower (but higher quality) │
│ │
└─────────────────────────────────────────────────────────────┘
Recommendation: Use extended thinking selectively for high-value decisions, not routine tasks.
Model Selection Guide
Use Haiku 4.5 (No Thinking)
Best for:
- File searches (Explore agent)
- Pattern matching (Grep)
- Simple code generation
- Bulk operations
Example:
"Find all uses of deprecated API in the codebase"
Use Sonnet 4.5 (Thinking Optional)
Best for (without thinking):
- Standard implementations
- Code refactoring
- Test writing
- Documentation
Best for (with thinking):
- Complex implementations
- Multi-file refactoring
- Architecture-sensitive changes
Example:
"Implement the user authentication system following
our security patterns. Enable thinking for the token
refresh mechanism design."
Use Opus 4.5 (Thinking Default)
Best for:
- Architecture decisions
- Security audits
- Complex debugging
- Critical code paths
Example:
"Review the payment processing implementation.
Use high effort for the transaction handling logic."
Thinking Mode in Agents
Explore Agent (Haiku)
Explore agents use Haiku without thinking for speed:
Task({
subagent_type: "Explore",
model: "haiku",
prompt: "Find authentication patterns (thoroughness: medium)"
})
No thinking needed - pure search and discovery.
Implementation Agent (Sonnet + Thinking)
For complex implementations, enable thinking:
Task({
subagent_type: "general-purpose",
model: "sonnet",
prompt: `
Enable thinking mode.
Implement OAuth 2.0 with PKCE flow.
Consider:
- State management
- Token storage
- Refresh handling
- Error recovery
`
})
Review Agent (Opus + High Effort)
For critical reviews, use Opus with high effort:
Task({
subagent_type: "general-purpose",
model: "opus",
prompt: `
Effort: high
Security review the payment integration.
Check for:
- PCI compliance issues
- Data exposure risks
- Authentication bypasses
- Rate limiting gaps
`
})
Practical Examples
Example 1: Feature Design
"I need to add collaborative editing to our document app.
Enable extended thinking with high effort.
Constraints:
- Real-time sync (< 100ms)
- Handle offline mode
- Conflict resolution
- Undo/redo support
Analyze:
1. Technology options (CRDT, OT, etc.)
2. Architecture approach
3. Trade-offs of each option
4. Recommended path forward"
Example 2: Migration Planning
"We're migrating from MongoDB to PostgreSQL.
Use Opus with high effort to create a migration plan.
Current state:
- 50 collections
- 10M documents
- 5 services depending on data
- Zero downtime requirement
Deliverables:
1. Migration strategy
2. Schema design
3. Service update plan
4. Rollback strategy
5. Testing approach
6. Timeline estimate"
Example 3: Debug Session
"Production issue: Intermittent 500 errors on /api/checkout.
Think through this carefully.
Data points:
- Happens ~1% of requests
- No pattern in time of day
- No correlation with request size
- Started after last deploy
- Logs show: 'Connection reset by peer'
Analyze potential causes and investigation steps."
Example 4: Code Review
"Review this PR with extended thinking.
PR adds: Payment processing with Stripe
Focus areas:
- Error handling completeness
- Idempotency of operations
- State machine correctness
- Webhook handling security
- Test coverage adequacy
Provide detailed feedback with specific line references."
Thinking Mode Configuration
Project-Level
In .claude/settings.json:
{
"model": "sonnet",
"thinking": false,
"thinkingConfig": {
"enableForSecurity": true,
"enableForArchitecture": true,
"defaultEffort": "medium"
}
}
Per-Task Triggers
Configure thinking to auto-enable:
{
"thinkingTriggers": {
"keywords": ["security", "architecture", "design"],
"paths": ["auth/", "payment/", "admin/"],
"operations": ["create-file", "refactor"]
}
}
Cost-Benefit Analysis
When Extended Thinking Pays Off
| Scenario | Time Cost | Quality Gain | ROI |
|---|---|---|---|
| Architecture decision | +30s | Avoid months of rework | Very High |
| Security review | +45s | Catch vulnerability | Very High |
| Complex refactor | +20s | Better design | High |
| Bug investigation | +15s | Faster root cause | High |
| Routine coding | +10s | Marginal improvement | Low |
When to Skip
- File searches
- Pattern matching
- Simple code changes
- Documentation updates
- Routine tests
Best Practices
1. Be Explicit About Thinking
"Enable extended thinking for this security analysis."
Not:
"Analyze this code."
2. Provide Rich Context
Extended thinking works better with context:
"Using high-effort thinking, design the caching layer.
Context:
- Current: No caching, 200ms average response
- Goal: <50ms for 80% of requests
- Constraints: Redis available, 5GB memory budget
- Traffic: 10K RPM, 80% reads
Consider cache invalidation, TTL strategies, and
cache stampede prevention."
3. Request Structured Output
"Think through this architecture decision.
Output format:
1. Options considered (3-5)
2. Evaluation criteria
3. Analysis matrix
4. Recommendation with rationale
5. Risk assessment"
4. Combine with Agents
Use thinking for orchestration, speed for execution:
"Phase 1 (Opus, high effort): Design the migration strategy
Phase 2 (Sonnet, no thinking): Implement each migration step
Phase 3 (Haiku, no thinking): Run tests in parallel"
Monitoring Thinking Usage
Check Context Usage
The status line (v2.0.65+) shows context usage:
Context: 45% used | Thinking: enabled | Model: opus
Adjust Based on Session
For long sessions, consider disabling thinking for routine tasks to preserve context:
"Disable thinking for these routine file updates."
Getting Started
Today:
- Enable thinking for one architecture decision
- Compare output quality with and without thinking
- Note the time difference
This week:
- Configure model selection for your project
- Identify tasks that benefit from thinking
- Create prompts that leverage deep reasoning
This month:
- Establish thinking mode guidelines for team
- Configure auto-enable triggers
- Measure impact on decision quality
Extended Thinking transforms Claude from a fast responder to a thoughtful partner. Use it strategically for decisions that matter, and watch the quality of your architecture decisions improve dramatically.