Raw view: Fix a GitHub issue by number
No invisible, zero-width, or bidi-control characters detected.
---
description: Fetch a GitHub issue by number, reproduce it, fix it on a new branch with a regression test
argument-hint: <issue-number>
allowed-tools: Bash(gh issue view *), Bash(gh issue comment *), Bash(git status *), Bash(git checkout *), Bash(git switch *), Bash(git branch *), Bash(git add *), Bash(git commit *), Bash(git diff *), Bash(git log *), Read, Grep, Glob, Edit, Write
disable-model-invocation: true
---
Fix GitHub issue #$0.
Issue:
!`gh issue view $0 --json number,title,body,labels,comments --jq '{number,title,labels:[.labels[].name],body,comments:[.comments[].body]}'`
Current tree:
!`git status -sb`
Procedure:
1. Stop if the working tree is dirty; ask the user to commit or stash first.
2. Restate the issue in two sentences: expected behavior, actual behavior. Extract the reproduction steps, versions, and any stack trace from the body and comments. If reproduction is unclear, say what is missing and stop.
3. Create a branch: `git switch -c fix/$0-<short-kebab-summary>`.
4. Reproduce. Prefer a failing test that encodes the issue; otherwise a command that shows the failure. Show the failing output.
5. Localize the cause: follow the trace, read the surrounding code, check `git log -5 -- <file>` for recent changes. State the root cause in one sentence with file:line.
6. Implement the smallest fix that addresses the cause. No refactors, no unrelated cleanup.
7. Run the new test, the containing file, then the full suite. Show the summary lines.
8. Commit with a Conventional Commit message whose footer is `Fixes #$0`.
9. Report: root cause, files changed, test added, verification output, and anything in the issue you deliberately did not address.
Do not push, do not open a PR, and do not comment on the issue unless the user asks. If the issue is a feature request rather than a bug, say so and propose a plan instead of implementing.