Use when anything misbehaves - a failing test, a production bug, a build break, flaky or unexpected behavior - before proposing or attempting any fix. Especi...
---
name: refire
description: Use when anything misbehaves - a failing test, a production bug, a build break, flaky or unexpected behavior - before proposing or attempting any fix. Especially under pressure ("CI is blocking everyone", "just get it green") and after a previous fix didn't hold.
---
# refire
A plate comes back to the kitchen. The line's instinct is to fire the same dish again, faster; the chef's job is to find out why it came back first, because a refire of the same mistake comes back twice and now the diner is angrier. This skill is the chef's version of debugging: no fix until the cause of the sendback is known.
**Core principle:** no fixes without root cause first. A fix that makes the symptom disappear without explaining it is not a fix, it is a scheduled second incident. **Violating the letter of this process is violating its spirit.**
## Find out why it came back
Before any fix, in order:
1. **Read the error, all of it.** The full traceback, the line numbers, the actual message. It frequently names the cause outright.
2. **Reproduce it.** Trigger it reliably with the smallest input you can. Cannot reproduce? Gather more evidence; do not guess.
3. **Check what changed.** `git log` and `git diff` around when it broke: recent commits, new dependencies, config or environment drift. Most bugs are young.
4. **Check the documented contract.** Schema docs, interface comments, the spec. The difference between the documented behavior and the actual behavior usually points straight at the cause, and the fix must satisfy the contract, not just the failing test.
5. **Trace to the source.** Where does the bad value originate? Who called this with it? Walk up the stack until the origin; the fix lands there, not at the crash site. In a multi-component system, instrument each boundary (what enters, what exits) and run once to see which layer breaks, rather than theorizing across all of them.
6. **Compare against what works.** Find the nearest working sibling (same pattern, same codebase) and list every difference, including the ones that "can't matter".
## Then fix it, once
1. **State the hypothesis.** "X is the root cause because Y", written, specific. If you cannot finish that sentence, return to investigation; do not pretend.
2. **Pin it with a failing test first.** The test reproduces the bug and asserts the violated contract, not just the absence of the crash. This is [taste](../taste/SKILL.md)'s loop applied to a bug; a fix without a test that failed is a fix that cannot prove itself and a regression nobody will catch.
3. **One minimal change.** Test the hypothesis with the smallest change that fixes the cause. One variable. No bundled cleanups, no "while I'm here".
4. **Verify and read the output.** The pinned test passes, the whole suite stays green, the original symptom is actually gone.
If the fix did not work: stop, do not stack a second fix on top. New evidence, new hypothesis, back to investigation. **After three failed fixes, stop fixing entirely**: three misses on one bug means the architecture or the pattern is wrong, and that conversation happens with the user before attempt four.
## Rationalizations, all of them wrong
| Excuse | Reality |
|--------|---------|
| "Quick fix now, investigate later" | Later never comes; the mask becomes load-bearing. |
| "CI is blocking everyone, no time for process" | Investigation on a reproduced bug takes minutes. Thrashing takes hours and ships masks. |
| "Just try X and see" | Guess-and-check is how one bug becomes three. |
| "It's probably X" | Probably is not a hypothesis with a because. |
| "The test passes now, ship it" | Green that you cannot explain is the most dangerous color. |
| "Several candidate fixes at once, to be safe" | Now you cannot tell which one worked or what the others broke. |
| "Too simple to need the process" | Simple bugs have causes too, and the process is fast on them. |
| "One more attempt" (after two failures) | Third miss means the question is wrong, not the answer. |
## Red flags - stop and return to investigation
Proposing fixes before reproducing. A fix at the crash site when the bad value came from upstream. Catching-and-ignoring, widening a timeout, or `default=`-ing an error away to get green. A fix with no new failing test attached. Explaining the fix without being able to explain the bug. Any sentence starting "I don't fully understand it, but this works".
## Common mistakes
- Silencing the symptom (swallow the exception, loosen the assertion, skip the test) and calling CI green a fix.
- Fixing the right cause but skipping the pinning test, so the contract that broke still has no guard and the next regression sails through.
- Never opening the docs or schema, so the "fix" satisfies the failing test while quietly violating the documented contract.
- Stacking fix on fix without reverting the misses, then being unable to say which change did what.
- Treating a correct guess as a validated hypothesis. Luck is not process; it just hasn't cost you yet.
- Skipping the "what changed recently" check and reverse-engineering from first principles what `git log` would have said in ten seconds.
don't have the plugin yet? install it then click "run inline in claude" again.
restructured original into implexa's six-part format, added explicit inputs (git access, docs, logs), decision points for intermittent failures and stacked fixes, output contract with test and diff as artifacts, outcome signal with verification checklist, preserved core principle and rationalizations table.
a plate comes back to the kitchen. the line's instinct is to fire the same dish again, faster. the chef's job is to find out why it came back first, because a refire of the same mistake comes back twice and now the diner is angrier. this skill is the chef's version of debugging: no fix until the cause of the sendback is known.
core principle: no fixes without root cause first. a fix that makes the symptom disappear without explaining it is not a fix, it is a scheduled second incident. violating the letter of this process is violating its spirit.
use this skill when anything misbehaves: failing test, production bug, build break, flaky or unexpected behavior. deploy it before proposing or attempting any fix, especially under pressure ("ci is blocking everyone", "just get it green") and after a previous fix didn't hold. the goal is to identify the actual root cause, pin it with a failing test, and apply one minimal change that fixes the cause, not just the symptom. the process is faster than thrashing; investigation on a reproduced bug takes minutes. guessing takes hours and ships masks.
git log and git diff on recent commitsno external connections or credentials required. this skill is pure investigation and code review.
read the error completely. capture the full traceback, line numbers, actual message. download or screenshot it. the cause is frequently named outright. if the error is truncated or redacted, get the unredacted version.
reproduce it reliably. trigger the failure with the smallest input you can. use the minimal test case, minimal data, minimal config. if you cannot reproduce it, gather more evidence (logs, stats, timing conditions, concurrency patterns). do not guess.
check what changed recently. run git log --oneline -20 and git diff on the affected files. focus on commits that touched the broken code path. check for new dependencies, version bumps, config or environment drift. most bugs are young.
check the documented contract. read schema docs, interface comments, function signatures, the spec. the difference between documented behavior and actual behavior usually points to the cause. note: the fix must satisfy the contract, not just the failing test.
trace to the source. where does the bad value originate? who called this with it? walk up the stack until you find the source. the fix lands there, not at the crash site. in multi-component systems, instrument each boundary (what enters, what exits) and run once to see which layer breaks, rather than theorizing.
compare against what works. find the nearest working sibling: same pattern, same codebase, different input or config. list every difference, including the ones that "can't matter".
state the hypothesis in writing. "X is the root cause because Y." specific. if you cannot finish that sentence, go back to phase 1. do not pretend.
pin it with a failing test first. write a test that reproduces the bug and asserts the violated contract, not just the absence of a crash. this test must fail before your fix and pass after. this is the guard that catches the next regression.
apply one minimal change. test the hypothesis with the smallest change that fixes the cause. one variable, one line, one condition. no bundled cleanups, no "while I'm here" refactors.
verify and read the output. the pinned test passes. the whole suite stays green. the original symptom is gone. actually run it, actually read the logs or output.
if the fix did not work: stop. do not stack a second fix on top. new evidence, new hypothesis, back to phase 1. after three failed fixes, stop fixing entirely. three misses on one bug means the architecture or pattern is wrong, and that conversation happens before attempt four.
if you cannot reproduce it: gather more evidence. check production logs, monitoring dashboards, network traces, timing conditions. confirm the failure rate, the specific input, the environment state. only proceed to fix if you can trigger it locally or you have detailed logs that name the cause.
if the error is intermittent or flaky: do not guess. add logging or instrumentation to narrow the timing window, the concurrency pattern, or the race condition. reproduce it multiple times before forming a hypothesis. check if it is environment-specific (one region, one database state, one cache state).
if you have a candidate fix but the test still fails: your hypothesis was wrong or incomplete. do not apply a second fix on top. revert, gather new evidence, return to phase 1.
if you have applied three fixes and the test still fails: stop. the problem is not a simple bug. it may be an architecture issue, a design pattern that is broken, or a misunderstanding of the contract. escalate to the user or team owner before attempting a fourth fix.
if the crash site is not the source: you found where it breaks, not where it started. continue tracing upstream (who called this function with that value). the fix goes at the source, not at the symptom.
if the fix makes the test pass but you cannot explain the bug: you got lucky. this is the most dangerous state. revert, return to phase 1, build understanding before shipping. luck is not process and it just hasn't cost you yet.
if production-only or staging-only: cannot ship a fix without reproducing it in your test environment or on a staging replica. if you cannot reproduce it, you cannot confidently fix it. add the missing test environment condition or log output, get reproducibility first.
success is a state, not a document. but you can verify it by:
git diff shows one minimal edit. no bundled refactors. no stacked fixes.store the output in the same repo and branch where the bug occurred. the test lives in the suite. the fix lives in the code.
you know it worked when:
opposite outcome: you ship a fix without understanding the bug, and the same symptom appears again in two weeks on a different input. or you apply three fixes and the test still fails and you run out of guesses. or you explain the fix but cannot explain the bug. those are all stops. revert, gather new evidence, go again.