Skip to content

Commit f8e6715

Browse files
committed
pi: add /bug prompt template for test-driven bug diagnosis
1 parent 19a3115 commit f8e6715

File tree

1 file changed

+53
-0
lines changed
  • dotfiles/pi/.pi/agent/prompts

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
description: Investigate and fix a bug with test-driven diagnosis
3+
---
4+
5+
# Bug Fix
6+
7+
Fix a bug using test-driven diagnosis. Write a failing test first, then fix it.
8+
9+
## Bug Description
10+
11+
$ARGUMENTS
12+
13+
## Workflow
14+
15+
### 1. Investigate
16+
17+
Find the root cause before touching any code:
18+
19+
- Read relevant source files — trace the execution path that triggers the bug
20+
- Check existing tests to understand intended behavior
21+
- Check recent git history for changes that may have introduced it
22+
- Narrow down to the specific code responsible
23+
- If the bug description is unclear, ask questions before proceeding
24+
- State the root cause clearly before moving on
25+
26+
### 2. Reproduce
27+
28+
Write a test that exposes the bug:
29+
30+
- The test should encode the correct expected behavior
31+
- It must fail against the current code, proving the bug exists
32+
- Keep it minimal — test exactly the broken behavior, nothing else
33+
- Run the test and confirm it fails
34+
35+
If the test passes, your understanding of the bug is wrong — go back to step 1.
36+
37+
### 3. Fix
38+
39+
Make the minimal change to fix the bug:
40+
41+
- Fix only what's broken — don't refactor, don't clean up
42+
- Follow existing patterns in the codebase
43+
- Run the failing test and confirm it now passes
44+
- Run the full test suite to check for regressions
45+
46+
### 4. Report
47+
48+
Summarize:
49+
50+
- Root cause
51+
- What the test covers
52+
- What was changed to fix it
53+
- Any related issues worth noting

0 commit comments

Comments
 (0)