Prompt file imported from yubo-yue/yubo-python (
.github/prompts/debug-issue.prompt.md). Copyright stays with the author.
Debug Python Issues
Systematic debugging assistance for Python code issues, focusing on MCP server development and AI/ML experimentation.
Debugging Process
1. Problem Identification
- Gather error messages, stack traces, and symptoms
- Identify when the issue occurs (startup, runtime, specific conditions)
- Determine affected components (MCP tools, server, dependencies)
- Check recent changes that might have introduced the issue
2. Investigation Strategy
- Error Analysis: Parse stack traces and error messages
- Code Review: Examine relevant code sections for issues
- Environment Check: Verify Python version, dependencies, and configuration
- Logging Analysis: Review application logs and debug output
3. Common Issue Categories
MCP Server Issues
- Tool registration and schema generation problems
- Transport configuration and connection issues
- Type hint errors affecting schema validation
- Async/await usage problems
Python Code Issues
- Import errors and dependency conflicts
- Type annotation problems
- Exception handling and error propagation
- Performance bottlenecks and memory issues
Environment Issues
- Conda environment configuration problems
- Package version conflicts
- Missing dependencies or incorrect installations
- Path and module resolution issues
Debugging Tools & Techniques
Built-in Debugging
- Use
print()statements for quick debugging - Leverage Python's
pdbdebugger for interactive debugging - Add logging with appropriate levels (debug, info, warning, error)
- Use
tracebackmodule for detailed error information
Testing & Validation
- Create minimal reproducible examples
- Write unit tests to isolate issues
- Use
pytestwith verbose output - Mock external dependencies to isolate problems
MCP Specific Debugging
- Test tools independently before LLM integration
- Use
uv run mcp dev server.pyfor development testing - Validate schemas with different parameter types
- Check Claude Desktop integration logs
Resolution Approach
- Reproduce: Create a minimal case that demonstrates the issue
- Isolate: Narrow down to the specific component or function
- Analyze: Understand the root cause of the problem
- Fix: Implement a targeted solution
- Test: Verify the fix works and doesn't break other functionality
- Document: Update code comments or documentation if needed
Provide the error message, stack trace, or describe the issue you're experiencing, and I'll help debug it systematically.
