ts-pattern-refactor
Installation
SKILL.md
ts-pattern Refactor
Convert error-prone conditional code to match().with().exhaustive() — without over-applying it.
When to Use
- Sweeping a TS/React codebase for ts-pattern opportunities
- A discriminated union (
{ kind: ... },status: 'a' | 'b' | ...) has grown new variants and the UI dispatch is scattered - Reviewing JSX with nested ternaries or
&&fragment chains keyed off the same discriminator
Judgment Criteria
The number of branches alone is not the trigger. Look at syntactic form × context.