Debug Error
$ npx claude-code-templates@latest --command="utilities/debug-error" --yesRequires Claude Code. The command adds this command to your project's .claudedirectory — nothing runs on ToolZip's servers.
What's inside this command
Component source
Systematically Debug and Fix Errors
Systematically debug and fix errors
Instructions
Follow this comprehensive debugging methodology to resolve: $ARGUMENTS
- Error Information Gathering
- Note when the error occurs (timing, conditions, frequency)
- Identify the environment where the error happens (dev, staging, prod)
- Gather relevant logs from before and after the error
- Reproduce the Error
- Document the exact steps needed to trigger the error
- Test in different environments if possible
- Note any patterns or conditions that affect error occurrence
- Stack Trace Analysis
- Identify the exact line where the error originates
- Trace the execution path leading to the error
- Look for any obvious issues in the failing code
- Code Context Investigation
- Check recent changes that might have introduced the bug
- Review variable values and state at the time of error
- Analyze function parameters and return values
- Hypothesis Formation
- Consider common causes:
- Null pointer/undefined reference
- Type mismatches
- Race conditions
- Resource exhaustion
- Logic errors
- External dependency failures
- Debugging Tools Setup
- Use debugger, profiler, or logging as needed
- Configure breakpoints at strategic locations
- Set up monitoring and alerting if not already present
- Systematic Investigation
- Use binary search approach to isolate the problem
- Add strategic logging or print statements
- Check data flow and transformations step by step
- Data Validation
- Check for edge cases and boundary conditions
- Validate assumptions about data state
- Test with different data sets to isolate patterns
- Dependency Analysis
- Verify network connectivity and API availability
- Review configuration files and environment variables
- Test database connections and query execution
- Memory and Resource Analysis
- Monitor CPU and I/O resource consumption
- Analyze garbage collection patterns if applicable
- Check for resource deadlocks or contention
- Concurrency Issues Investigation
- Check synchronization mechanisms and locks
- Analyze async operations and promise handling
- Test under different load conditions
- Root Cause Identification
- Determine if it's a logic error, design flaw, or external issue
- Assess the scope and impact of the problem
- Consider if similar issues exist elsewhere
- Solution Implementation
- Consider multiple solution approaches and trade-offs
- Implement the fix with appropriate error handling
- Add validation and defensive programming where needed
- Testing the Fix
- Test edge cases and related scenarios
- Run regression tests to ensure no new issues
- Test under various load and stress conditions
- Prevention Measures
- Improve error handling and logging
- Add input validation and defensive checks
- Update documentation and code comments
- Monitoring and Alerting
- Add metrics and health checks
- Configure alerts for error thresholds
- Implement better observability
- Documentation
- Update troubleshooting guides
- Share learnings with the team
- Update code comments with context
- Post-Resolution Review
- Review development and testing processes
- Consider improvements to prevent similar issues
- Update coding standards or guidelines if needed
Remember to maintain detailed notes throughout the debugging process and consider the wider implications of both the error and the fix.
Related Claude Code Commands
Ultra Think
Multi-framework structured analysis: surfaces hidden assumptions, generates competing solutions, stress-tests each with adversarial reasoning, and delivers confidence-calibrated recommendations
Code Review
Comprehensive code quality review with security, performance, and architecture analysis
Refactor Code
A ready-to-install Claude Code component.
Explain Code
A ready-to-install Claude Code component.
All Tools
A ready-to-install Claude Code component.
Prime
A ready-to-install Claude Code component.
Catalog data and component content are sourced from the open-source davila7/claude-code-templates project (MIT license). ToolZip curates the listing and writes original descriptions; every component links back to its original source. Claude Code is a product of Anthropic. ToolZip is an independent catalog and is not affiliated with or endorsed by Anthropic.