frontend-typescript-rules

Installation
SKILL.md

TypeScript Development Rules (Frontend)

Frontend-specific React/TypeScript rules for implementation: thresholds, boundary type safety, component/state design, error handling, and project conventions.

Anti-patterns and Thresholds

Signals that trigger a design change:

  • Prop drilling through 3+ levels → lift to Context or state management
  • Component over 300 lines → split
  • Props count over 10 → split the component (3-7 is the working range)
  • Optional props over 50% → introduce defaults or Context
  • Props nesting deeper than 2 levels → flatten
  • The same as assertion appearing 3+ times → revisit the type design

Type Safety at Boundaries

Prohibit any; when a type is unavailable, receive it as unknown and narrow with a type guard. Minimize as (justify with a comment when unavoidable).

Inside the app, React Props/State are type-guaranteed — no unknown needed. At every external boundary, receive as unknown and narrow with a type guard before use: API responses, localStorage/sessionStorage, URL parameters, parsed JSON. Controlled-component form input stays type-safe through React synthetic events.

Installs
8
GitHub Stars
225
First Seen
Mar 14, 2026
frontend-typescript-rules — shinpr/ai-coding-project-boilerplate