Skip to content

Debugging Claude

Sometimes Claude doesn’t do what you expect. Here’s how to diagnose and fix issues.

Symptoms:

  • Asks questions you already answered
  • Contradicts earlier decisions
  • Loses track of the task

Causes:

  • Context window full
  • Too much irrelevant information
  • Long conversation

Fixes:

> /compact
# or
> /clear
> Here's what we were working on: [brief summary]

Symptoms:

  • Implements something different than requested
  • Uses wrong patterns or libraries
  • Ignores constraints

Fixes:

# Be more explicit
> Stop. Let me clarify:
> - Use PostgreSQL, not SQLite
> - Follow the pattern in existing_file.py
> - Do NOT modify the auth module
# Or use plan mode (Alt+M to cycle to plan mode)
> [task]
# Answer clarifying questions

Symptoms:

  • Missing error handling
  • No tests
  • Inconsistent style

Fixes:

# Add requirements upfront
> implement [feature]
> requirements:
> - include error handling for edge cases
> - add pytest tests
> - follow existing patterns in the codebase
# Or review and iterate
> this code is missing error handling
> add try/except for network calls and database operations

Symptoms:

  • Says files don’t exist when they do
  • Wrong paths

Fixes:

# Be explicit about paths
> the file is at app/services/user.py (relative to project root)
# Or help it search
> search for files containing "UserService"

Symptoms:

  • Keeps trying the same approach
  • Doesn’t learn from failures

Fixes:

> Stop. This approach isn't working.
> Let's try a different strategy: [describe alternative]
# Or start fresh
> /clear
> [reframe the problem differently]
> what do you understand about the current task?
> what constraints are you working with?
> why did you choose that approach?
> /context
> show me what you see in app/main.py
> is this the current version?
> before you implement, explain your plan
> what files will you modify?
> what's the sequence of changes?

Start a fresh session when:

  • Context is over 50% full
  • Claude seems confused despite corrections
  • You’re changing to a completely different task
  • The conversation has become unproductive
Terminal window
exit
claude "fresh start: [clear task description]"

If Claude consistently fails at a task:

  1. Simplify - Break into smaller tasks
  2. Provide examples - Show what you want
  3. Check CLAUDE.md - Is context correct?
  4. Try different model - Opus for complex tasks