Agent skill · affaan-m

typescript-patterns

TypeScript patterns for strict, type-safe, maintainable code in modern TypeScript and JavaScript applications. Covers strict compiler configuration, type design, narrowing, discriminated unions, generics, async and error handling, module boundaries, dependency hygiene, and type-level testing. Use when writing or reviewing TypeScript or JavaScript code.

What it needs

About 11k tokens when loaded.

What this skill does

TypeScript Development Patterns TypeScript patterns and best practices for building robust, type-safe, and maintainable applications. The compiler is most useful when it can prove your program's shape, so the guiding principle here is: push the type system to do real work instead of fighting it. This skill is the "how." For the "what" and "when" (the decisions about which pattern to reach for), see the TypeScript rules — rules/typescript/coding-style.md and rules/typescript/patterns.md in this repository, installed as rules/ecc/typescript/coding-style.md and rules/ecc/typescript/patterns.md. When to Activate Writing new TypeScript or JavaScript code Reviewing a PR that touches .ts or .tsx files Refactoring existing TypeScript to remove any, tighten types, or add strictness Designing types, generics, or module boundaries for a new feature Setting up a new TypeScript project or upgrading tsconfig.json Debugging type errors that cascade through a codebase (usually a design problem, not an annotation problem) Core Principles 1. Strict Mode Is the Baseline strict: true (which enables strictNullChecks, noImplicitAny, strictFunctionTypes, and the rest) is not optional in a healthy codebase. If a codebase cannot compile under strict, that is a migration task, not an excuse to leave the flag off. noUncheckedIndexedAccess makes array and record access possibly-undefined, which surfaces a whole class of runtime crashes at compile time. If it produces too much noise, this is the pattern to add, not the flag to remove: 2. any Is a Bug, Not a Tool any disables the type system exactly where a bug is most likely to hide: at the boundary with untrusted or dynamic data. Prefer unknown and narrow it. When you truly need a fallback, prefer an explicit loosening with a comment over a silent any. 3. Public APIs Get Explicit Types, Locals Get Inference TypeScript infers local variables well. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills affaan-m/typescript-patterns--52f232

View the source on GitHub

Browse the @skills marketplace