poka-yoke
Ce qu’il fait
Le poka-yoke est une technique de conception de systèmes (comme du code informatique) qui rend les erreurs impossibles. Au lieu d'avertir d'une erreur, il l'empêche de se produire.
Quand l’utiliser
- ✓Lors de la conception d'une nouvelle interface ou d'un nouveau système.
- ✓Lors de la relecture d'un ancien code pour repérer les points de défaillance.
- ✓Lorsque vous voulez éviter que les utilisateurs placent le système dans un état invalide.
Lien du skill
https://github.com/github/awesome-copilot/blob/main/skills/poka-yoke/SKILL.mdCopiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.
Comment l’utiliser
Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.
Message prêt à coller
Pour Claude Code, Codex ou Cursor : lancez-la dans le dossier du projet et le skill est installé.
Téléchargez le SKILL.md et placez-le dans le dossier de skills de votre agent.
Exemple de demande à votre IA
“Comment faire en sorte que ce formulaire ne puisse pas être envoyé s'il manque des informations ?”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
Il fonctionne en créant des règles ou des structures qui empêchent physiquement les actions incorrectes. Pensez à un câble USB qui ne se branche que dans un sens : impossible de se tromper.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis GitHub.
Poka-Yoke: Make the Mistake Unsayable
People will always make mistakes. That is not the problem worth solving. The problem is letting a mistake become a defect.
Shigeo Shingo, a Japanese industrial engineer, worked this out on a switch assembly line in 1961. Workers kept forgetting a spring. The fix was not a reminder: the job was split so the worker first laid both springs in a dish, then fitted them from the dish. A spring left over was the error announcing itself, before the unit could move on.
The dish is a device. "Please remember the spring" is not.
The line that does most of the work
A comment, a docstring, a wiki page, a review checklist, or a line in an instructions file saying "don't do X" is not a poka-yoke. It is training, and training degrades. A device does not. If your fix relies on someone remembering something, keep going.
This applies to your own instructions too. A rule written into a config file competes for attention with every other rule there and loses a little more as the file grows. A check that fails the build does not.
What this changes about the output
Given a design, models will readily list what to fix. They rarely state what the fix makes impossible, and that is the difference between advice you agree with and a constraint you can rely on. That habit is most of what this skill is for.
The other half is refusing to accept a non-device as a fix. "Add validation", "be careful with this function", "document the invariant" are all rung zero. Each has a real device behind it, and naming that device is the work.
Axis 1: what happens when the mistake occurs
Rank every finding on this ladder, and say which rung the current code sits on and which rung your fix reaches.
| Rung | Name | Meaning |
|---|---|---|
| 1 | Control | The wrong action cannot be performed. Type error, database constraint, missing permission. |
| 2 | Warning | It is possible, but announces itself as it happens. A linter, a runtime assertion, a confirmation you cannot skip. |
| 3 | Detection | It happens, and you find out afterwards. Tests, logging, monitoring, code review. |
| 0 | rung zero | Telling people to be careful. Docs, comments, "please remember to". |
Detection is not failure; sometimes it is all that is available. But a plan that stops at Detection should say so, rather than presenting it as prevention.
Axis 2: how the device notices
Shingo's three inspection lenses. They are a checklist for finding hazards, not decoration:
- Contact — can the wrong thing physically fit? Two adjacent parameters of the same type can be swapped silently. A
stringthat should be one of four values. Money as a float. - Fixed-value — is the set complete? A switch with no exhaustiveness check. A config where a missing key silently means "off". An enum handled in three of five places.
- Motion-step — is the order right, and did every step happen? A two-phase write with no transaction. A retry with no idempotency key. A resource acquired on one path and released on another.
Inspect at the source
The cheapest place to catch a mistake is where it is made, not where it surfaces. A validation that runs three layers below the input has already let the bad value travel, and the stack trace will point at the wrong module. Push the check to the boundary the value crosses.
Designing something new
Mistake-proofing is cheapest before the code has callers. Once it has them, every device is a migration; before it has them, a device is free.
Work from the call site. A signature that reads fine in isolation often reads terribly where it is used:
# the mistake is expressible: nothing stops refunding an order that was never paid
def refund(order: dict) -> Refund:
return payments.refund(order["payment_id"])
# the mistake is no longer expressible
def refund(order: PaidOrder) -> Refund: ...
The moves, roughly in order of how often they apply:
Make invalid states unrepresentable. A bag of optional fields where only certain combinations are legal becomes a discriminated union where the illegal ones cannot be constructed.
Parse, don't validate. Convert unstructured input into a type that carries proof at the boundary, once, rather than re-checking the same string in nine places.
Distinguish concepts that share a primitive. transfer(from: str, to: str) accepts its
…
Questions fréquentes
Quelle est la différence entre un avertissement et un poka-yoke ?
Un avertissement dit « attention, cela risque de mal tourner ». Un poka-yoke vous empêche physiquement de faire une erreur, comme un câble qui ne rentre que dans un sens.
Pourquoi est-il préférable d'empêcher les erreurs plutôt que de les signaler ?
Les gens oublient ou ignorent les avertissements. Un système à l'épreuve des erreurs garantit que l'erreur ne se produit pas, quelle que soit l'attention de la personne.
Cela ne concerne-t-il que le code informatique ?
Non, l'idée vient à l'origine de l'ingénierie industrielle, pour éviter les erreurs de fabrication. Mais le concept s'applique à tout système où des erreurs peuvent survenir.
Détails
Description originale de l’auteur
Mistake-proof code so misuse cannot be expressed, rather than warning against it. Use when designing an interface, schema, or state machine and the user wants it hard to get wrong ("make invalid states unrepresentable", "so callers cannot screw it up", "type-safe API", "pit of success"); when auditing existing code for footguns ("what could bite us here", "what is easy to misuse", "poka-yoke this
repo: github/awesome-copilot
Popularité
- Étoiles GitHub
- 40k
- Position au classement
- #7330
- Licence
- MIT
- Mis à jour
- 15/10/2026
Commentaires
- …
Autres skills de ce dépôt
acquire-codebase-knowledge
40kAide votre agent à comprendre et documenter un projet de code existant. Utile pour accueillir de nouveaux membres ou obtenir une vue d'ensemble de l'architecture.
acreadiness-assess
40kPermet à votre agent d'évaluer la préparation d'un projet à l'IA et de générer un rapport. Utile pour savoir dans quelle mesure un projet est prêt à utiliser des outils d'IA.
acreadiness-generate-instructions
40kAide votre agent à rédiger des instructions pour les outils d'IA à partir d'une évaluation, afin d'améliorer leur travail sur le code et combler les lacunes.
acreadiness-policy
40kPermet à votre agent d'aider à définir ou appliquer des politiques d'évaluation des projets d'IA. Utile pour standardiser les évaluations et garantir la conformité.
Skills similaires
diffs
394kPermet à votre agent de produire un diff réel et partageable de vos modifications, sous forme de lien ou d'image, plutôt qu'un résumé écrit à la main.
coding-agent
394kAide votre agent à confier une tâche de programmation plus importante à Codex, Claude Code ou OpenCode comme travailleur en arrière-plan, puis à suivre sa progression.
gh-issues
394kAide votre agent à trouver des tickets GitHub, choisir ceux à traiter et ouvrir des pull requests avec des correctifs, y compris le suivi des commentaires de relecture.