TypeScript discipline
Use TypeScript to model the real contract. Prefer named types, validated boundaries, and compiler-checked narrowing over casts or informal object shapes.
Workflow
- Reuse existing exported domain, schema, API/client, route, and module contract types before creating local ones.
- Place types at the boundary where the concept belongs.
- Apply the boundary and data-shape rules in type-boundaries.md.
- Avoid unsafe typing using unsafe-types.md.
- Before writing library/framework code, check installed versions and use current docs for that version. Prefer the remote Context7 workflow in context7.md when its tools are available.
- Verify with repo scripts using verification.md.
Required discipline
- Do not use
anywithout asking the user first. - Do not add
@ts-ignoreor@ts-expect-errorunless the user asks, and explain why in the comment. - Model structured data first. Serialize strings, cache keys, and protocol values only at an explicit boundary.
Context pointers
- Use type-boundaries.md for shared/local type placement and data modeling.
- Use unsafe-types.md for
any,unknown, non-null assertions, casts, and TS comments. - Use verification.md for return types, package scripts, and monorepo checks.