What problem does it solve? Guards that block dangerous actions often fail silently: a parser error gets swallowed, the empty result is read as "nothing to inspect", and a malformed payload carrying a real production mutation sails through while the test suite stays green. This Skill teaches how to design PreToolUse hooks, pre-commit checks, admission policies, and CI gates that fail closed instead of open. ## Core Features & Use Cases - Boundary definition: Forces you to write down what the gate guards, three commands it must block, three similar commands it must pass, and what happens on unreadable input before writing any code. - Fail-open trap detection: Shows the classic bug pattern (2>/dev/null hiding a dying parser, empty output treated as safe) and the fail-closed fix that scans raw input when parsing fails. - Four-case test suite: Pins garbage input (allow), truncated input with real mutation (block), renamed keys (block), and a well-formed control (block), then mutation-tests the gate itself by verifying the suite goes red against the broken version. - Advisory-to-gate promotion: Covers the inverse failure where a new check added to a working path fails closed and causes an outage, with a rule for shipping new checks as advisory warnings until proven on real inputs. - Use Case: You are adding a hook to block mutating kubectl commands against production. Use this Skill to define the boundary, write the fail-closed parser, and pin the four-case test so a malformed payload can never bypass the guard. ## Quick Start Ask the AI to write a PreToolUse hook that blocks destructive commands against production, applying the fail-closed pattern and the four-case test from this Skill.