ts-language-patterns

Applies TypeScript 6.0 language features and fixes legacy enum, namespace, and import anti-patterns.

1|Updated Jul 29, 2026
One-click install
npx skills add https://github.com/fusengine/kimi-code --skill ts-language-patterns-fusengine
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ts-language-patterns
Source: https://github.com/fusengine/kimi-code/tree/main/plugins/typescript-expert/skills/ts-language-patterns
Command: npx skills add https://github.com/fusengine/kimi-code --skill ts-language-patterns-fusengine

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? TypeScript code written from stale training data or older configs breaks under TS 6.0 defaults, verbatimModuleSyntax, and Node's native type stripping. This Skill guides writing and reviewing modern TypeScript so code uses current language features instead of legacy constructs that fail at build or runtime. ## Core Features & Use Cases - Modern TS 6.0 syntax guidance: Covers const type parameters for narrowest-literal inference, using/await using for deterministic resource cleanup, standard ECMAScript decorators, satisfies for narrow-type validation, and order-independent method-callback inference. - LLM anti-pattern remediation: Replaces legacy enum with const objects as const, removes namespace-wrapped runtime code, enforces import type under verbatimModuleSyntax, and migrates import assertions to import attributes. - Use Case: When reviewing AI-generated TypeScript that declares enum Status { Active } and imports types as values, use this Skill to convert the enum to an erasable const object and switch to import type, keeping the code compatible with Node's type stripper. ## Quick Start Review my TypeScript file for legacy enum, namespace, and missing import type issues, then rewrite it using modern TS 6.0 patterns.

Frequently Asked Questions about ts-language-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I replace TypeScript enum with a modern alternative?▼

Replace enum with a const object using as const, then derive the union type with keyof typeof. For example, `const Status = { Active: "active" } as const` with `type Status = (typeof Status)[keyof typeof Status]` is erasable by Node's type stripper and tree-shakeable.

How do I use const type parameters in TypeScript generics?▼

Prefix a type parameter with const, like `function first<const T extends readonly unknown[]>(arr: T)`, so arguments infer the narrowest literal type without callers writing as const. The constraint still applies, and it only affects call-site inference.

Does TypeScript support standard decorators without experimentalDecorators?▼

Yes, TypeScript implements the TC39 Stage 3 standard decorators receiving (value, context) with typed contexts like ClassMethodDecoratorContext. Do not enable experimentalDecorators or emitDecoratorMetadata, and note decorators require a compiler or bundler since Node's type stripper does not transform them.

Why does my TypeScript import break with verbatimModuleSyntax?▼

Under verbatimModuleSyntax, a type imported without the type keyword is treated as a value import and crashes Node at runtime. Use `import type { User }` or inline markers like `import { createUser, type CreateUserInput }` for all type-only imports.

When should I use using instead of try/finally in TypeScript?▼

Use using when a value owns a resource with a Symbol.dispose method, such as file handles or connections. It guarantees cleanup in reverse order even on throw, and await using with Symbol.asyncDispose handles asynchronous teardown inside async functions.

What is the difference between satisfies and a type annotation?▼

A satisfies clause validates a value against a type while keeping its narrow inferred type, whereas a plain annotation widens the value to the annotated type. Use satisfies when you still need member-level specificity, such as preserving tuple or literal types.