typescript-advanced-patterns
Installation
SKILL.md
TypeScript Advanced Patterns Best Practices
Type-level programming, library-author idioms, and feature-implementation patterns that go beyond surface uses of TypeScript 5.x. Contains 40 rules across 5 categories, prioritised by impact on consumer codebases.
When to Apply
Reference these guidelines when:
- Designing a public library or DSL surface (fluent builders, event emitters, route parsers, query builders, schema-derived clients)
- Writing type-level algorithms (recursive conditionals, accumulator pattern, key remapping, variadic tuples, type-level string/number ops, type-level tests)
- Using TS 5.x features in non-trivial ways (Stage 3 decorators,
usingcomposition,const Tfor overload disambiguation,NoInferfor anchor-vs-constrained parameters, variance annotations, the bivariance hole) - Encoding workflow state, transitions, and capabilities at the type level so illegal states and missing checks are compile errors
- Integrating with the declaration & module system (module augmentation, declaration merging, ambient asset modules, library type publishing via
exports/typesVersions)