offensive-typesafety
Offensive Typesafety
When to invoke this skill:
- When setting up or evaluating a new tech stack.
- When designing API, URL state, or database boundaries.
- When refactoring untyped string-based logic into strict, compiler-checked contracts.
Offensive Typesafety is the practice of using strong, compiler-enforced types to accelerate development. Instead of using types defensively (just to catch bugs before production), use them offensively to establish strict boundaries that allow you—and AI code generators—to move blazingly fast without breaking things.
Core Philosophy: Compilers over Conventions
- Constraints over "looks right": Code should not just look plausible; it should fail at the compiler level if it is structurally or conceptually wrong.
- Explicit over Magic: Prefer explicit, traversable data structures over string-based assumptions or untyped framework magic.
- Fail Early: The compiler is the first line of defense. The faster it fails, the faster you can iterate.
- AI Viability: When AI writes code, types act as a contract, a feedback loop, and a way to self-correct. If an AI generates a typo in a string route, it fails silently at runtime. If it messes up a strongly typed route, the compiler catches it instantly.
Architecture Patterns for Moving Fast
Default to tools that enforce correctness at every layer.
More from jonmumm/skills
dont-use-use-effect
>
59react-composable-components
>
41grill-me
>
32mutation-testing
Run and interpret Stryker mutation testing; kill survivors to reach ≥95% score. Use when running mutation tests, setting up Stryker, interpreting survivors, or verifying test quality after TDD.
32expo-testing
Build, install, and test Expo/React Native apps on simulators and physical devices. Use when asked to "run on simulator", "install on device", "test on phone", "run detox", "preview build", or "build and test".
30react-render-performance
>
29