Langsung ke konten
Skillpedia
Pemrograman umum48k ยท #5461

poka-yoke

Fungsinya

Poka-yoke adalah teknik untuk membuat proses atau kode anti-salah. Alih-alih mengandalkan orang untuk selalu ingat melakukan semuanya dengan benar, sistemnya dirancang sedemikian rupa sehingga kesalahan menjadi tidak mungkin terjadi atau langsung terlihat.

Kapan dipakai

  • โœ“Saat Anda ingin mencegah kesalahan terjadi dalam sebuah proses atau kode.
  • โœ“Saat merancang sistem yang kesalahannya bisa berakibat serius (uang, data penting).
  • โœ“Setelah terjadi kesalahan yang berulang, untuk memastikan hal itu tidak terulang lagi.

Link skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/poka-yoke/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/poka-yoke/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œBagaimana cara membuat formulir pendaftaran ini anti-salah agar pengguna tidak bisa mengirimkan informasi yang tidak valid?โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Poka-yoke bekerja dengan membuat 'perangkat' yang mencegah kesalahan. Perangkat ini bisa berupa tipe data tertentu, aturan yang tidak mengizinkan proses dilanjutkan jika ada yang salah, atau peringatan yang jelas tepat pada saat kesalahan terjadi.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Poka-Yoke: Mistake-Proofing for Software

Shigeo Shingo's insight, from the Toyota Production System: people will always make mistakes; that is not the problem worth solving. The problem is letting a mistake become a defect. So you stop trying to make humans more careful and start redesigning the work so the mistake either cannot physically happen or announces itself immediately.

A poka-yoke ("poh-kah yoh-kay", ใƒใ‚ซใƒจใ‚ฑ) is a device: a jig, a shape, a counter: not an instruction. In software: a type, a constraint, a hook, a schema, a state machine. The single most important consequence:

A comment, a docstring, a wiki page, a code review checklist, or a line in CLAUDE.md saying "don't do X" is not a poka-yoke. It is training. Training degrades. A device does not. If your proposed fix relies on someone remembering something, keep going.

When to Use This Skill

  • Use when the user says "poka-yoke this", "mistake-proof it", or "make this harder to get wrong".
  • Use when designing an interface, schema or state machine and the ask is "make invalid states unrepresentable" or "so callers cannot screw it up".
  • Use when auditing existing code for footguns: "what could bite us here", "what is easy to misuse".
  • Use after an incident, when the fix must close the class rather than the case: "make sure this never happens again", "this is the third time".
  • Especially for money, auth, permissions, deletion, migrations and pipelines, where failure is silent.

The two axes

Every real poka-yoke answers two questions. Use both when you classify a hazard or propose a device. They are the difference between this method and generic code review.

Axis 1, Regulatory function: what happens when the mistake occurs?

This is a strict preference ladder. Always reach for the highest rung you can afford.

Rung Name What it does Software examples
1 Control The mistake is impossible. The work cannot proceed. Type won't compile ยท NOT NULL / CHECK / unique constraint ยท required function argument ยท private constructor + smart constructor ยท PreToolUse hook returns deny ยท protected branch
2 Warning The mistake is possible but announced at the moment it happens. Lint error in the editor ยท failing CI gate ยท runtime assertion that throws ยท confirmation prompt naming the exact thing being destroyed
3 Detection The mistake ships, and something finds it afterward. Tests ยท monitoring ยท alerting ยท reconciliation job
0 (not a poka-yoke) Relies on a human remembering. Docs ยท comments ยท training ยท "be careful" ยท review checklists

Shingo's rule: prefer control over warning, always, and only settle for warning when control is genuinely too expensive, then say why out loud. In software the honest reason is usually "the language can't express it" or "it would break every existing caller," and both are worth stating explicitly so the tradeoff is visible.

Axis 2, Setting function: how does the device notice?

Shingo's three detection methods map cleanly onto software. These are your inspection lenses, run all three over any interface and you will find hazards that a general code review misses.

Method Factory floor The question to ask code Software devices
Contact The part physically won't seat unless it's the right shape and orientation Can the wrong thing fit? Distinct types instead of shared primitives ยท branded/newtype IDs ยท parse-don't-validate at boundaries ยท units in the type ยท discriminated unions instead of bags of optionals
Fixed-value A counter says all 6 screws were fitted Can the wrong count or an incomplete set pass? Exhaustive match/switch over an enum ยท required fields ยท "all migrations applied" check ยท row-count guard on a bulk write ยท checksums ยท config validated as a whole at boot
Motion-step A sensor confirms step 3 happened before step 4 Can the steps happen in the wrong order, or be skipped? Typestate ยท builder that cannot .build() until required steps run ยท state machines with illegal transitions unrepresentable ยท idempotency keys ยท RAII / defer / context managers ยท transactions

The third principle: inspect at the source

Shingo separated source inspection from informative inspection, which finds the defect

โ€ฆ

Pertanyaan umum

Apa yang BUKAN poka-yoke?

Komentar dalam kode, instruksi dalam dokumen, dan daftar periksa (checklist) bukan poka-yoke. Hal-hal ini mengandalkan ingatan manusia dan bisa terlupakan. Poka-yoke adalah aturan atau struktur yang ada di dalam sistem itu sendiri.

Apa saja tingkatan poka-yoke?

Ada tiga tingkatan: Kontrol (kesalahan menjadi tidak mungkin terjadi), Peringatan (kesalahan diumumkan pada saat itu juga), dan Deteksi (sesuatu menemukan kesalahan setelahnya). Tujuan idealnya selalu Kontrol.

Bagaimana poka-yoke mengidentifikasi kesalahan?

Ada tiga metode: Kontak (bagian yang salah tidak akan pas), Nilai tetap (jumlah atau kumpulan data tidak sesuai), dan Langkah gerakan (langkah dilakukan dengan urutan yang salah atau terlewat).

Detail

Deskripsi asli dari pembuat

Mistake-proof code, config and process: make the wrong action impossible or self-announcing rather than documented.

repo: sickn33/agentic-awesome-skills

Popularitas

Bintang GitHub
48k
Peringkat
#5461
Lisensi
MIT
Diperbarui
15/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa