agentleFS
kuya-eggkuya-egg/Monozukuri/poka-yoke/SKILL.md

poka-yoke

Skill11 starsChanged 2 months agoMITView on GitHub

Prevent software mistakes through strong boundaries, safe defaults, meaningful tests, and mechanically enforced invariants. Use for TDD, validation, schemas, authorization, edge cases, regression coverage, or reliability-sensitive behavior.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. github/awesome-copilot★ 41ksame name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository13 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 9 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Prefer domain types, validated constructors, enums, non-null constraints, foreign keys, unique constraints, transactional boundaries, …

    line 45
  2. Distinctive:

    Write the smallest meaningful test for the desired behavior or regression.

    line 52
  3. Distinctive:

    Use a narrow check first, then broaden to integration, contract, end-to-end, type, lint, migration, build, or smoke checks according to …

    line 59
  4. Distinctive:

    Do not add defensive branches for impossible or irrelevant states without a reason.

    line 79
  5. Distinctive:

    Do not duplicate validation everywhere when one authoritative boundary owns the invariant.

    line 81
  6. Distinctive:

    Do not make a test green by weakening its assertion.

    line 83
  7. Distinctive:

    Do not use mocks to hide an integration contract that needs verification.

    line 84
  8. Distinctive:

    Do not trade clarity for clever type machinery when a simple check is safer.

    line 85
  9. Distinctive:

    If a referenced skill is not installed, apply its named lens inline instead of trying to invoke it.

    line 93

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Poka-yoke

Poka-yoke means mistake-proofing. In software, do not rely only on memory or discipline when types, schemas, constraints, validation, tests, or safe defaults can prevent an invalid state. This is a Japanese-inspired engineering metaphor, applied with context rather than maximal defensive code.

Use this skill when

  • adding or changing behavior at an input, API, database, or permission boundary;
  • designing tests or working test-first;
  • fixing a regression or recurring failure;
  • handling untrusted data, retries, concurrency, migrations, or external services;
  • deciding whether a bad state should be representable; or
  • reliability and safety matter more than a happy-path demo.

Outcome

Produce a behavior that is difficult to misuse and easy to verify, with:

  • explicit invariants and boundary conditions;
  • validation at the correct boundary;
  • types, schemas, constraints, or exhaustive cases where they reduce risk;
  • deterministic tests for normal, edge, failure, and authorization behavior;
  • safe defaults, idempotency, and clear error handling where relevant; and
  • evidence that the protection catches the intended mistake.

Workflow

1. Enumerate failure modes

List realistic invalid inputs, missing data, duplicate requests, retries, partial failures, unauthorized actions, stale state, malformed dependencies, and boundary conditions. Prioritize by impact and likelihood.

2. Make invalid states hard to express

Prefer domain types, validated constructors, enums, non-null constraints, foreign keys, unique constraints, transactional boundaries, permission checks, and safe defaults when they encode a real invariant. Keep validation close to the boundary that owns the rule.

3. Test behavior, not implementation

Write the smallest meaningful test for the desired behavior or regression. Cover important edge and failure paths. Assert user-visible outcomes, contracts, persisted state, and security decisions rather than private call counts or incidental structure.

4. Run the feedback loop

Use a narrow check first, then broaden to integration, contract, end-to-end, type, lint, migration, build, or smoke checks according to risk. Keep tests deterministic and explain any unrun check.

5. Make failure actionable

Return errors that identify the boundary and next action without leaking secrets. Do not silently coerce, retry forever, discard data, or convert a failed invariant into a successful-looking result.

Evidence standard

Each guardrail must correspond to a realistic failure mode. Each test must fail for the defect it protects against and pass for the intended behavior. Verification claims must be traceable to an executed command, observed result, or authoritative evidence. Coverage percentage alone is not evidence of mistake-proofing.

Boundaries

  • Do not add defensive branches for impossible or irrelevant states without a reason.
  • Do not duplicate validation everywhere when one authoritative boundary owns the invariant.
  • Do not make a test green by weakening its assertion.
  • Do not use mocks to hide an integration contract that needs verification.
  • Do not trade clarity for clever type machinery when a simple check is safer.

Handoff

Report the failure modes considered, protections added, tests run, and residual risk. Use jidoka when a check fails, kodawari for a quality review, or andon when the remaining risk needs operational visibility.

If a referenced skill is not installed, apply its named lens inline instead of trying to invoke it.

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.