
principle-type-system-discipline
Apply when designing types, reviewing a function signature
by cursorFree
Description
principle-type-system-discipline is an agent skill from Cursor's plugins collection that applies a working principle when designing types, reviewing a function signature, or writing code in any statically typed language. The goal is to make the compiler reject impossible states, mismatched primitives and unhandled variants. The skill prefers defining errors and special cases out of existence over multiplying handlers for them. Its central idea is to make illegal states unrepresentable. Variants should be modelled as sum types, such as discriminated unions, enums with payloads or sealed classes, rather than as a bag of optional fields where contradictory combinations still compile. The example given is a record with a completed flag and an optional completion date, which allows a completed state with no date; the fix is to derive the flag from the date, or to use separate open and done variants. If a comment is needed to explain when a combination of fields is valid, the skill says to split it into a sum type. It also treats types as constructions rather than restrictions: build a type up from the values you want, rather than carving them out of a looser type with checks. For TypeScript syntax, the skill points to a separate typescript-best-practices skill. The principle suits API design and any code where wrong states have caused bugs. It is listed on skills.sh, where the page shows install counts and GitHub stars for the Cursor plugins repository. Install it with npx skills add https://github.com/cursor/plugins --skill principle-type-system-discipline.…
Highlights
- Illegal states unrepresentable
- Sum types over optional fields
- Types built up from wanted values
- Errors defined out of existence
- Points to TypeScript best practices
- Installs from skills.sh
Ratings & Reviews
No ratings yet
Be the first to rate principle-type-system-discipline.
People also visit

typescript-magician
Designs complex generic types, refactors `any` types to strict alternatives
principle-type-system-discipline FAQ
What does this principle aim for?
Making the compiler reject impossible states, mismatched primitives and unhandled variants.
Why avoid optional fields?
A bag of optional fields lets contradictory combinations compile, for example a completed flag with no completion date.
When should I split a type?
When a comment is needed to explain which field combinations are valid, the skill says to use a sum type.
How do I install it?
Run npx skills add https://github.com/cursor/plugins --skill principle-type-system-discipline.
How popular is it?
The skill is listed in the cursor/plugins repository, which has 11.4K GitHub stars.
What are the best principle-type-system-discipline alternatives?
Popular alternatives to principle-type-system-discipline include typescript-magician, typescript-pro and typescript-advanced-types. See all principle-type-system-discipline alternatives














