Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

typescript-language

БесплатноБез исполняемых скриптовНе проверен

Apply modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings.

HoangNguyen0403от HoangNguyen0403★ 598 звёзд на GitHub

Об этом скилле

TypeScript Language Patterns

Priority: P0 (CRITICAL)

Implementation Guidelines

  • Type Annotations: Explicit params/returns. Infer locals.
  • Interfaces vs Types: interface for APIs (supports declaration merging). type for unions, intersection types, mapped/conditional types.
  • Strict Mode: strict: true. Null Safety: ?. and ?? — Use narrowing instead. Avoid non-null assertion (!) operator.
  • Enums: Literal unions or as const. No runtime enum.
  • Generics: Reusable, type-safe code.
  • Type Guards: typeof, instanceof, predicates.
  • Utility Types: Partial, Pick, Omit, Record.
  • Immutability: readonly arrays/objects. Const Assertions: as const; satisfies requires TS ≥ 4.9.
  • Template Literals: on${Capitalize<string>}.
  • Discriminated Unions: Literal kind property to narrow type safely. Switch on discriminant.
  • Advanced: Mapped, Conditional, Indexed types.
  • Access: Default public. Use private/protected or #private.
  • Branded Types: string & { __brand: 'Id' }.

Anti-Patterns

  • NEVER use any: Use unknown or specific interface instead.
  • No Function: Use signature () => void.
  • No enum: Runtime cost.
  • No !: Avoid non-null assertion (!). Use narrowing (typeof, instanceof, if-checks).
  • No Lint Disable: Fix root cause; never suppress.

Testing

  • Mocking: Use jest.Mocked<T> or as unknown as T.
  • Checklist: Check method existence, match error constants, satisfy required properties.
  • References: See references/TESTING.md for common issues/solutions.

Code

// Branded Type
type UserId = string & { __brand: 'Id' };

// Satisfies (Validate + Infer)
const cfg = { port: 3000 } satisfies Record<string, number>;

// Discriminated Union
type Result<T> = { kind: 'ok'; data: T } | { kind: 'err'; error: Error };

Compatibility Preflight

Before emitting newer syntax or changing the compiler, state the checked facts:

  • Compiler: locked version (tsc --version, lockfile). Gate satisfies at ≥ 4.9.
  • Config: target, lib, module/moduleResolution, types, rootDir. TS 7 defaults differ: strict true, module esnext, types [], rootDir ./.
  • Runtime: emitted syntax and APIs must run on the declared Node/browser floor.
  • Tool peers: plugins, typescript-eslint, test transforms, compiler-API consumers. TS 7.0 ships no compiler API; keep TS 6 available when a peer needs one.

Verification

After a type change that crosses module boundaries or involves generics, unions, conditional or branded types: run the project's own check (tsc --noEmit, CI typecheck, or configured editor diagnostics). Use a getDiagnostics LSP tool only when one is actually installed; never assume availability.

References

For advanced type patterns, utility types, and the compatibility matrix: See references/REFERENCE.md.

Полный SKILL.md на GitHub

Установить typescript-language в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

LICENSEreferences/REFERENCE.mdreferences/TESTING.md

FAQ

Что делает скилл typescript-language?

Apply modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings.

Как установить скилл typescript-language?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл typescript-language запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить typescript-language с