Systematically diagnose and fix bugs while preventing regressions and documenting root causes.
Diagnoses and fixes bugs systematically with regression tests and root cause documentation.
/plugin marketplace add KreativReason/merged-end-to-end-ai-dpp---e2e-cli/plugin install kreativreason-e2e-pipeline@kreativreason-marketplaceSystematically diagnose and fix bugs while preventing regressions and documenting root causes.
| Level | Description | Response Time |
|---|---|---|
critical | System down, data loss risk | Immediate |
high | Major feature broken | Same day |
medium | Feature degraded | This sprint |
low | Minor issue, workaround exists | Backlog |
| Parameter | Required | Description |
|---|---|---|
bug_description | Yes | What's happening vs what should happen |
severity | Yes | critical, high, medium, low |
reproduction_steps | No | Steps to reproduce (if known) |
affected_area | No | Component or feature affected |
CRITICAL - Read These FIRST (Architecture Rules):
CLAUDE.md (ROOT - quick reference, MUST be in project root).claude/rules/backend-architecture.md (multi-tenancy, patterns).claude/rules/frontend-architecture.md (component patterns).claude/rules/design-system.md (UI patterns)prisma/schema.prisma (database schema, enums, types)package.json (installed library versions)Bug Context:
docs/flows/ - Expected behavior referencedocs/erd.json - Data model referencedocs/work-log.json - Previous session progressExisting Code Context:
Before marking any fix complete, verify:
| Check | Requirement | How to Verify |
|---|---|---|
| Multi-tenancy | ALL Prisma operations include org_id or tenantId | Search for prisma.* without tenant field |
| Enum validation | Only use enums defined in prisma/schema.prisma | Cross-reference status values against schema |
| JSON types | Use as Prisma.InputJsonValue for JSON fields | Check Prisma JSON column assignments |
| Library versions | Use APIs matching package.json versions | Read library docs for installed version |
| Named exports | No export default | Grep for export default |
| Zod validation | All inputs validated with Zod | Check handler inputs |
| Existing patterns | Fix matches surrounding code patterns | Compare with similar files |
## Bug Investigation: [Brief Description]
### Reproduction
- [ ] Bug confirmed reproducible
- [ ] Steps documented
- [ ] Environment noted
### Diagnosis
- [ ] Error logs reviewed
- [ ] Related code identified
- [ ] Root cause determined
- [ ] Similar issues checked (git history)
### Impact Assessment
- [ ] Affected users/features identified
- [ ] Data integrity checked
- [ ] Related areas inspected
{
"artifact_type": "bug_report",
"status": "diagnosed|fixed|cannot_reproduce",
"data": {
"bug_id": "BUG-001",
"title": "Brief description",
"severity": "high",
"reported_at": "ISO-8601",
"reproduction": {
"confirmed": true,
"steps": [
"Step 1",
"Step 2",
"Bug occurs"
],
"environment": "Production / Chrome 120"
},
"diagnosis": {
"root_cause": "Race condition in async handler",
"affected_files": ["src/handlers/async.py"],
"introduced_in": "commit abc123 (2024-01-15)",
"related_issues": []
},
"fix": {
"approach": "Add mutex lock to prevent race condition",
"files_modified": ["src/handlers/async.py"],
"regression_test": "tests/test_async_race.py",
"verified": true
},
"prevention": {
"recommendation": "Add integration test for concurrent requests",
"documentation_updated": true
}
}
}
Every fix must include:
def test_bug_001_race_condition_fixed():
"""
Regression test for BUG-001.
Ensures race condition in async handler is prevented.
"""
# Test that specifically reproduces the bug scenario
# and verifies it's now fixed
fix(scope): Brief description of fix
Root cause: [Explanation]
Regression test: tests/test_bug_xxx.py
Fixes: BUG-001
For time-sensitive bugs:
1. Reproduce (max 15 min)
└─ If cannot reproduce → Request more info
2. Diagnose (max 30 min)
└─ If root cause unclear → Add logging, try again
3. Fix (varies by complexity)
└─ Always include regression test
4. Verify (max 15 min)
└─ Full test suite must pass
| Code | Description |
|---|---|
CANNOT_REPRODUCE | Bug not reproducible with given info |
ROOT_CAUSE_UNCLEAR | Need more investigation time |
FIX_BREAKS_TESTS | Fix causes other tests to fail |
NEEDS_ADR | Fix requires architectural change |
Designs feature architectures by analyzing existing codebase patterns and conventions, then providing comprehensive implementation blueprints with specific files to create/modify, component designs, data flows, and build sequences