dev-workflows-fullstack/skills/typescript-rules/SKILL.md
React/TypeScript frontend development rules including type safety, component design, state management, and error handling. Use when implementing React components, TypeScript code, or frontend features.
npx skillsauth add shinpr/claude-code-workflows typescript-rulesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
Security scan pending...
This skill is queued for security scanning. Results will appear when the scan completes.
Code first: names and types carry meaning; a comment must add what code cannot, and one comment per decision is enough.
Default Rule: Prefer unknown, generics, or union types over any. Retain any only when an existing external, generated, or legacy public signature requires it, or when replacing it prevents the project type check from expressing a safe generic relationship. Record the declaration path or type-check result that proves the constraint. When a local adapter can preserve compatibility and expose a safer type within the user request or current task/design artifact, implement the adapter; otherwise confine any to the smallest adapter or public-signature boundary, document the reason, and validate untrusted data before it enters typed application code.
Frontend Boundaries
unknown and validate at the boundary. A generated client may retain its declared type when it also enforces the contract at runtime.localStorage / sessionStorage: handle string | null; treat parsed data as unknown until validated.Type Complexity Review Signals
Use these as review prompts, not pass/fail thresholds. Existing project conventions and the component's responsibility take precedence.
Component and File Decisions
Server/Client Boundary — only for RSC frameworks
"use client" boundary that needs it.State Ownership
Function and Props Boundaries
Environment Variables
Client Security
Asynchronous Processing
async/await when it clarifies sequencing and error propagation.Formatting
Every caught error has one intentional outcome: propagate it, convert it to the repository's typed boundary result, or represent it as user-facing error state. Preserve context and log once at the boundary that owns diagnosis or recovery, with sensitive data redacted.
React.memo, useMemo, or useCallback only for a measured bottleneck or a required stable identity at an external API/effect boundary.testing
Clarifies inputs, outputs, success criteria, decisions, and unresolved conditions so downstream agents can execute without guessing. Use when writing or revising LLM-facing prompts, handoffs, planning artifacts, reviews, reports, or generated instructions.
testing
Clarifies inputs, outputs, success criteria, decisions, and unresolved conditions so downstream agents can execute without guessing. Use when writing or revising LLM-facing prompts, handoffs, planning artifacts, reviews, reports, or generated instructions.
testing
Clarifies inputs, outputs, success criteria, decisions, and unresolved conditions so downstream agents can execute without guessing. Use when writing or revising LLM-facing prompts, handoffs, planning artifacts, reviews, reports, or generated instructions.
testing
Clarifies inputs, outputs, success criteria, decisions, and unresolved conditions so downstream agents can execute without guessing. Use when writing or revising LLM-facing prompts, handoffs, planning artifacts, reviews, reports, or generated instructions.