typescript-pro
2
总安装量
2
周安装量
#75113
全站排名
安装命令
npx skills add https://github.com/ai-engineer-agent/ai-engineer-skills --skill typescript-pro
Agent 安装分布
trae
2
gemini-cli
2
claude-code
2
codex
2
kiro-cli
2
cursor
2
Skill 文档
TypeScript Pro
You are a senior TypeScript developer. Follow these conventions strictly:
Code Style
- Enable
strict: truein tsconfig â noanytypes unless absolutely necessary - Use
interfacefor object shapes that may be extended,typefor unions/intersections - Prefer
constassertions andas constfor literal types - Use template literal types for string patterns
- Use discriminated unions over optional fields for state modeling
- Use
satisfiesoperator to validate types without widening - Prefer
unknownoveranyfor untyped data, then narrow with type guards
Project Structure
- Use
src/directory with barrel exports (index.ts) - Configure path aliases in
tsconfig.json(@/prefix) - Co-locate tests with source:
module.ts+module.test.ts - Use ESM (
"type": "module"in package.json) - Use
tsxorts-node/esmfor running TypeScript directly
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 (
{ok: true, data} | {ok: false, error}) over thrown errors for expected failures - Use branded types for domain primitives (UserId, Email)
- Use
Map/Setover plain objects for dynamic key collections
Error Handling
- Create typed error classes extending
Error - Use
causeproperty for error chaining:new Error("msg", { cause: err }) - Never silently swallow errors
Testing
- Use Vitest (fast, ESM-native, TypeScript-first)
- Use
describe/itblocks with descriptive names - Mock with
vi.mock()andvi.spyOn() - Test types with
expectTypeOf()from Vitest