plugins/typescript-expert/skills/ts-language-patterns/SKILL.md
Use when: writing or reviewing modern TypeScript syntax and idioms — const type parameters, using / await using resource management, standard ECMAScript decorators, satisfies, or fixing LLM-authored anti-patterns (legacy enum/namespace, missing import type). Covers TS 6.0 language features and inference. Do NOT use for: tsconfig / compiler flags (use ts-config), SOLID structure and file-size rules (use solid-generic), or framework-specific APIs.
npx skillsauth add fusengine/agents ts-language-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.
Before writing non-trivial TypeScript, use TeamCreate to spawn 3 agents:
verbatimModuleSyntax, tsconfig/microsoft/typescript for exact API shapesAfter writing, run fuse-ai-pilot:sniper for validation.
| Feature | What it gives you |
|---------|-------------------|
| const type parameters | <const T> infers the narrowest literal type without as const at call sites |
| using / await using | Deterministic cleanup via Symbol.dispose / Symbol.asyncDispose |
| Standard decorators | ECMAScript decorators — NOT experimentalDecorators |
| satisfies | Validate a value against a type while keeping its narrow inferred type |
| 6.0 inference | Method-syntax callbacks are no longer contextually sensitive → order-independent inference |
import type is mandatory under verbatimModuleSyntax - type-only imports must say type, or emit/stripping breaks.enum - prefer const objects as const; enum is un-erasable by Node's type stripper.namespace with runtime code - use ESM modules; type-only namespace is acceptable.experimentalDecorators for new code.any - strict is the 6.0 default; annotate or infer explicitly.| Topic | Reference | When to Consult |
|-------|-----------|-----------------|
| Resource management | resource-management.md | Load when using using / await using / disposables |
| Generics & inference | generics-and-inference.md | Load when using const type params, satisfies, or debugging inference |
| Decorators | decorators.md | Load when adding decorators |
| LLM pitfalls | llm-pitfalls.md | Load when reviewing or migrating legacy/AI-authored TypeScript |
| Template | When to Use |
|----------|-------------|
| modern-patterns.md | Copy-paste const/satisfies/decorator examples |
| resource-management.md | Copy-paste using / DisposableStack examples |
const type parameterfunction first<const T extends readonly unknown[]>(arr: T): T[0] {
return arr[0];
}
const x = first(["a", "b"]); // x: "a" (literal, no `as const` needed)
using for deterministic cleanupfunction openFile(path: string) {
const handle = acquire(path);
return { handle, [Symbol.dispose]() { release(handle); } };
}
{
using file = openFile("./data"); // released automatically at block end
}
satisfiesconst config = {
port: 3000,
host: "localhost",
} satisfies Record<string, string | number>;
// config.port stays `number`, not widened to `string | number`
enum Color { Red } with const Color = { Red: "red" } as constusing over manual try/finally cleanup when a resource has a disposersatisfies instead of a type annotation when you want to keep the narrow inferred typeimport { SomeType } for a type-only import — use import type { SomeType }experimentalDecorators or emitDecoratorMetadata for new codenamespace to organize runtime code — that is what ESM modules are fortesting
Copy self-audit and ban-lists — filler verbs/hype adjectives, slop placeholder names, fake-precise numbers, Title Case headlines, humor in error copy ('Oops!'), em-dash crutch, one copy register per page.
development
Logged-in web apps — dashboards, auth flows, settings, onboarding, data tables, command palettes, modals, toasts. Register `product`: density and glance-speed over marketing polish, no hero/CTA-tricks, every data surface covers empty/loading/error explicitly, tables and dataviz follow preattentive-processing rules.
development
Marketing sites, landing pages, campaign pages — register `brand` (design IS the product). Structure comes from the register's POV + a macrostructure pick, never from copying an inspiration site's section flow. Hero discipline, deviated section order, asymmetric grids, and a silhouette lookalike-test gate before ship.
development
Token-strategy core — OKLCH color rules, neutral tinting, accent-commitment levels, type scale, 8pt spacing grid, touch targets, and the canonical output format of design-system.md (the file the harness gates on). This is routing step 1 of design-method/SKILL.md — read it before design-web/design-webapp/design-ios/design-android, before picking or auditing a single color/type/spacing value.