agentleFS
gssajithgssajith/claude-skills/skills/fix-issue/SKILL.md

fix-issue

Skill2 starsChanged 4 months agoMITView on GitHub

Fix a GitHub issue end-to-end - sync the repo, verify the issue still reproduces by reading code, write a fix spec, pause for human approval, implement with TDD, open a PR and request review from every collaborator. Trigger: /fix-issue <github-issue-url>

  • Commits and pushes

16 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use refactor, ship and 3 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • GitHubSkill

    refactor

    Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.

    Also in 3 projects that use this

  • AWSSkill

    ship

    Finalize dev work on an issue branch — update docs, push, and open a PR.

    Also in 3 projects that use this

  • SentrySkill

    review

    Fixture review skill.

    Also in 3 projects that use this

  • AWSSkill

    tdd

    Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

    Also in 3 projects that use this

  • MicrosoftSkill

    handoff

    Compact the current conversation into a handoff document for another agent to pick up.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

11 rules. 0 are common, 7 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 7

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Do not run this unattended: If the person who invoked /fix-issue is not present to approve the spec at Step 6, stop and wait there.

    line 12
  2. Distinctive:

    If this prints anything at all (modified, staged, or untracked files), stop and ask the user how to proceed — do not stash or discard …

    line 57
  3. Distinctive:

    If this errors (bad URL, no access, issue deleted), stop and report the error to the user — do not guess at issue content.

    line 75
  4. Very specific:

    Write a markdown spec to $repo_dir/docs/issue-fixes/<repo>-<issue_number>-spec.md (create the docs/issue-fixes/ directory if it doesn't …

    line 95
  5. Distinctive:

    Do not leave any section empty — if a section genuinely doesn't apply, say why in one sentence rather than omitting it.

    line 122
  6. Very specific:

    Never proceed past this step without an explicit approval from ExitPlanMode.

    line 143
  7. Distinctive:

    Only reachable after Step 6's approval.

    line 149
  8. Distinctive:

    Write a failing test that reproduces the issue, following the spec's "Test plan" section.

    line 151
  9. Distinctive:

    Run the full test suite for the affected package/module (not just the new test).

    line 154
  10. Distinctive:

    If the suite isn't green: stop here, do not proceed to Step 8.

    line 156
  11. Very specific:

    If the collaborators call fails or returns nothing (permissions, rate limit): still run gh pr create without --reviewer, and tell the user …

    line 184

“Common” is measured: kept by at least 6 in 10 of the 15 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

fix-issue

Fixes one GitHub issue end-to-end inside a single interactive session, with exactly one human approval gate — before any code is written. A second gate, PR review, happens on GitHub afterward and is outside this skill's control.

Do not run this unattended. If the person who invoked /fix-issue is not present to approve the spec at Step 6, stop and wait there. Never skip Step 6 and go straight to implementation, no matter how small the fix looks.

Announce at start: "Using fix-issue to work <issue-url>."

Step 1: Resolve the target repo

Parse <owner>/<repo> and the issue number out of the issue URL, e.g. https://github.com/<org>/<org>-app/issues/565 → owner=<org>, repo=<org>-app, issue_number=565. If the URL doesn't match this pattern, stop and tell the user the URL couldn't be parsed — do not guess at owner/repo/issue values.

Find the local checkout by matching git remotes — never hardcode a repo-name → path table, since this workspace's repo layout has drifted before. Substitute the owner/repo values parsed above before running this — the variables are shown unquoted here for clarity, but must be bound to real values first.

for d in */; do
  if [ -d "$d/.git" ]; then
    remote=$(git -C "$d" remote get-url origin 2>/dev/null)
    case "$remote" in
      *"$owner/$repo".git|*"$owner/$repo") echo "$d" ;;
    esac
  fi
done
  • Exactly one match → that directory is $repo_dir. Use it as the working directory for every remaining step.
  • No match → ask: "No local checkout of $owner/$repo found here. Clone it into this workspace?" On yes, run gh repo clone $owner/$repo from the workspace root, then use the newly created directory as $repo_dir. On no, stop the pipeline here — do not guess at a repo location.
  • More than one match → stop and ask the user which directory to use. Never guess.

Step 2: Sync

In $repo_dir:

git status --short

If this prints anything at all (modified, staged, or untracked files), stop and ask the user how to proceed — do not stash or discard anything automatically. Only continue once the tree is confirmed clean (empty output).

Find the default branch and sync it:

default_branch=$(git remote show origin | grep "HEAD branch" | awk '{print $NF}')
git checkout "$default_branch"
git pull

Step 3: Fetch the issue

gh issue view <issue-url> --json title,body,comments,labels,url

If this errors (bad URL, no access, issue deleted), stop and report the error to the user — do not guess at issue content.

Step 4: Verify the issue still reproduces

Using the issue's title/body/comments, identify the code paths it implicates and read them on the current default branch (the one just synced in Step 2). This is code-read only — never start services, run the app, or execute a repro script to check this.

Reason explicitly about whether the described behavior is still present given what the code does today. Two outcomes:

  • Already fixed: state clearly what changed (or why the described behavior can no longer occur) and stop the pipeline entirely — do not write a spec, do not touch code, do not open a PR. Report this to the user as the final output of this run.
  • Still reproduces: continue to Step 5 with a concrete understanding of the root cause — Step 5's spec depends on being able to cite exact files/lines, not just repeat the issue text.

Step 5: Write the fix spec

Write a markdown spec to $repo_dir/docs/issue-fixes/<repo>-<issue_number>-spec.md (create the docs/issue-fixes/ directory if it doesn't exist yet — this is a new, per-repo convention, not tied to any existing spec location in that repo). Use exactly these sections:

# Issue #<issue_number>: <issue title>

## Problem
<what's broken, user-visible symptom, copied/paraphrased from the issue>

## Root cause
<why, in the current code, tied to specific file/line references found in Step 4>

## Proposed fix
<the approach — describe the change, not a full diff>

## Affected files
- `path/to/file.ext` — <what changes here>

## Risks / edge cases
<anything that could make this fix incomplete or regress something else>

## Test plan
<what a passing fix looks like — the failing test to write in Step 7, at minimum>

Do not leave any section empty — if a section genuinely doesn't apply, say why in one sentence rather than omitting it.

Step 6: Gate 1 — get spec approval (STOP AND WAIT)

This is the pipeline's one required human approval gate. Call EnterPlanMode. Once inside plan mode, write the full content of the Step 5 spec file into the plan file specified in the plan-mode system message (copy it in — don't just reference its path). Then call ExitPlanMode, which reads that file and surfaces it to the user for approval.

  • Approved → before continuing to Step 7, make sure the repo spec file at $repo_dir/docs/issue-fixes/<repo>-<issue_number>-spec.md matches exactly what was approved — if the spec was revised during this gate (edited in the plan file rather than the repo file, since only the plan file is writable inside plan mode), overwrite the repo spec file with the approved content now, before moving on. Do not re-summarize or re-confirm the approval itself — the approval is the gate.
  • Changes requested → go back to Step 5, revise the spec file with the requested changes, and re-present it through this same gate. Repeat until approved or the user says to stop.
  • User aborts → end the pipeline here. Do not implement anything, do not open a PR.

Never proceed past this step without an explicit approval from ExitPlanMode. If the person who ran /fix-issue is not available to respond, wait — do not time out into "assume approved."

Step 7: Implement with TDD

Only reachable after Step 6's approval.

  1. Write a failing test that reproduces the issue, following the spec's "Test plan" section. Run it and confirm it fails for the expected reason (not a setup error).
  2. Implement the fix described in the spec's "Proposed fix" section.
  3. Run the full test suite for the affected package/module (not just the new test).

If the suite isn't green: stop here, do not proceed to Step 8. Report exactly what's failing and ask the user how to proceed — do not open a PR against a red suite, and do not loosen the new test to force it to pass.

For unfamiliar failures, use the superpowers:systematic-debugging skill rather than guessing at fixes.

Step 8: Branch, commit, push, open PR, request reviewers

branch="fix/issue-<issue_number>-<short-slug>"
git checkout -b "$branch"
git add <changed files> docs/issue-fixes/<repo>-<issue_number>-spec.md
git commit -m "fix: <one-line summary>

Fixes #<issue_number>"
git push -u origin "$branch"

Open the PR and request review from every collaborator except the PR author in one call:

pr_author=$(gh api user --jq .login)
reviewers=$(gh api repos/<owner>/<repo>/collaborators --jq '.[].login' | grep -v "^${pr_author}$" | paste -sd, -)
default_branch=$(git remote show origin | grep "HEAD branch" | awk '{print $NF}')
gh pr create --title "<title>" --body "Fixes #<issue_number>. See docs/issue-fixes/<repo>-<issue_number>-spec.md for the fix spec." --base "$default_branch" --reviewer "$reviewers"

If the collaborators call fails or returns nothing (permissions, rate limit): still run gh pr create without --reviewer, and tell the user reviewers weren't auto-assigned — do not block PR creation on this. The same fallback applies if gh pr create itself fails because of a bad/rejected reviewer list (GitHub rejects requesting review from the PR's own author with a 422) — still create the PR, note reviewers weren't auto-assigned, don't block.

Report the PR URL (printed by gh pr create) as the final output of this skill. Gate 2 — human review — now happens on GitHub; this skill's job is done.

Error handling

SituationBehavior
Uncommitted changes in $repo_dir before syncStop, ask — never auto-stash or discard
Issue URL doesn't parse, or repo not found and user declines the cloneStop, ask
Multiple local repos match the same remoteStop, ask the user to disambiguate
Issue no longer reproduces (Step 4)Stop after Step 4, report, no spec/code/PR
User requests spec changes at Gate 1 (Step 6)Revise spec, re-present; loop until approved or aborted
Test suite fails after implementation (Step 7)Stop before Step 8, report failure, ask how to proceed
Collaborator lookup fails or is empty (Step 8)Open the PR anyway; note reviewers weren't auto-assigned

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.