Claude-skill-registry debugging-claude-code
Troubleshooting guide for Claude Code issues. Use when Claude behaves unexpectedly, tools fail, sessions hang, or you need to diagnose problems. Covers diagnostics, common issues, and recovery procedures.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/debugging-claude-code" ~/.claude/skills/majiayu000-claude-skill-registry-debugging-claude-code && rm -rf "$T"
manifest:
skills/data/debugging-claude-code/SKILL.mdsource content
Debugging Claude Code
Systematic troubleshooting guide for diagnosing and resolving Claude Code issues.
Quick Diagnostics
Run these commands first when experiencing issues:
# Health check - comprehensive system status claude doctor # Or in-session /doctor # Check Claude Code version claude --version # Debug mode - verbose output for all operations claude --debug # Environment-level debug logging ANTHROPIC_LOG=debug claude # Check registered hooks claude --print-hooks # View MCP server status claude mcp list
Common Issues Quick Reference
| Symptom | Likely Cause | Quick Fix |
|---|---|---|
| Tool not working | Permission denied | then allow tool |
| MCP tools missing | Server disconnected | to check status |
| Hook not firing | JSON syntax error | |
| Skill not loading | Invalid frontmatter | Check YAML syntax |
| Context overflow | Too much data | Use or |
| Rate limited | Too many requests | Wait 60 seconds |
| API errors | Auth/network issues | Check |
| Session stuck | Process hanging | Ctrl+C, restart Claude |
| Slow responses | Network or model load | Check connection, try again |
Debug Flags and Environment Variables
Command-Line Flags
| Flag | Purpose |
|---|---|
| Enable verbose debug output |
| Display all registered hooks |
| Show more detailed output |
| Disable response caching |
Environment Variables
| Variable | Purpose | Example |
|---|---|---|
| Log level | , , , |
| Additional debugging | or |
| MCP connection timeout (ms) | |
| Max MCP output size | |
| Proxy for network requests | |
| HTTPS proxy | |
| Skip proxy for hosts | |
Combined Debug Session
# Maximum verbosity ANTHROPIC_LOG=debug claude --debug 2>&1 | tee ~/claude-debug.log
Log Locations
By Operating System
| OS | Location |
|---|---|
| macOS | |
| Linux | |
| Windows | |
Configuration Files
| File | Purpose |
|---|---|
| User settings and hooks |
| API credentials |
| Project-specific settings |
| Project settings (committed) |
| Local project settings |
| MCP server configuration |
Session Data
| Location | Contents |
|---|---|
| Session transcripts |
| Task lists |
| Persistent memory |
Diagnostic Commands
System Health
# Full health check claude doctor # Check component status claude doctor --component api claude doctor --component mcp claude doctor --component hooks
reports (2.1.6+):/doctor
- Updates section - Shows auto-update channel and available npm versions (stable/latest)
- Permission warnings - Detects unreachable permission rules with fix guidance
- API connectivity - Verifies connection to Anthropic API
- MCP servers - Lists connected servers and their status
- Hooks - Validates hook configurations
Permission Diagnostics
# View current permissions /permissions # Check what tools are allowed /permissions --tools # Check file access patterns /permissions --files
Hook Diagnostics
# List all registered hooks claude --print-hooks # View hooks in interactive mode /hooks # Validate hook JSON jq . ~/.claude/settings.json jq . .claude/settings.json
MCP Diagnostics
# List configured servers claude mcp list # Get server details claude mcp get <server-name> # Check connection in session /mcp
Diagnostic Decision Tree
Is Claude starting?
Claude won't start | +-- Check: claude --version | | | +-- Works --> Config issue, check ~/.claude/ | +-- Fails --> Installation issue, reinstall | +-- Check: ANTHROPIC_LOG=debug claude | +-- Auth error --> Check credentials +-- Network error --> Check connectivity +-- Other --> See COMMON-ISSUES.md
Are tools working?
Tool not working | +-- Check: /permissions | | | +-- Denied --> Allow tool | +-- Allowed --> Continue | +-- Check: --debug output | | | +-- Tool called --> Check tool-specific logs | +-- Not called --> Check permissions/syntax | +-- MCP tool? | +-- Yes --> /mcp, check server status +-- No --> See COMMON-ISSUES.md
Are hooks working?
Hook not firing | +-- Check: /hooks | | | +-- Listed --> Matcher issue or script issue | +-- Not listed --> JSON syntax error | +-- Validate JSON: jq . settings.json | | | +-- Valid --> Check matcher pattern | +-- Invalid --> Fix JSON syntax | +-- Test script: echo '{}' | ./hook.sh | +-- Works --> Matcher doesn't match +-- Fails --> Script error
Built-in Diagnostic Commands
| Command | Purpose |
|---|---|
| View registered hooks |
| MCP server status |
| Permission settings |
| Memory bank status |
| Session status |
| Report a bug |
| Run health checks |
Verbose Mode
Toggle verbose mode during a session:
- Keyboard shortcut:
(in terminal)Ctrl+O - Shows: Hook execution, tool calls, API responses
Quick Fixes
Permission Issues
# Allow all file operations in project /permissions --allow "Write,Edit,Read" --scope project # Allow specific MCP server /permissions --allow "mcp__servername__*"
Clear Issues
# Clear conversation context /clear # Compact context (keep important parts) /compact # Reset session /reset
Configuration Reset
# Back up and reset settings cp ~/.claude/settings.json ~/.claude/settings.json.bak rm ~/.claude/settings.json # Reset just hooks jq 'del(.hooks)' ~/.claude/settings.json > tmp && mv tmp ~/.claude/settings.json
Reference Files
| File | Contents |
|---|---|
| DIAGNOSTICS.md | Detailed diagnostic techniques |
| COMMON-ISSUES.md | Common problems and solutions |
| RECOVERY.md | Recovery procedures |
When to Escalate
Use
/bug to report issues when:
shows failuresclaude doctor- Reproducible crashes
- API errors persist after credential refresh
- Behavior contradicts documentation
Include in bug reports:
- Claude Code version (
)claude --version - OS and version
- Debug output (
)claude --debug - Steps to reproduce