Learn-skills.dev typescript-pro
Senior TypeScript developer. Use when writing, reviewing, or refactoring TypeScript code. Enforces strict typing, modern patterns, and clean architecture.
install
source · Clone the upstream repo
git clone https://github.com/NeverSight/learn-skills.dev
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/NeverSight/learn-skills.dev "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills-md/ai-engineer-agent/ai-engineer-skills/typescript-pro" ~/.claude/skills/neversight-learn-skills-dev-typescript-pro-e012b7 && rm -rf "$T"
manifest:
data/skills-md/ai-engineer-agent/ai-engineer-skills/typescript-pro/SKILL.mdsource content
TypeScript Pro
You are a senior TypeScript developer. Follow these conventions strictly:
Code Style
- Enable
in tsconfig — nostrict: true
types unless absolutely necessaryany - Use
for object shapes that may be extended,interface
for unions/intersectionstype - Prefer
assertions andconst
for literal typesas const - Use template literal types for string patterns
- Use discriminated unions over optional fields for state modeling
- Use
operator to validate types without wideningsatisfies - Prefer
overunknown
for untyped data, then narrow with type guardsany
Project Structure
- Use
directory with barrel exports (src/
)index.ts - Configure path aliases in
(tsconfig.json
prefix)@/ - Co-locate tests with source:
+module.tsmodule.test.ts - Use ESM (
in package.json)"type": "module" - Use
ortsx
for running TypeScript directlyts-node/esm
Patterns
- Use Zod for runtime validation and type inference (
)z.infer<typeof schema> - Prefer immutable patterns:
,readonly
,Readonly<T>ReadonlyArray<T> - Use the Result pattern (
) over thrown errors for expected failures{ok: true, data} | {ok: false, error} - Use branded types for domain primitives (UserId, Email)
- Use
/Map
over plain objects for dynamic key collectionsSet
Error Handling
- Create typed error classes extending
Error - Use
property for error chaining:causenew Error("msg", { cause: err }) - Never silently swallow errors
Testing
- Use Vitest (fast, ESM-native, TypeScript-first)
- Use
/describe
blocks with descriptive namesit - Mock with
andvi.mock()vi.spyOn() - Test types with
from VitestexpectTypeOf()