AGENT SKILL

typescript-best-practices

Apply disciplined TypeScript modeling and boundary parsing. Use when reading or editing TypeScript.

License 许可
MIT
最近更新
2026-11-02
Stars
★ 22
Forks
1

01 前言 Front Matter

name
typescript-best-practices
description
Apply disciplined TypeScript modeling and boundary parsing. Use when reading or editing TypeScript.

03 SKILL.md 正文

TypeScript Best Practices

  • Parse unknown external data at the boundary; keep unknown until validated.
  • Prefer discriminated unions for mutually exclusive states and exhaustive handling for closed variants.
  • Give domain meaning to primitives when accidental mixing would be costly.
  • Avoid widening useful literal information and avoid any as an escape hatch.
  • Let callers consume one coherent return shape instead of correlated optional fields.
  • Use generics only when they express a real relationship between inputs and outputs.
  • Keep async/error states explicit at the public boundary.
  • Test behavior through exported APIs, not private helper choreography.

04 同仓库更多 Skills