Individual skill
typescript-advanced-patterns
Advanced TypeScript — type-level programming, library/DSL APIs, declaration merging, modern language features at depth (decorators, using, const T, NoInfer, variance), and feature implementation patterns built on advanced types. Trigger on tasks involving recursive conditional types, infer patterns, mapped-type key remapping, variadic tuples, fluent builders with phantom state, schema-first inference (Zod/Valibot), end-to-end-typed API clients, finite state machines, module augmentation, and library-publishing concerns. Trigger even when the user does not say "advanced" — if the work involves type-level algorithms, library-author API design, or going beyond surface-level uses of TS 5.x features, this is the skill. Assumes the reader has absorbed the `typescript-refactor` skill — this one extends those patterns at depth, never restates them.
skills/.experimental/typescript-advanced-patterns/SKILL.md
Source commit cf93c57cac89d6fc3e4194686000411567f5caf3
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- Yes
- Repository scan complete
- No
- Skill scan complete
- Yes
- Observed behavior
- Network or broad shell
- Last checked
- Nov 5, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 221
- Repository last updated
- Aug 15, 2026
- License
- MIT
Observed agent integration: codex
- engineering Derived category
- design Derived category
- testing Derived category
- testing-browser Derived category
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
AGENTS.mddoc · 12,338 bytesSKILL.mdcore · 9,681 bytesassets/templates/_template.mddoc · 1,047 bytesmetadata.jsonasset · 1,954 bytesreferences/_sections.mddoc · 2,095 bytesreferences/decl-ambient-asset-modules.mddoc · 3,574 bytesreferences/decl-authoring-d-ts-for-js.mddoc · 4,213 bytesreferences/decl-declaration-merging.mddoc · 4,166 bytesreferences/decl-exports-and-types-versions.mddoc · 4,377 bytesreferences/decl-global-augmentation-discipline.mddoc · 4,099 bytesreferences/decl-module-augmentation.mddoc · 3,850 bytesreferences/dsl-fluent-builder-phantom-state.mddoc · 3,455 bytesreferences/dsl-narrow-api-surface.mddoc · 3,190 bytesreferences/dsl-overloads-vs-conditional-returns.mddoc · 3,426 bytesreferences/dsl-route-param-inference.mddoc · 2,836 bytesreferences/dsl-schema-first-inference.mddoc · 3,184 bytesreferences/dsl-type-safe-object-paths.mddoc · 3,045 bytesreferences/dsl-type-safe-query-builder.mddoc · 3,186 bytesreferences/dsl-typed-event-emitter.mddoc · 3,122 bytesreferences/impl-assert-never-exhaustive.mddoc · 4,308 bytesreferences/impl-env-config-loader.mddoc · 4,123 bytesreferences/impl-finite-state-machine.mddoc · 4,377 bytesreferences/impl-phantom-feature-flags.mddoc · 3,942 bytesreferences/impl-schema-derived-api-client.mddoc · 4,446 bytesreferences/impl-state-discriminated-union.mddoc · 3,921 bytesreferences/impl-tagged-result-type.mddoc · 4,109 bytesreferences/impl-type-safe-form-builder.mddoc · 3,832 bytesreferences/mod-const-type-params-overloads.mddoc · 3,875 bytesreferences/mod-method-vs-property-bivariance.mddoc · 3,926 bytesreferences/mod-noinfer-overload-disambiguation.mddoc · 3,599 bytesreferences/mod-phantom-capability-tracking.mddoc · 4,037 bytesreferences/mod-satisfies-branded-config.mddoc · 4,056 bytesreferences/mod-stage-3-decorators.mddoc · 4,046 bytesreferences/mod-using-disposal-ordering.mddoc · 4,020 bytesreferences/mod-variance-debugging.mddoc · 4,255 bytesreferences/tlp-distributive-conditional-control.mddoc · 3,645 bytesreferences/tlp-hkt-emulation.mddoc · 3,998 bytesreferences/tlp-infer-extends-constraints.mddoc · 3,008 bytesreferences/tlp-key-remapping-as.mddoc · 3,054 bytesreferences/tlp-recursive-conditional-types.mddoc · 3,254 bytesreferences/tlp-tail-recursion-accumulator.mddoc · 3,158 bytesreferences/tlp-template-literal-pattern-matching.mddoc · 3,413 bytesreferences/tlp-type-level-string-algorithms.mddoc · 3,555 bytesreferences/tlp-type-level-tests.mddoc · 3,305 bytesreferences/tlp-variadic-tuple-types.mddoc · 3,337 bytes
Read excerpt
# 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, `using` composition, `const T` for overload disambiguation, `NoInfer` for 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`)
## Boundary with neighbouring skills