Type Modelling Review
Reshapes types so invalid states cannot be represented, rather than validating them at runtime and hoping.
Free — no card needed
Create a free account
to open Type Modelling Review — and the other 364 prompts across 21 categories.
Already have an account?
Running it, start to finish
- List every invalid state the current types allow.
- Replace optional-plus-flag shapes with discriminated unions.
- Move validation to the boundary and parse into a guaranteed type.
What you get back
The output this produces, every time.
- Lists the invalid states your current types permit, which is usually more than expected.
- Moves validation to the boundary so downstream code is guaranteed by construction.
- Checks each proposed change against bugs you actually had, rather than theoretical ones.
Getting better results
Where this usually goes wrong, and how to avoid it.
- Look hardest at optional pairs. Two optionals where exactly one should be set is the most common representable-invalid-state, and a union fixes it outright.
- Split the meanings of null. Absent, not-applicable and empty collapsed into one value produces bugs nobody can reproduce.
- Brand your identifiers. An order id and a user id are both strings, and swapping them type-checks perfectly today.
More Coding prompts
All Coding →- Coding
Review for the Bug, Not the Style
A code review that hunts correctness failures and states the exact input that breaks each one, instead of listing naming preferences.
ClaudeChatGPTGemini000Open → - Coding
Database Migration Plan
Plans a schema change that ships without downtime, in steps that are each independently safe and reversible.
ClaudeChatGPT000Open → - Coding
Refactor With a Safety Net
Plans a refactor as a sequence of individually safe, individually shippable steps, with the characterisation tests that make each one verifiable.
ClaudeChatGPT000Open →
Written for The AI University. Every prompt in this library is original work — authored, tested and revised here, not collected from elsewhere. 365 of them, free with an account.
