Find and fix the following issue:
Problem: $ARGUMENTS
Mode
Check $ARGUMENTS for --fast. Strip it before parsing the problem description.
- Default: careful debug-fix. Use when you have time to do this right.
- --fast: emergency hotfix. Use when production is broken and shipping speed matters more than thoroughness. Triggers a
hotfix/* branch from production, minimal-change discipline, critical-tests-only verification, and ships a [HOTFIX] PR. Before committing to fast mode, briefly confirm with the user that this is genuinely emergency-grade. If not, suggest dropping --fast.
Step 1: Understand
- Issue number:
gh issue view $ARGUMENTS (or the project's issue tracker).
- Error or stack trace: parse it for file, line, error type, and call chain.
- Description: identify expected vs actual.
- URL or screenshot: examine the referenced resource.
If unclear, ask clarifying questions before proceeding.
Step 2: Hotfix branch (--fast only)
In --fast mode only:
- Detect the production branch:
git symbolic-ref refs/remotes/origin/HEAD or git remote show origin.
- Stash uncommitted work if needed.
- Create and switch to
hotfix/<short-description> branched from production.
- ASK the user to confirm the branch name first.
In default mode, skip this. Branch creation happens in Step 7.
Step 3: Reproduce (default only)
In --fast mode, skip this step. Trust the report and move to Step 5.
- Find the simplest way to trigger the issue (a test, curl, script).
- Confirm you can reproduce reliably.
- If you can't reproduce:
- Environment-specific? Check env vars, OS, runtime version, database state.
- Intermittent? Likely a race condition. Look for shared mutable state, timing dependencies, async ordering assumptions.
- Already fixed?
git log for recent commits mentioning the issue.
Step 4: Investigate (default only)
In --fast mode, skip this and go to Step 5. Trust the report and minimize investigation depth.
Don't skip ahead to guessing:
- Locate the symptom. Which file and line produces the wrong output?
- Read the code path backwards. What called this? What data was passed?
- Check git history:
git log --oneline -20 -- <file>, git log --all --grep="<keyword>".
- Narrow scope with
git bisect or targeted grep.
- Form a hypothesis: "X is wrong because Y."
- Verify the hypothesis with a targeted log or assertion.
- If wrong, trace a different path. Don't keep guessing the same hypothesis.
Step 5: Fix
- Make the smallest correct change.
- Don't patch symptoms. Trace back to where bad data originates and fix it there.
- Don't refactor surrounding code while fixing.
- Don't add defensive checks that mask the problem.
In --fast mode specifically:
- If the fix needs more than ~50 lines changed, warn the user. This may not actually be a hotfix.
- Do NOT add features, change formatting, clean up unrelated issues, or add non-essential comments.
Step 6: Verify
Default:
- Write a test that reproduces the bug and now passes.
- Run related tests for regressions.
- Run lint and typecheck.
- Temporarily revert your fix and confirm the new test fails (proves the test catches the bug).
--fast:
- Run only tests directly relevant to the changed code, not the full suite.
- Run the build.
- If you can reproduce the original error, verify it's fixed.
- ASK the user if they want extra verification before shipping.
Step 7: Wrap up or ship
Default:
- Create a branch if not already on one.
- Stage only the fix and test files.
- Commit:
fix: <what was wrong and why> (#number).
--fast:
- Stage only the fix files (never secrets, locks, or build output).
- Draft commit:
hotfix: <short description>. ASK the user to confirm.
- Push:
git push -u origin hotfix/<description>.
- Create a PR targeting production:
- Title:
[HOTFIX] <description>.
- Body: what broke, what caused it, what this fixes.
- Try to add the
hotfix label: gh pr create ... --label hotfix. Fall back to no label on failure.
- Show the PR URL.
Rules
- NEVER skip confirmation steps in
--fast mode (branch name, commit message, push).
- NEVER force-push.
- NEVER commit secrets or unrelated changes.
- If the user says "skip" at any step, skip and move on.
- In
--fast mode specifically: if the fix turns out to be complex, tell the user and suggest dropping --fast to use the careful path.
1---2name: debug-fix3description: Find and fix a bug. Default is careful (reproduce, investigate, test). Add `--fast` for emergency production mode (hotfix branch, minimal change, ship a PR fast).4---56Find and fix the following issue:78**Problem**: $ARGUMENTS910## Mode1112Check $ARGUMENTS for `--fast`. Strip it before parsing the problem description.1314- **Default**: careful debug-fix. Use when you have time to do this right.15- **--fast**: emergency hotfix. Use when production is broken and shipping speed matters more than thoroughness. Triggers a `hotfix/*` branch from production, minimal-change discipline, critical-tests-only verification, and ships a `[HOTFIX]` PR. Before committing to fast mode, briefly confirm with the user that this is genuinely emergency-grade. If not, suggest dropping `--fast`.1617## Step 1: Understand1819- Issue number: `gh issue view $ARGUMENTS` (or the project's issue tracker).20- Error or stack trace: parse it for file, line, error type, and call chain.21- Description: identify expected vs actual.22- URL or screenshot: examine the referenced resource.2324If unclear, ask clarifying questions before proceeding.2526## Step 2: Hotfix branch (--fast only)2728In `--fast` mode only:2930- Detect the production branch: `git symbolic-ref refs/remotes/origin/HEAD` or `git remote show origin`.31- Stash uncommitted work if needed.32- Create and switch to `hotfix/<short-description>` branched from production.33- **ASK** the user to confirm the branch name first.3435In default mode, skip this. Branch creation happens in Step 7.3637## Step 3: Reproduce (default only)3839In `--fast` mode, skip this step. Trust the report and move to Step 5.4041- Find the simplest way to trigger the issue (a test, curl, script).42- Confirm you can reproduce reliably.43- If you can't reproduce:44 - **Environment-specific?** Check env vars, OS, runtime version, database state.45 - **Intermittent?** Likely a race condition. Look for shared mutable state, timing dependencies, async ordering assumptions.46 - **Already fixed?** `git log` for recent commits mentioning the issue.4748## Step 4: Investigate (default only)4950In `--fast` mode, skip this and go to Step 5. Trust the report and minimize investigation depth.5152Don't skip ahead to guessing:53541. Locate the symptom. Which file and line produces the wrong output?552. Read the code path backwards. What called this? What data was passed?563. Check git history: `git log --oneline -20 -- <file>`, `git log --all --grep="<keyword>"`.574. Narrow scope with `git bisect` or targeted grep.585. Form a hypothesis: "X is wrong because Y."596. Verify the hypothesis with a targeted log or assertion.607. If wrong, trace a different path. Don't keep guessing the same hypothesis.6162## Step 5: Fix6364- Make the smallest correct change.65- Don't patch symptoms. Trace back to where bad data originates and fix it there.66- Don't refactor surrounding code while fixing.67- Don't add defensive checks that mask the problem.6869In `--fast` mode specifically:70- If the fix needs more than ~50 lines changed, warn the user. This may not actually be a hotfix.71- Do NOT add features, change formatting, clean up unrelated issues, or add non-essential comments.7273## Step 6: Verify7475**Default**:76- Write a test that reproduces the bug and now passes.77- Run related tests for regressions.78- Run lint and typecheck.79- Temporarily revert your fix and confirm the new test fails (proves the test catches the bug).8081**--fast**:82- Run only tests directly relevant to the changed code, not the full suite.83- Run the build.84- If you can reproduce the original error, verify it's fixed.85- **ASK** the user if they want extra verification before shipping.8687## Step 7: Wrap up or ship8889**Default**:90- Create a branch if not already on one.91- Stage only the fix and test files.92- Commit: `fix: <what was wrong and why> (#number)`.9394**--fast**:95- Stage only the fix files (never secrets, locks, or build output).96- Draft commit: `hotfix: <short description>`. **ASK** the user to confirm.97- Push: `git push -u origin hotfix/<description>`.98- Create a PR targeting production:99 - Title: `[HOTFIX] <description>`.100 - Body: what broke, what caused it, what this fixes.101 - Try to add the `hotfix` label: `gh pr create ... --label hotfix`. Fall back to no label on failure.102- Show the PR URL.103104## Rules105106- NEVER skip confirmation steps in `--fast` mode (branch name, commit message, push).107- NEVER force-push.108- NEVER commit secrets or unrelated changes.109- If the user says "skip" at any step, skip and move on.110- In `--fast` mode specifically: if the fix turns out to be complex, tell the user and suggest dropping `--fast` to use the careful path.