toolchains-typescript-core
БесплатноБез исполняемых скриптовНе проверенTypeScript 5.6+ core patterns for minimalism, efficiency, type safety, and performance
от bobmatnyc★ 160 звёзд на GitHubОб этом скилле
TypeScript Core Patterns
Modern TypeScript development patterns for 5.6+ targeting minimal code, maximum type safety, and optimal bundle performance.
Quick Start
New project: Start with tsconfig baseline below → Enable strict + noUncheckedIndexedAccess → Use Zod for runtime validation at boundaries → Vitest for testing.
Existing project: Enable strict: false initially → Replace any with unknown → Add noUncheckedIndexedAccess → Incrementally tighten.
tsconfig Baseline (2025)
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"verbatimModuleSyntax": true,
"isolatedModules": true,
"skipLibCheck": true,
"declaration": true,
"declarationMap": true
}
}
Minimalism Patterns
- Use
satisfiesto validate types without widening:const routes = {...} satisfies Record<string, Route> - Use
as constfor literal type inference on objects and arrays — eliminates separate type definitions - Prefer utility types (
Pick,Omit,Partial,Required,Record) over manual type duplication - Discriminated unions over type guards — let the compiler narrow automatically via
switch/if - Template literal types for compile-time string validation:
type Route = `/api/${string}` Readonly<T>andReadonlyArray<T>for immutable data — prevents accidental mutation- Let TypeScript infer return types for internal functions — annotate only public API boundaries
Efficiency / Bundle Optimization
import type { Foo }withverbatimModuleSyntax— ensures type imports are erased at compile time- Avoid barrel files (
index.tsre-exports) — they prevent tree-shaking and slow builds sideEffects: falseinpackage.json— enables aggressive dead code elimination- Dynamic
import()for code splitting — load heavy modules on demand, not at startup - ESM output (
"module": "NodeNext") — enables tree-shaking across the entire dependency graph - Avoid runtime type checks in hot paths — validate once at boundaries, trust types internally
- Keep generic type depth shallow (≤3 levels) — deep generics slow the compiler and confuse developers
Code Reuse
- Generic constraints:
<T extends { id: string }>— just enough constraint, no more - Conditional types with
infer:type Unwrap<T> = T extends Promise<infer U> ? U : T - Mapped types with
asclause for key transformation:{ [K in keyof T ason${Capitalize} ]: ... } - Module augmentation for extending third-party types without forking
- Branded/nominal types for type-safe IDs:
type UserId = string & { __brand: 'UserId' } - Shared utility types:
Brand<T,B>,DeepPartial<T>,Prettify<T>in a projecttypes/directory NoInfer<T>(TS 5.4+) — prevents unwanted type parameter inference in function arguments
Modern TypeScript (5.4-5.7)
NoInfer<T>(5.4) — control where type inference happens in overloaded/generic functionsusingdeclarations (5.2+) — automatic resource cleanup via[Symbol.dispose]--noCheck(5.6) — emit-only builds, skip type checking for faster CI artifact generation--rewriteRelativeImportExtensions(5.7) — enables direct.tsexecution without build step--target es2024— unlocksObject.groupBy,Promise.withResolvers,Map.groupByin type system- Stricter truthy/nullish checks (5.6) — catches
Boolean(0)andx ?? fallbackpitfalls - Improved never-initialized variable checks — compiler detects variables used before assignment
React Performance (brief)
React.memoonly when profiler shows unnecessary re-renders — not as a defaultuseDeferredValuepaired with memo for expensive renders during state transitionsuseTransitionfor non-urgent state updates to keep UI responsive- React 19 Compiler auto-optimizes — reduces need for manual
useCallback/useMemo - Virtualize long lists (>100 items) with
@tanstack/virtualorreact-window
Testing
- Vitest as default test runner — Vite-native, faster than Jest, same API
- Type-level tests with
expectTypeOfin*.test-d.tsfiles — catches type regressions vitest --typecheckruns type tests alongside unit tests in one pass- Type-safe mocks with
vi.fn<(args: Params) => Return>()— noanyleakage - Zod schemas at runtime boundaries (API input, env vars) —
z.infer<typeof Schema>for types - Snapshot testing for complex object shapes —
toMatchInlineSnapshot()for small outputs
Anti-Patterns
- ❌
anytype — useunknownand narrow, oras const satisfiesfor complex literals - ❌
asyncin.forEach()— iterations don't await; usefor...ofwithawaitorPromise.all - ❌ Over-typing: writing types the compiler already infers — adds noise, increases maintenance
- ❌ Unnecessary classes — prefer plain functions and objects; classes only for stateful abstractio
Установить toolchains-typescript-core в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл toolchains-typescript-core?
TypeScript 5.6+ core patterns for minimalism, efficiency, type safety, and performance
Как установить скилл toolchains-typescript-core?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл toolchains-typescript-core запускает скрипты?
Нет, скилл состоит только из инструкций (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