typescript-language
БесплатноБез исполняемых скриптовНе проверенApply modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings.
от 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 runtimeenum. - Generics: Reusable, type-safe code.
- Type Guards:
typeof,instanceof, predicates. - Utility Types:
Partial,Pick,Omit,Record. - Immutability:
readonlyarrays/objects. Const Assertions:as const;satisfiesrequires 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. Useprivate/protectedor#private. - Branded Types:
string & { __brand: 'Id' }.
Anti-Patterns
- NEVER use
any: Useunknownor 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>oras 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). Gatesatisfiesat ≥ 4.9. - Config:
target,lib,module/moduleResolution,types,rootDir. TS 7 defaults differ:stricttrue,moduleesnext,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.
Установить typescript-language в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
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), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic