Prompt template for documenting debugging sessions after successfully fixing bugs...
Purpose: Use this prompt AFTER an agent has successfully fixed a bug to capture their debugging methodology for future reference.
You just successfully debugged and fixed an issue. Please document your debugging
methodology in a structured report so that future agents (or humans) can learn from
your process and apply similar techniques when encountering similar symptoms.
Create a document in ./ai/generated_doc/ with filename: debug-report-{brief-bug-name}-{YYYY-MM-DD}.md
Include the following sections:
## 1. EXECUTIVE SUMMARY
- **Problem Statement**: What was broken? (user-facing symptoms, not root cause)
- **Root Cause**: What actually caused it? (1-2 sentences)
- **Solution**: What fixed it? (1-2 sentences)
- **Files Modified**: List with file_path:line_number references
## 2. SYMPTOM PROFILE
Document the observable symptoms that would help future agents recognize similar issues:
- What error messages appeared? (exact text)
- What behavior was unexpected?
- What worked vs what didn't work?
- What environmental conditions were present? (OS, versions, config)
- What user actions triggered it?
This section helps future agents match symptoms to your debugging strategy.
## 3. INITIAL HYPOTHESIS EVOLUTION
Show how your understanding evolved from first impression to final diagnosis:
### Hypothesis Timeline
| Time | Hypothesis | Why It Seemed Right | Evidence At The Time |
|------|-----------|---------------------|---------------------|
| T+0min | [First thought] | [Reasoning] | [What you saw] |
| T+Xmin | [Revised thought] | [New reasoning] | [New evidence] |
| T+Ymin | [Final correct understanding] | [Why this is the true cause] | [Definitive proof] |
### What Changed Your Mind?
Explain the pivotal moment or evidence that shifted you from wrong hypothesis to correct one.
## 4. DEBUGGING STRATEGY & METHODOLOGY
Document your systematic approach (so future agents can replicate it):
### Strategy Type
- [ ] Top-down (start from high-level symptoms, drill down)
- [ ] Bottom-up (start from low-level logs/code, build up)
- [ ] Binary search (divide and conquer)
- [ ] Comparative analysis (working vs broken)
- [ ] Time-travel debugging (git bisect, rollback)
- [ ] Other: [describe]
### Investigation Steps (Chronological)
For each major step, document:
1. **What you did**: [Action taken]
2. **Why you did it**: [Reasoning]
3. **What you learned**: [Finding]
4. **What you ruled out**: [What this eliminated]
5. **Next decision**: [Where to investigate next]
### Tools & Techniques Applied
List the debugging tools/techniques you used and why they were effective:
- **Tool/Technique**: [Name]
- **When Used**: [At what stage]
- **What It Revealed**: [Key insight gained]
- **Would You Use Again?**: [Yes/No and why]
## 5. DEBUG INSTRUMENTATION DETAILS
Document the temporary code you added to diagnose the issue:
### Instrumentation Locations
For each place you added debug code:
**Location**: `file_path:line_number`
**Purpose**: [What you were trying to observe]
**Implementation**:
```language
# Show the actual debug code you added
[paste debug prints, logs, assertions, etc.]
Key Insight Gained: [What this instrumentation revealed] When Added/Removed: [Timeline]
If you developed a debug technique that could be reused:
# Reusable debug pattern
[generalized version of your debug code]
When To Use: [Describe scenarios where this pattern helps]
Document the actual solution:
# BEFORE (buggy code)
[original code]
# AFTER (fixed code)
[corrected code]
Explain the mechanism by which your fix addresses the root cause (not just "it works now").
Document how you proved the fix works:
# Exact steps/commands to reproduce the original bug
[paste commands]
| Test Scenario | Purpose | Before Fix | After Fix |
|---|---|---|---|
| [Scenario] | [What it validates] | ❌ [How it failed] | ✅ [How it passes] |
What tests/checks would catch this bug if it's reintroduced?
# Test code or validation steps
[if applicable]
Document what led you astray and what got you back on track:
Extract transferable debugging wisdom:
If this bug represents a class of issues:
Reflect on your debugging efficiency:
Create a searchable reference for future agents:
Symptom Keywords: [comma, separated, searchable, terms] Root Cause Type: [e.g., race condition, null pointer, logic error, config issue] Component Affected: [e.g., auth module, database layer, API endpoint] Debug Strategy That Worked: [Brief name of your approach] Time To Fix: [Duration from start to validated fix] Difficulty: [Low/Medium/High]
"If you see [SYMPTOM X], and you've ruled out [COMMON FALSE LEAD], check [WHERE YOU FOUND THE BUG] by [HOW YOU DIAGNOSED IT]. The fix involves [SOLUTION TYPE]."
Template Metadata
Remember: Focus on METHODOLOGY and PROCESS, not just the specific bug details. Future agents should be able to learn your debugging techniques and apply them to similar symptoms even if the exact bug is different.
---
## Usage Instructions
1. **When to use**: After an agent has successfully debugged and fixed an issue
2. **How to use**: Copy the prompt block above and send it to the agent
3. **Where output goes**: The agent will create a file in `./ai/generated_doc/`
4. **Benefits**:
- Captures debugging methodology
- Creates searchable symptom profiles
- Documents red herrings for future avoidance
- Builds institutional debugging knowledge