Skip to content

Deep Reasoning with /think and /ultrathink

Unlock Claude Code’s most powerful capability: extended thinking for deep reasoning. This guide teaches you when and how to use thinking modes to solve complex architectural problems, debug intricate issues, and make better technical decisions.

What is Extended Thinking?

Extended thinking gives Claude additional computational time to thoroughly analyze problems before responding. Think of it as the difference between a quick answer and a carefully considered solution.

When activated, Claude will:

  • Explore multiple approaches and trade-offs
  • Consider edge cases and potential issues
  • Evaluate architectural implications
  • Generate more robust solutions

Claude Code offers four levels of thinking depth, each allocating progressively more computational budget:

Thinking Levels

CommandToken BudgetBest ForTime
think~5,000Quick planning, simple refactoring5-10s
think hard~10,000Feature design, debugging10-20s
think harder~50,000Architecture decisions, complex bugs30-60s
ultrathink~128,000-500,000System design, major refactoring1-3min

Use for everyday development tasks that benefit from a bit more consideration:

Terminal window
> I need to add error handling to our payment processor. Think about the best approach.

Perfect for:

  • Planning small features
  • Refactoring single modules
  • Debugging straightforward issues
  • API endpoint design
  • Database query optimization

For tasks requiring careful analysis of interactions and dependencies:

Terminal window
> We need to implement rate limiting across our microservices. Think hard about potential edge cases and the best implementation strategy.

Ideal for:

  • Cross-service feature implementation
  • Performance optimization strategies
  • Security vulnerability analysis
  • Complex bug investigation
  • Integration planning

When facing architectural decisions with significant implications:

Terminal window
> Our monolith is hitting scaling limits. Think harder about how we should approach breaking it into microservices while maintaining backward compatibility.

Best suited for:

  • Microservices decomposition
  • Database architecture redesign
  • Major refactoring planning
  • Complex state management solutions
  • Multi-tenant architecture design

Reserve for your most complex challenges requiring exhaustive analysis:

Terminal window
> We need to migrate from REST to GraphQL while supporting both APIs during transition. Ultrathink about the migration strategy, potential issues, and implementation phases.

Essential for:

  • Complete system redesigns
  • Technology stack migrations
  • Distributed system architecture
  • Complex data pipeline design
  • Enterprise integration patterns
  1. Provide Clear Context

    Terminal window
    > We have a Node.js API with 50k daily users experiencing intermittent
    > timeouts. Database queries are optimized. Think hard about what could
    > be causing this and how to diagnose it.
  2. Specify Constraints

    Terminal window
    > Design a caching strategy for our e-commerce platform. We have 1TB
    > of product data, need under 100ms response times, and limited to $500/month
    > infrastructure budget. Think harder about the optimal approach.
  3. Request Trade-off Analysis

    Terminal window
    > Compare using Kubernetes vs. Docker Swarm for our deployment needs.
    > We have 15 microservices, a small ops team, and need high availability.
    > Think hard about the trade-offs.
  4. Iterate on Thinking

    Terminal window
    > think harder about the security implications of that approach
    > think more about how this affects our CI/CD pipeline
    > ultrathink about long-term maintainability
Terminal window
> Our Node.js service memory usage grows continuously over 24 hours
> until it crashes. Standard profiling shows no obvious leaks. Think
> harder about potential causes and diagnostic approaches.

Claude will analyze:

  • Event listener accumulation
  • Closure reference patterns
  • Third-party library issues
  • Global variable pollution
  • Stream handling problems
Terminal window
> We need to version our REST API from v1 to v2 with breaking changes.
> 5000+ clients use v1. Ultrathink about the migration strategy to
> minimize disruption while maintaining both versions for 6 months.

Claude considers:

  • Versioning approaches (URL, header, content-type)
  • Database schema evolution
  • Code organization patterns
  • Client migration tooling
  • Monitoring and deprecation
Terminal window
> Our React app's initial load takes 8 seconds. Bundle is 5MB after
> optimization. Think hard about architectural changes to achieve
> sub-2-second loads.

Claude explores:

  • Code splitting strategies
  • SSR/SSG implementation
  • Progressive enhancement
  • Service worker caching
  • CDN architecture

For maximum effectiveness on complex problems:

Terminal window
> Use subagents to analyze our codebase structure, then ultrathink
> about how to implement a plugin architecture that maintains
> backward compatibility.

Start light and escalate based on initial results:

Terminal window
> How should we handle user sessions in our distributed system?
>
> # After initial response:
> think harder about the edge cases you mentioned
>
> # If needed:
> ultrathink about a complete implementation plan

Direct thinking toward specific aspects:

Terminal window
> think hard about database consistency in that approach
> think more about failure recovery scenarios
> think harder about the cost implications at scale

Token Usage by Thinking Level

Extended thinking uses additional tokens that count toward your usage:

  • Basic thinking: ~$0.15-0.30 per use
  • Deep thinking: ~$0.30-0.60 per use
  • Intensive thinking: ~$1.50-3.00 per use
  • Maximum thinking: ~$3.00-10.00 per use

Costs based on Claude Opus 4 pricing as of 2025

Don’t use ultrathink for simple tasks - it wastes tokens and time. Conversely, don’t under-think critical decisions.

The quality of thinking depends on context. Include:

  • Current architecture
  • Constraints and requirements
  • Performance targets
  • Team capabilities
  • Budget limitations

Instead of running ultrathink twice, start with think hard and refine specific aspects.

Save particularly insightful thinking outputs to your CLAUDE.md or documentation:

Terminal window
> Add the architectural decisions from your thinking to architecture.md

Extended thinking provides the most value during planning, not implementation.

Thinking Command Cheatsheet

Terminal window
# Quick planning
think about implementing user authentication
# Detailed analysis
think hard about database sharding strategy
# Complex problem solving
think harder about migrating to event sourcing
# Maximum depth analysis
ultrathink about redesigning for 100x scale
# Refine previous thinking
think more about the security aspects
think harder about edge cases

Now that you understand deep reasoning, learn how to:

Remember: Extended thinking is like having a senior architect review your plans. Use it wisely, and it will help you build better systems with fewer mistakes.