返回 Skill 列表
extension
分类: 开发与工程无需 API Key

type-safety-audit

审核TypeScript代码以确保类型安全的最佳实践 - 不使用any类型,为ID使用品牌类型,运行时验证,正确的类型缩小。在提交TypeScript代码之前或在类型系统审查期间使用。

person作者: jakexiaohubgithub

TypeScript Type Safety Audit Skill

Purpose

Audit TypeScript code for type safety best practices. This skill ensures the type system is leveraged correctly to catch bugs at compile-time, prevent runtime type errors, and maintain type safety across API boundaries.

What This Skill Checks

Critical Violations (Block Commit)

  1. Any Type Usage - Zero tolerance policy
  2. Missing Branded Types - IDs must be branded
  3. Missing Runtime Validation - API boundaries need validation
  4. Type Assertions - Prefer type guards
  5. Unsafe Null Handling - Check for null/undefined
  6. Weak Generic Constraints - Generics need constraints
  7. Non-Strict tsconfig - Must have strict mode

For detailed checks with code examples and rationale, see references/CHECKS-REFERENCE.md.

  • Hermes Code Reviewer: Type Safety Patterns