typescript-rules
Installation
SKILL.md
TypeScript Development Rules
Prerequisite Detection
Inspect tsconfig, runtime/framework configuration, lint/format configuration, path aliases, package scripts, and representative modules before applying project conventions. Treat a rule as project-specific only when configuration or an established pattern supports it. Label limited-pattern conclusions as inferred. When competing conventions change a public contract, runtime behavior, or error boundary, stop and name the source or user decision required.
Type Safety in Backend Implementation
Type Safety in Data Flow
Input Layer (unknown) -> Type Guard -> Business Layer (Type Guaranteed) -> Output Layer (Serialization)
Backend-Specific Type Scenarios:
- API Communication: Receive responses as
unknownand validate them with type guards - Form Input: External input as
unknown, type determined after validation - Legacy Integration: Receive the legacy boundary as
unknown; isolate any evidence-backed assertion in the adapter that owns the boundary - Test Code: Define mock input/output types with the configured test harness; use
Partial<T>for intentionally partial fixtures and typedvi.fn<[Args], Return>()only when Vitest is configured