Skill Variant: Use this skill for quick bug triage and interactive debugging with user feedback. For systematic autonomous debugging workflows with 4-phase protocol and verification gates, use debugging skill instead. For feature investigation without fixes, use feature-investigation.
Disambiguation
- For systematic multi-file debugging with verification protocols -> use
debugging
- For feature investigation without fixes -> use
feature-investigation
- This skill focuses on quick triage of user-reported bugs
Bug Diagnosis & Debugging
You are to operate as an expert full-stack .NET Angular debugging engineer to diagnose, debug, and fix the bug described in [bug-description-or-bug-info-file-path].
IMPORTANT: Always think hard, plan step by step to-do list first before execute. Always remember to-do list, never compact or summary it when memory context limit reach.
Prerequisites: MUST READ .claude/skills/shared/anti-hallucination-protocol.md before executing.
PHASE 1: EXTERNAL MEMORY-DRIVEN BUG ANALYSIS
Build a structured knowledge model in a Markdown analysis file at .ai/workspace/analysis/[semantic-name].analysis.md.
PHASE 1A: INITIALIZATION AND DISCOVERY
- Initialize the analysis file with: Metadata, Progress, Errors, File List, Knowledge Graph sections
- Discovery searches: Semantic and grep search all error keywords. Prioritize: Domain Entities, Commands, Queries, Event Handlers, Controllers, Background Jobs, Consumers, Frontend Components
PHASE 1B: SYSTEMATIC FILE ANALYSIS
- Count total files, split into batches of 10 in priority order
- For each file, document: filePath, type, content, symbols, dependencies, businessContext, errorPatterns, stackTraceRelevance, validationLogic
PHASE 1C: OVERALL ANALYSIS
Write comprehensive summary showing: end-to-end workflows, error propagation paths, integration points and failure points.
PHASE 2: ROOT CAUSE ANALYSIS & FIX STRATEGY
Root Cause Dimensions
- Technical: Code defects, architectural issues
- Business Logic: Rule violations, validation failures
- Data: Data corruption, integrity violations
- Integration: API contract violations, communication failures
Generate Fix Strategy
Document alternatives with: suggestedFix, riskAssessment, regressionMitigation, testingStrategy, rollbackPlan.
PHASE 3: APPROVAL GATE
CRITICAL: Present root cause analysis and fix strategy for explicit user approval before implementation.
PHASE 4: DEBUGGING EXECUTION
Once approved: execute fix plan, make minimal targeted changes, follow platform patterns.
Platform Error Patterns Reference
Backend Validation
return base.Validate()
.And(_ => condition, "Error message")
.AndAsync(async req => await ValidateAsync(req));
await repository.GetByIdAsync(id).EnsureFound($"Not found: {id}");
await entity.ValidateAsync(repository, ct).EnsureValidAsync();
Frontend Error Handling
this.apiService.getData().pipe(
this.observerLoadingErrorState('loadData'),
this.tapResponse(
data => this.updateState({ data }),
error => this.handleError(error)
),
this.untilDestroyed()
).subscribe();
Quick Verification Checklist
Before removing/changing ANY code:
If confidence < 90% -> REQUEST USER CONFIRMATION
Common Bug Categories
| Category |
Examples |
| Data Issues |
Missing null checks, race conditions, stale cache |
| Validation |
Missing rules, bypassed validation, async not awaited |
| Cross-Service |
Message bus failures, sync ordering, API contract mismatches |
| Frontend |
Lifecycle issues, state bugs, missing error handling |
| Authorization |
Missing role checks, wrong company context |
Related
IMPORTANT Task Planning Notes (MUST FOLLOW)
- Always plan and break work into many small todo tasks
- Always add a final review todo task to verify work quality and identify fixes/enhancements
1---2name: bug-diagnosis3description: Quick triage skill for initial bug assessment and user-reported issues. Use for bug reports, error reports, quick diagnosis, initial triage, "what's causing", "why is this failing". For systematic multi-file debugging with verification protocols, use `debugging` skill instead.4---5
6> **Skill Variant:** Use this skill for **quick bug triage and interactive debugging** with user feedback. For systematic autonomous debugging workflows with 4-phase protocol and verification gates, use `debugging` skill instead. For feature investigation without fixes, use `feature-investigation`.
7
8## Disambiguation
9
10- For **systematic multi-file debugging** with verification protocols -> use `debugging`
11- For **feature investigation** without fixes -> use `feature-investigation`
12- This skill focuses on **quick triage** of user-reported bugs
13
14# Bug Diagnosis & Debugging
15
16You are to operate as an expert full-stack .NET Angular debugging engineer to diagnose, debug, and fix the bug described in `[bug-description-or-bug-info-file-path]`.
17
18**IMPORTANT**: Always think hard, plan step by step to-do list first before execute. Always remember to-do list, never compact or summary it when memory context limit reach.
19
20**Prerequisites:** **MUST READ** `.claude/skills/shared/anti-hallucination-protocol.md` before executing.
21
22---
23
24## PHASE 1: EXTERNAL MEMORY-DRIVEN BUG ANALYSIS
25
26Build a structured knowledge model in a Markdown analysis file at `.ai/workspace/analysis/[semantic-name].analysis.md`.
27
28### PHASE 1A: INITIALIZATION AND DISCOVERY
29
301. **Initialize** the analysis file with: Metadata, Progress, Errors, File List, Knowledge Graph sections
312. **Discovery searches**: Semantic and grep search all error keywords. Prioritize: Domain Entities, Commands, Queries, Event Handlers, Controllers, Background Jobs, Consumers, Frontend Components
32
33### PHASE 1B: SYSTEMATIC FILE ANALYSIS
34
351. Count total files, split into batches of 10 in priority order
362. For each file, document: filePath, type, content, symbols, dependencies, businessContext, errorPatterns, stackTraceRelevance, validationLogic
37
38### PHASE 1C: OVERALL ANALYSIS
39
40Write comprehensive summary showing: end-to-end workflows, error propagation paths, integration points and failure points.
41
42---
43
44## PHASE 2: ROOT CAUSE ANALYSIS & FIX STRATEGY
45
46### Root Cause Dimensions
47
481. **Technical**: Code defects, architectural issues
492. **Business Logic**: Rule violations, validation failures
503. **Data**: Data corruption, integrity violations
514. **Integration**: API contract violations, communication failures
52
53### Generate Fix Strategy
54
55Document alternatives with: suggestedFix, riskAssessment, regressionMitigation, testingStrategy, rollbackPlan.
56
57---
58
59## PHASE 3: APPROVAL GATE
60
61**CRITICAL**: Present root cause analysis and fix strategy for explicit user approval before implementation.
62
63---
64
65## PHASE 4: DEBUGGING EXECUTION
66
67Once approved: execute fix plan, make minimal targeted changes, follow platform patterns.
68
69---
70
71## Platform Error Patterns Reference
72
73### Backend Validation
74```csharp
75return base.Validate()
76 .And(_ => condition, "Error message")
77 .AndAsync(async req => await ValidateAsync(req));
78
79await repository.GetByIdAsync(id).EnsureFound($"Not found: {id}");
80await entity.ValidateAsync(repository, ct).EnsureValidAsync();
81```
82
83### Frontend Error Handling
84```typescript
85this.apiService.getData().pipe(
86 this.observerLoadingErrorState('loadData'),
87 this.tapResponse(
88 data => this.updateState({ data }),
89 error => this.handleError(error)
90 ),
91 this.untilDestroyed()
92).subscribe();
93```
94
95---
96
97## Quick Verification Checklist
98
99Before removing/changing ANY code:
100- [ ] Searched static imports?
101- [ ] Searched string literals?
102- [ ] Checked dynamic invocations?
103- [ ] Read actual implementations?
104- [ ] Traced dependencies?
105- [ ] Declared confidence level?
106
107**If confidence < 90% -> REQUEST USER CONFIRMATION**
108
109---
110
111## Common Bug Categories
112
113| Category | Examples |
114|----------|---------|
115| Data Issues | Missing null checks, race conditions, stale cache |
116| Validation | Missing rules, bypassed validation, async not awaited |
117| Cross-Service | Message bus failures, sync ordering, API contract mismatches |
118| Frontend | Lifecycle issues, state bugs, missing error handling |
119| Authorization | Missing role checks, wrong company context |
120
121## Related
122
123- `debugging`
124- `code-review`
125
126---
127
128**IMPORTANT Task Planning Notes (MUST FOLLOW)**
129- Always plan and break work into many small todo tasks
130- Always add a final review todo task to verify work quality and identify fixes/enhancements