skills/typescript-advanced-patterns/SKILL.md
Advanced TypeScript patterns for type-safe, maintainable code using sophisticated type system features. Use when building type-safe APIs, implementing complex domain models, or leveraging TypeScript's advanced type capabilities.
npx skillsauth add nickcrew/claude-ctx-plugin typescript-advanced-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Expert guidance for leveraging TypeScript's advanced type system features to build robust, type-safe applications with sophisticated type inference, compile-time guarantees, and maintainable domain models.
TypeScript's type system enables compile-time safety through:
value is Type)Load detailed references on-demand:
| Topic | Reference File |
|-------|----------------|
| Conditional Types | skills/typescript-advanced-patterns/references/conditional-types.md |
| Mapped Types | skills/typescript-advanced-patterns/references/mapped-types.md |
| Template Literal Types | skills/typescript-advanced-patterns/references/template-literal-types.md |
| Type Guards | skills/typescript-advanced-patterns/references/type-guards.md |
| Discriminated Unions | skills/typescript-advanced-patterns/references/discriminated-unions.md |
| Branded Types | skills/typescript-advanced-patterns/references/branded-types.md |
| Builder Pattern | skills/typescript-advanced-patterns/references/builder-pattern.md |
| Advanced Generics | skills/typescript-advanced-patterns/references/advanced-generics.md |
| Utility Types | skills/typescript-advanced-patterns/references/utility-types.md |
| Type Inference | skills/typescript-advanced-patterns/references/type-inference.md |
| Decorators | skills/typescript-advanced-patterns/references/decorators.md |
| Performance Best Practices | skills/typescript-advanced-patterns/references/performance-best-practices.md |
| Common Pitfalls | skills/typescript-advanced-patterns/references/common-pitfalls.md |
| Testing Types | skills/typescript-advanced-patterns/references/testing-types.md |
tsconfig.json with "strict": true)Using any instead of unknown: Loses all type safety
unknown and type guards insteadType assertions without validation: Unsafe runtime behavior
value is Type) over as TypeOverusing generics: Unnecessary complexity
Deep type nesting: Slow compilation, hard to debug
Forgetting readonly: Accidental mutations
readonlyNot enabling strict mode: Missing null checks and type errors
"strict": true in tsconfig.jsonMixing type and interface incorrectly: Confusing semantics
type for unions/utilities, interface for object shapestype UserId = string & { readonly __brand: 'UserId' };
function createUserId(id: string): UserId { return id as UserId; }
type State =
| { status: 'loading' }
| { status: 'success'; data: string }
| { status: 'error'; error: Error };
type Readonly<T> = { readonly [P in keyof T]: T[P] };
type Partial<T> = { [P in keyof T]?: T[P] };
function isString(value: unknown): value is string {
return typeof value === 'string';
}
testing
Use when creating new skills, editing existing skills, or verifying skills work before deployment - applies TDD to process documentation by testing with subagents before writing, iterating until bulletproof against rationalization
testing
Comprehensive security assessment and remediation. Use for security reviews, compliance checks, vulnerability assessments.
research
Systematic performance analysis and optimization. Use when things are slow, need optimization, or preparing for scale.
development
Complete feature development workflow from design to deployment. Use when implementing new features or functionality.