home / skills / duc01226 / easyplatform / fix-issue

fix-issue skill

/.claude/skills/fix-issue

This skill guides systematic debugging of a GitHub issue in C#, ensuring evidence-based root cause analysis and user-approved fixes.

npx playbooks add skill duc01226/easyplatform --skill fix-issue

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
5.4 KB
---
name: fix-issue
description: "[Fix & Debug] ⚡⚡ Fix a GitHub issue with systematic debugging"
argument-hint: [issue-number]
infer: true
---

# Fix GitHub Issue: $ARGUMENTS

Fix a GitHub issue following the systematic debugging workflow based on the `debug` skill.

## Summary

**Goal:** Systematically diagnose and fix a GitHub issue with evidence-based root cause analysis and user approval before implementation.

| Step | Action | Key Notes |
|------|--------|-----------|
| 1 | Fetch issue details | `gh issue view` -- extract title, labels, stack traces |
| 2 | Understand the issue | Map expected vs actual behavior, reproduction steps |
| 3 | Evidence gathering | Multi-pattern search: imports, string literals, dynamic invocations |
| 4 | Root cause analysis | Rank causes by probability with file:line evidence |
| 5 | Propose fix | Minimal changes, risk assessment, test plan, rollback plan |
| 6 | Wait for approval | Present analysis -- DO NOT code without explicit user approval |
| 7 | Implement fix | Code changes, tests, PR creation |

**Key Principles:**
- Always use external memory at `.ai/workspace/analysis/issue-[number].md`
- If confidence < 90%, request user confirmation before proceeding
- Never make code changes without explicit user approval

**IMPORTANT**: Always use external memory at `.ai/workspace/analysis/issue-[number].md` for structured analysis.

## IMPORTANT: Anti-Hallucination Protocols

Before any operation:

1. "What assumptions am I making about this issue?"
2. "Have I verified this with actual code evidence?"
3. "Could I be wrong about the root cause?"

---

## Phase 1: Fetch Issue Details

1. **Get issue information:**

    ```bash
    gh issue view $ARGUMENTS
    ```

2. **Extract key information:**
    - Issue title and description
    - Labels (bug, feature, enhancement)
    - Related PRs or issues
    - Assignees and reviewers
    - Stack traces or error messages

3. **Create analysis notes** at `.ai/workspace/analysis/issue-[number].md`

---

## Phase 2: Understand the Issue

1. **Analyze the issue:**
    - What is the expected behavior?
    - What is the actual behavior?
    - Are there reproduction steps?
    - Is there a stack trace or error message?

2. **Search codebase for relevant code:**
    - Use grep for error messages and keywords
    - Search patterns: `.*EventHandler.*{Entity}`, `.*Consumer.*{Entity}`, etc.
    - Find related entities/components
    - Map the affected code paths

---

## Phase 3: Evidence Gathering

1. **Multi-pattern search:**
    - Static imports and usages
    - String literals (runtime/config references)
    - Dynamic invocations (reflection, attributes)

2. **Trace dependency chains:**
    - Who calls this code?
    - Who depends on this code?
    - Cross-service message flows

3. **Read actual implementations** (not just interfaces)

4. **Document evidence** with file:line references

---

## Phase 4: Root Cause Analysis

Analyze across dimensions:

1. **Technical**: Code defects, architectural issues
2. **Business Logic**: Rule violations, validation failures
3. **Data**: Corruption, integrity violations, race conditions
4. **Integration**: API contract violations, cross-service failures
5. **Environmental**: Configuration issues, deployment problems

Document:

- Potential root causes ranked by probability
- Evidence with file:line references
- Confidence level (High 90%+, Medium 70-89%, Low <70%)

---

## Phase 5: Propose Fix

1. **Design the fix:**
    - Minimal changes principle
    - Follow platform patterns from documentation
    - Consider edge cases

2. **Risk assessment:**
    - Impact level (Low/Medium/High)
    - Regression risk
    - Affected components

3. **Test plan:**
    - Unit tests to add
    - Manual testing steps
    - Regression considerations

4. **Rollback plan:**
    - How to revert if fix causes issues

---

## Phase 6: Wait for Approval

**CRITICAL:** Present your analysis and proposed fix in this format:

```markdown
## Issue Analysis Complete - Approval Required

### Issue

#[number] - [title]

### Root Cause Summary

[Primary root cause with evidence at file:line]

### Proposed Fix

[Fix description with specific files and changes]

### Risk Assessment

- **Risk Level**: [Low/Medium/High]
- **Regression Risk**: [assessment]

### Confidence Level: [X%]

### Files to Modify:

1. `path/to/file.cs:line` - [change description]

**Awaiting approval to proceed with implementation.**
```

**DO NOT** make any code changes without explicit user approval.

---

## Phase 7: Implement Fix

After approval:

1. Make the code changes following platform patterns
2. Add/update tests
3. Verify fix works
4. Create PR with issue reference using `gh pr create`

---

## Quick Verification Checklist

Before proposing any change:

- [ ] Searched static imports?
- [ ] Searched string literals?
- [ ] Checked dynamic invocations?
- [ ] Read actual implementations?
- [ ] Traced dependencies?
- [ ] Assessed what breaks?
- [ ] Documented evidence?
- [ ] Declared confidence?

**If ANY unchecked → DO MORE INVESTIGATION**
**If confidence < 90% → REQUEST USER CONFIRMATION**

---

Use the `debug` skill for the complete debugging protocol. For autonomous mode, use `debugging --autonomous`.
**⚠️ MUST READ** `.ai/docs/AI-DEBUGGING-PROTOCOL.md` for comprehensive guidelines.

## IMPORTANT Task Planning Notes

- Always plan and break many small todo tasks
- Always add a final review todo task to review the works done at the end to find any fix or enhancement needed

Overview

This skill guides a systematic, evidence-driven workflow to diagnose and fix a GitHub issue. It emphasizes reproducible analysis, ranked root-cause evidence, a minimal proposed fix, and explicit user approval before any code changes. The process uses external analysis notes to maintain traceability.

How this skill works

The skill fetches issue metadata and reproductions, searches the codebase for supporting evidence, and traces call/dependency paths to locate likely causes. It ranks potential root causes with file:line references, produces a low-risk fix proposal with tests and rollback steps, and waits for explicit user approval before implementing changes.

When to use it

  • A GitHub issue includes stack traces, failing tests, or unclear root cause and needs systematic diagnosis.
  • You must propose a minimal, low-risk code change with a clear test and rollback plan.
  • When evidence-based root-cause ranking and confidence reporting are required for stakeholder approval.
  • To prepare a well-documented PR that links issue analysis, tests, and risk assessment.

Best practices

  • Store structured analysis at .ai/workspace/analysis/issue-[number].md for traceability.
  • Gather multiple evidence types: static imports, string literals, dynamic invocations, and file:line references.
  • Rank causes by probability and state a confidence level; if confidence < 90%, request confirmation.
  • Propose minimal changes following platform patterns and include unit/manual test steps and rollback plan.
  • Never implement code changes without explicit user approval.

Example use cases

  • A production crash with a stack trace requiring file:line evidence and a low-risk patch.
  • A failing integration test where the API contract may have changed and cross-service traces are needed.
  • A logic bug with ambiguous symptoms that needs ranked hypotheses and confidence-based approval.
  • Converting a reported issue into a documented fix proposal and PR-ready change set.

FAQ

Do you edit code immediately after analysis?

No. The skill presents a proposed fix and waits for explicit user approval before making any code changes.

Where is the analysis recorded?

All structured analysis is saved to .ai/workspace/analysis/issue-[number].md for auditability and future reference.