/poka-yoke:retrofrom Poka-Yoke
Root-causes bugs, outages, or repeated mistakes to the missing constraint that made them possible, then sweeps all other sites where the same mistake could occur. Use for postmortems or when something already broke.
Ships in Poka-Yoke. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A defect got out. The fix for the defect is the easy part and is usually already done or obvious. This mode is about the harder and more valuable question: what made the mistake available, and what device removes it for good?
Shingo's framing is the whole method here. Do not ask why the person erred, people err, that is a constant. Ask why the process permitted the error to become a defect, and what would have physically stopped it.
People conflate these, and conflating them is why incidents repeat.
charge() again without an idempotency key."charge() accepts an optional idempotency key and succeeds without one."Fixing the defect ships today. Fixing the mistake helps one code path. Only fixing the hazard prevents recurrence, and the hazard is almost always a missing constraint, not a missing piece of knowledge.
Write all three out explicitly before proposing anything. If you cannot state the hazard as a property of the system, you have not found it yet.
Run the whys, with one discipline: an acceptable terminal answer is a missing constraint, never a missing human quality. If a chain ends in "they forgot," "they didn't know," "they were rushing," or "it wasn't documented," you stopped one step early, keep going and ask why forgetting was possible, why the knowledge was needed at all, why the system accepted the result.
Double charge → retry called
charge()twice → the retry path didn't pass an idempotency key → the key is an optional parameter → why is it optional? → it was added later and made optional to avoid breaking callers → there is no compile-time or database-level requirement that a charge be idempotent.
That last line is the hazard, and it is fixable: make the parameter required, or add a unique
constraint on (account_id, idempotency_key). Compare it to "the engineer should have passed
the key," which is fixable only by hiring different humans.
Also ask the escape question separately: what should have caught this and didn't? Usually there was a device: a test, a review, a type, and it was absent, disabled, or too weak. That gap is a second finding in its own right.
A poka-yoke that fixes one call site is not a poka-yoke. Before proposing anything, find every other place the same mistake is still available. This is almost always where the real value of a retro sits, and it is the step people omit under time pressure.
Search by the shape of the hazard, not by the text of the bug:
python3 ../../scripts/detect_hazards.py --paths <repo> --id <hazard-id>: the ID is the
one printed with each finding, to catch instances you would not have thought to grep for.Report the count plainly: "the same hazard exists at 6 other call sites" changes the conversation about how much the fix is worth.
Now propose, using the ladder from the router skill. For an incident that already cost something real, push hard for Control: you have the strongest evidence you will ever have that this mistake happens.
| Rung | For this incident, that would mean |
|---|---|
| Control | Required parameter · database unique constraint · type that cannot represent the bad state · CI check that cannot be merged past |
| Warning | Lint rule · runtime assertion · alert at the moment of the action |
| Detection | Regression test · monitor · reconciliation job |
| None | "Added a note to the runbook" · "reminded the team" · "added a review checklist item" |
A regression test is genuinely valuable and you should write one. It proves the fix and stops this exact path regressing. But be honest that it is rung 3: it catches the mistake after someone makes it, and only on the path you thought of. If the retro produces only a test, say so, and say what a Control-rung device would have required.
Beware the fix that is really rung zero wearing a costume: more documentation, a new checklist item, a Slack reminder, a training session, an extra required reviewer. These feel like action and change nothing. If that is genuinely all that is possible, name it as an accepted risk rather than a resolution.
# Retro · <short title> · <YYYY-MM-DD>
**Defect**: <what was experienced, with blast radius: how many, how much, how long>
**Mistake**: <the specific action taken>
**Hazard**: <the system property that made it possible and quiet>
## Why it was possible
<the chain, ending at a missing constraint>
## Why nothing caught it
<the device that should have existed, was disabled, or was too weak>
## Class sweep
<n other sites where this mistake is still available, list them>
## Devices
| Device | Rung | Covers | Status |
|---|---|---|---|
| <change> | Control | all N sites | proposed |
| <regression test> | Detection | the original path | done |
## Accepted risk
<what remains possible, and why that is acceptable>
Save to docs/poka-yoke/retro-YYYY-MM-DD-<slug>.md, and put a poka-yoke: marker comment at each
installed device naming the mistake it prevents. That is what stops a future engineer
removing it as dead weight, since by then it will never have fired. See the recording section
in audit; do not ask anyone to hand-maintain a registry file.
Prove the fix. Reproduce the original mistake against the new device and show it being refused, then show the correct path still working. A device that was never observed to fire is a belief, not a control, and after an incident, a false sense of protection is the most expensive thing you can ship.
Write about the system, never the person. Not because it is polite, but because it is more accurate and it is the only version that produces a fix: "the engineer should have been more careful" has no implementation. Shingo's argument was that blaming the operator is precisely how organizations avoid improving the process. Names belong in the timeline if at all; the analysis is about affordances.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub rainmanjam/poka-yoke --plugin poka-yoke11 skills in this plugin
/agent-guardrailsStop an AI agent damaging your repo: PreToolUse hooks, permission deny rules, protected paths, verification gates. Use when "claude keeps force pushing", "CLAUDE.md says X but it still does Y", "stop the agent touching prod or .env", or making a repo safe for unattended agent work. For AI features you ship to users use llm./auditFind footguns in code that already exists: swappable arguments, silent fallbacks, unguarded deletes, signatures that are easy to misuse. Use when someone asks "what could bite us here", "what is easy to misuse", "poka-yoke this repo", or wants a diff or PR reviewed for ways to get it wrong. Ranks by blast radius. For code not yet written use design; for something that already broke use retro./authzMulti-tenant isolation, IDOR and row-level security. Use to find every path where one tenant could read or write another tenant data: "we forgot to filter by org_id", "can users see each other data", "audit these endpoints for cross-tenant leaks", "make an unscoped query impossible". Covers scoped repositories, RLS, default-deny routing and the two-tenant test. For what the UI shows use ux./dataPipelines, warehouses, dbt models and metrics, where failure is silently wrong numbers rather than a crash. Use when "the dashboard is wrong", "the numbers do not match", "add data quality checks", "safe backfill", or an upstream schema change broke a join. Covers freshness, row-count and null-rate assertions, data contracts, reconciliation. For a crash rather than wrong numbers use audit./designDesign APIs, schemas, types and state machines so misuse cannot be expressed. Use when writing a new interface and someone asks "what should the types look like", "make invalid states unrepresentable", "so callers cannot screw it up", or wants illegal state transitions rejected. Covers branded types, discriminated unions, typestate, parse-don't-validate. For code that already exists use audit./guardrailsPre-commit hooks, CI gates, lint rules, database constraints and branch protection. Use when a rule needs enforcing rather than documenting: "set up enforcement", "unformatted or untyped code must not get merged", "gate this in CI", "we agreed to X and people still do not", "stop secrets getting committed". Covers baselining and ratcheting so existing violations do not block anyone. For constraining an AI agent use agent-guardrails.Other plugins' skills for the same job