skills/github/github-issue-to-pr/SKILL.md
Turn a GitHub issue into a tested, verified PR. This skill owns the end-to-end discipline — premise validation, duplicate sweeps, class-level fixes, and honest CI reporting; the sibling GitHub and development skills own their own mechanics.
Don't use for: reviewing an existing PR, or answering a code question with no requested change.
Use terminal to run gh issue view <N> --comments. The body is a snapshot from filing time; the newest comments carry the live state: partial fixes already merged, new root-cause analyses, maintainer decisions, or questions directed at you that change the task. Also read repository instructions (AGENTS.md, contribution docs) with read_file. Done when the currently requested behavior, non-goals, and any unanswered thread questions are known.
Before writing anything, run gh pr list --search "#<N>" --state all plus at least two keyword/synonym variants of the symptom (gh pr list --search "<subsystem> <symptom>" --state open). Popular issues attract multiple independent fixes; building a duplicate wastes the work and the credit. Also check whether a recent commit already fixed it: git log --oneline -20 -- <relevant files>. Done when you know every open PR and recent commit touching this issue, or that none exist.
Reproduce the bug or demonstrate the missing behavior on the current default branch with a failing test or fixture, using search_files and read_file to trace the reported path. Then check the second question: is the "bug" actually deliberate design? Run git log -p -S "<symbol>" on the code the issue wants changed and read the original commit's intent — a missing link or restriction is often the feature. Challenge stale or flawed issue prose instead of implementing it blindly. Done when the root cause or feature gap is demonstrated in current code AND the change doesn't fight an intentional design.
List acceptance criteria, interfaces, migrations/state changes, compatibility, security/privacy, rollout, and rollback. Map every criterion to a test or explicit verification. Done when review has a finite contract.
Work on an isolated branch or worktree, loading systematic-debugging or test-driven-development when the bug class calls for them. Add regression tests first, then implement. When the fix is in hand, search_files for the same bug shape at sibling call sites and fix the whole class in this PR — an incomplete fix that leaves known siblings broken is worse than none. Every changed line must trace to the issue; no drive-by cleanup. Done when targeted tests pass, the original failure no longer reproduces, and sibling sites are fixed or explicitly ruled out.
Temporarily restore the old behavior of the exact function under test, run the new test, and confirm it FAILS; then restore the fix and confirm it passes. A regression test that passes with and without the fix proves nothing. Done when the test demonstrably fails on pre-fix code.
Run the formatter, lint, typecheck, and the repo's canonical test entrypoint on affected areas; use requesting-code-review on the diff. Then push and open the PR right away — the PR is what dispatches CI, and CI latency is the long pole; do not sit on finished work. Load github-pr-workflow for PR mechanics: conventional branch/commit, body linking the issue with problem, approach, tests, risk, and exclusions. Read the PR back and verify head SHA, base, title, and files. Done when the PR exists with the intended diff and CI is running.
Inspect live checks and failure logs via gh pr checks / gh run view --log-failed. Distinguish failures introduced by your diff from pre-existing baseline or infrastructure failures — reproduce on the default branch when unsure, and rerun once only for genuine infra flakes. Never say "green," "merged," or "released" without live evidence of that exact state. When the PR lands, comment on the issue with the PR link and a one-line explanation so the reporter gets a traceable resolution. Done when CI state, remaining blockers, and the issue thread all reflect reality.