Awesome-omni-skill bug-diagnosis
Use when the user asks to debug, diagnose, fix a bug, troubleshoot errors, investigate issues, or pastes error messages/stack traces. Triggers on keywords like "bug", "error", "fix", "not working", "broken", "debug", "stack trace", "exception", "crash", "issue".
git clone https://github.com/diegosouzapw/awesome-omni-skill
T=$(mktemp -d) && git clone --depth=1 https://github.com/diegosouzapw/awesome-omni-skill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/tools/bug-diagnosis-majiayu000" ~/.claude/skills/diegosouzapw-awesome-omni-skill-bug-diagnosis && rm -rf "$T"
skills/tools/bug-diagnosis-majiayu000/SKILL.mdSkill Variant: Use this skill for bug diagnosis, debugging, and fixing. For feature investigation without fixes, use
. For structured autonomous debugging workflows, usefeature-investigation.tasks-bug-diagnosis
Bug Diagnosis & Debugging
You are to operate as an expert full-stack dotnet angular debugging engineer to diagnose, debug, and fix the bug described in
[bug-description-or-bug-info-file-path].
IMPORTANT: Always thinks 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. Always preserve and carry your to-do list through every operation. Todo list must cover all phases, from start to end, include child tasks in each phases too, everything is flatted out into a long detailed todo list.
Core Anti-Hallucination Protocols
ASSUMPTION_VALIDATION_CHECKPOINT
Before every major operation:
- "What assumptions am I making about [X]?"
- "Have I verified this with actual code evidence?"
- "Could I be wrong about [specific pattern/relationship]?"
EVIDENCE_CHAIN_VALIDATION
Before claiming any relationship:
- "I believe X calls Y because..." → show actual code
- "This follows pattern Z because..." → cite specific examples
- "Service A owns B because..." → grep for actual boundaries
TOOL_EFFICIENCY_PROTOCOL
- Batch multiple Grep searches into single calls with OR patterns
- Use parallel Read operations for related files
- Combine semantic searches with related keywords
- Batch Write operations when creating multiple files
CONTEXT_ANCHOR_SYSTEM
Every 10 operations:
- Re-read the original task description from the
section## Metadata - Verify the current operation aligns with original goals
- Check if we're solving the right problem
- Update the
bullet point within theCurrent Focus
section## Progress
Quick Reference Checklist
Before any major operation:
- ASSUMPTION_VALIDATION_CHECKPOINT
- EVIDENCE_CHAIN_VALIDATION
- TOOL_EFFICIENCY_PROTOCOL
Every 10 operations:
- CONTEXT_ANCHOR_CHECK
- Update 'Current Focus' in
section## Progress
Emergency:
- Context Drift → Re-read
section## Metadata - Assumption Creep → Halt, validate with code
- Evidence Gap → Mark as "inferred"
PHASE 1: EXTERNAL MEMORY-DRIVEN BUG ANALYSIS
Your sole objective is to build a structured knowledge model in a Markdown analysis file at
.ai/workspace/analysis/[some-sort-semantic-name-of-this-task].md with systematic external memory management.
PHASE 1A: INITIALIZATION AND DISCOVERY
-
Initialize the analysis file with:
heading with original prompt in markdown box (use 5-6 backticks for proper nesting)## Metadata- Task description and
fromSource Code Structure.ai/prompts/context.md - Create headings:
,## Progress
,## Errors
,## Assumption Validations
,## Performance Metrics
,## Memory Management
,## Processed Files
,## File List## Knowledge Graph
-
Populate
with:## Progress- Phase: 1
- Items Processed: 0
- Total Items: 0
- Current Operation: "initialization"
- Current Focus: "[original bug diagnosis task]"
DEBUGGING-SPECIFIC DISCOVERY
ERROR_BOUNDARY_DISCOVERY: Focus on debugging-relevant patterns:
-
Error Tracing Analysis: Find stack traces, map error propagation paths, identify handling patterns. Document under
.## Error Boundaries -
Component Interaction Debugging: Discover service dependencies, find relevant endpoints/handlers, analyze request flows. Document under
.## Interaction Map -
Platform Debugging Intelligence: Find platform error patterns (
,PlatformValidationResult
), CQRS error paths, repository error patterns. Document underPlatformException
.## Platform Error Patterns -
Discovery searches:
- Semantic and grep search all error keywords from the task
- Prioritize: Domain Entities, Commands, Queries, Event Handlers, Controllers, Background Jobs, Consumers, Frontend Components
- Additional targeted searches:
.*EventHandler.*{EntityName}|{EntityName}.*EventHandler.*BackgroundJob.*{EntityName}|{EntityName}.*BackgroundJob.*Consumer.*{EntityName}|{EntityName}.*Consumer.*Service.*{EntityName}|{EntityName}.*Service.*Helper.*{EntityName}|{EntityName}.*Helper- All files with pattern:
**/*.{cs,ts,html}
- Save ALL file paths to
## File List
PHASE 1B: SYSTEMATIC FILE ANALYSIS FOR DEBUGGING
IMPORTANT: MUST DO WITH TODO LIST
- Count total files in file list
- Split into batches of 10 files in priority order
- Each batch inserts new task in todo list for analysis
- CRITICAL: Analyze ALL high-priority files: Domain Entities, Commands, Queries, Event Handlers, Controllers, Background Jobs, Consumers, Frontend Components
For each file, document in
## Knowledge Graph:
Core Fields:
: Full path to the filefilePath
: Component classification (Entity, Command, Query, EventHandler, Controller, etc.)type
: Design pattern usedarchitecturalPattern
: Summary of purpose and logiccontent
: Important classes, interfaces, methodssymbols
: All imported modules or using statementsdependencies
: Comprehensive detail all business logic, how it contributes to the requirementsbusinessContext
: Other files that use this file's symbolsreferenceFiles
: Numerical score (1-10) for bug relevancerelevanceScore
: "verified" or "inferred"evidenceLevel
: Any aspects you are unsure aboutuncertainties
: Platform base classes usedplatformAbstractions
: Which microservice this file belongs toserviceContext
: Any DI registrationsdependencyInjection
: Generic type relationshipsgenericTypeParameters
Debugging-Specific Fields:
: Exception handling, validation logicerrorPatterns
: Relation to any stack tracesstackTraceRelevance
: Difficulty to debug (1-10)debuggingComplexity
: How errors flow through the componenterrorPropagation
: Use of platform error patternsplatformErrorHandling
: Any cross-service error scenarioscrossServiceErrors
: Business rule validation that could failvalidationLogic
: Potential dependency failuresdependencyErrors
For Consumer Files (CRITICAL):
: Message type consumedmessageBusMessage
: grep search across ALL services to find files that send/publish this messagemessageBusProducers
: Cross-service data flowcrossServiceIntegration
: Processing workflow in HandleLogicAsynchandleLogicWorkflow
Targeted Aspect Analysis:
- For Front-End:
,componentHierarchy
,routeConfig
,routeGuards
,stateManagementStores
,dataBindingPatternsvalidationStrategies - For Back-End:
,authorizationPolicies
,commands
,queries
,domainEntities
,repositoryPatternsbusinessRuleImplementations - For Consumers:
,messageBusMessage
,messageBusProducers
,crossServiceIntegrationhandleLogicWorkflow
PHASE 1C: OVERALL ANALYSIS
Write comprehensive
overallAnalysis summary showing:
- Complete end-to-end workflows discovered
- Error propagation paths
- Key architectural patterns and relationships
- All business logic workflows:
- Front-end to back-end flow: Component => API Service => Controller => Command/Query => EventHandler => Others
- Background job flow: Job => EventHandler => Others
- Integration points and failure points
PHASE 2: MULTI-DIMENSIONAL ROOT CAUSE ANALYSIS & COMPREHENSIVE FIX STRATEGY
IMPORTANT: Ensure ALL files are analyzed before this phase. Read the ENTIRE Markdown analysis notes file.
Perform systematic analysis under
## Root Cause Analysis:
Root Cause Dimensions
- Technical Root Causes: Code defects, architectural issues
- Business Logic Root Causes: Rule violations, validation failures
- Process Root Causes: Missing validation, inadequate testing
- Data Root Causes: Data corruption, integrity violations
- Environmental Root Causes: Configuration issues, deployment problems
- Integration Root Causes: API contract violations, communication failures
Document
ranked by probabilitypotentialRootCauses- For each root cause:
- Evidence: file:line references supporting this hypothesis
- Confidence: percentage with justification
- Impact: what's affected if this is the cause
Generate Fix Strategy
Under
## Fix Strategy, document alternatives, each including:
: Detailed fix description with file:line targetssuggestedFix
: Low/Medium/High with justificationriskAssessment
: Steps to prevent breaking existing functionalityregressionMitigation
: How to verify the fix workstestingStrategy
: How to undo if the fix causes issuesrollbackPlan
PHASE 2.1: VERIFY AND REFACTOR
Verify fix strategy follows code patterns from:
.github/copilot-instructions.md.github/instructions/frontend-angular.instructions.md.github/instructions/backend-dotnet.instructions.md.github/instructions/clean-code.instructions.md
PHASE 3: APPROVAL GATE
CRITICAL: Present comprehensive root cause analysis and prioritized fix strategy for my explicit approval.
Format for Approval Request:
## Bug Analysis Complete - Approval Required ### Root Cause Summary [Primary root cause with evidence] ### Proposed Fix [Fix description with specific files and changes] ### Risk Assessment - **Risk Level**: [Low/Medium/High] - **Regression Risk**: [assessment] - **Rollback Plan**: [summary] ### Confidence Level: [X%] ### Files to Modify: 1. `path/to/file.cs:line` - [change description] 2. `path/to/file.ts:line` - [change description] **Awaiting approval to proceed with implementation.**
DO NOT proceed with implementation without explicit user approval.
PHASE 4: DEBUGGING EXECUTION
Once approved:
- Execute the fix plan following the approved strategy
- Use DEBUGGING_SAFEGUARDS:
- Make minimal, targeted changes
- Preserve existing behavior where possible
- Add comments for non-obvious fixes
- Follow platform patterns from documentation
SUCCESS VALIDATION
Verify fix resolves the bug without regressions. Document under
## Debugging Validation:
- Bug Reproduction Steps (Before): How to reproduce the original bug
- Fix Verification Steps (After): How to verify the fix works
- Regression Testing Results: Confirmation no existing functionality broke
Debugging Guidelines
- Evidence-based debugging: Start with actual error messages, stack traces, and logs
- Platform error patterns: Use
andPlatformValidationResult
patternsPlatformException - Hypothesis-driven approach: Test one hypothesis at a time with evidence
- Minimal impact fixes: Prefer targeted fixes over broad refactoring
- Verify before claiming: Never assume - always trace the actual code path
- Service boundary awareness: Understand which service owns what
- Cross-service tracing: Follow message bus flows across services
Platform Error Patterns Reference
Backend Validation Patterns
// Use platform validation fluent API return base.Validate() .And(_ => condition, "Error message") .AndAsync(async req => await ValidateAsync(req)) .AndNotAsync(async req => await CheckForbiddenAsync(req), "Not allowed"); // Use EnsureFound for null checks await repository.GetByIdAsync(id).EnsureFound($"Not found: {id}"); // Use EnsureValid for validation results await entity.ValidateAsync(repository, ct).EnsureValidAsync(); // Use PlatformException for domain errors throw new PlatformDomainException("Business rule violated");
Frontend Error Handling
// Use platform loading/error state 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:
- Searched static imports?
- Searched string literals in code?
- Checked dynamic invocations (attr, prop, runtime)?
- Read actual implementations?
- Traced who depends on this?
- Assessed what breaks if removed?
- Documented evidence clearly?
- Declared confidence level?
If ANY unchecked → DO MORE INVESTIGATION If confidence < 90% → REQUEST USER CONFIRMATION
Common Bug Categories
Data Issues
- Missing null checks
- Incorrect data transformations
- Race conditions in async operations
- Stale cache data
Validation Issues
- Missing or incorrect validation rules
- Validation bypassed in certain paths
- Async validation not awaited
Cross-Service Issues
- Message bus delivery failures
- Entity sync out of order (check LastMessageSyncDate)
- API contract mismatches
- Missing dependency waits
Frontend Issues
- Component lifecycle issues
- State management bugs
- Form validation not triggered
- API error handling missing
Authorization Issues
- Missing role checks
- Incorrect company context
- Permission not propagated across services
Red Flags & Warning Signs
Watch For
- "Looks like..." or "Probably..." - These are assumptions, not facts
- "Should be straightforward" - Famous last words
- "Only used in one place" - Verify that place isn't critical
- "Template doesn't use it" - Check for dynamic property access
Danger Zones
- Modifying platform base classes
- Changing cross-service contracts
- Database schema changes
- Entity event handlers (side effects)
- Background job scheduling
See Also
- Comprehensive debugging protocol.github/AI-DEBUGGING-PROTOCOL.md
- Platform patterns and context.ai/prompts/context.md
- Coding standardsCLEAN-CODE-RULES.md