asyrafhussin avatar

Typescript React Patterns

A comprehensive reference for typing React components, hooks, and patterns with TypeScript. You'll want this when dealing with props interfaces, event handlers, refs, generic components, or really any time TypeScript is yelling at you in a React codebase. It covers 33 rules across seven categories, from critical patterns like component props and hook typing to more specialized cases like polymorphic components and discriminated unions. The practical examples are solid, especially the typed context pattern with null checking and the generic list component. It's basically the TypeScript React Cheatsheet distilled into agent-friendly rules, which means less time searching Stack Overflow when you forget how to properly type a form onChange handler for the hundredth time.

skills.sh installs
1.1K
GitHub stars
102
last updated
Aug 21, 2026

Install

$ npx -y skills add asyrafhussin/agent-skills --skill typescript-react-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

TypeScript React Patterns

Type-safe React with TypeScript. Contains 33 rules across 7 categories covering component typing, hooks, event handling, refs, generics, context, and utility types.

Metadata

  • Version: 2.0.0
  • Rule Count: 33 rules across 7 categories
  • License: MIT

When to Apply

Reference these guidelines when:

  • Typing React component props
  • Creating custom hooks with TypeScript
  • Handling events with proper types
  • Working with refs (DOM, mutable, imperative)
  • Building generic, reusable components
  • Setting up typed Context providers
  • Fixing TypeScript errors in React code

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Component TypingCRITICALcomp-
2Hook TypingCRITICALhook-
3Event HandlingHIGHevent-
4Ref TypingHIGHref-
5Generic ComponentsMEDIUMgeneric-
6Context & StateMEDIUMctx-
7Utility TypesLOWutil-

Quick Reference

1. Component Typing (CRITICAL)

Sponsors

Details

Repository
github.com/asyrafhussin/agent-skills
Categories
Frontend Development, Documentation, AI & Agent Building
First seen
Jun 3, 2026

More from asyrafhussin/agent-skills

All 14
1mindrally avataroptimized-nextjs-typescriptmindrally/skillsOptimized Next.js TypeScript best practices with modern UI/UX, focusing on performance, security, and clean architecture1Kskills.sh installs
2patternsdev avatarreact-selective-hydrationpatternsdev/skillsTeaches selective hydration combined with streaming SSR in React 18+. Use when you need to prioritize hydrating interactive components while streaming the rest 1Kskills.sh installs
3mindrally avatarreactmindrally/skillsExpert in React development with modern patterns, hooks, and performance optimization976skills.sh installs
4patternsdev avatarstreaming-ssrpatternsdev/skillsTeaches streaming server-side rendering for chunked HTML delivery. Use when you need faster Time to First Byte and First Contentful Paint by streaming HTML as i938skills.sh installs
5sergiodxa avatarfrontend-accessibility-best-practicessergiodxa/agent-skillsAccessibility (a11y) best practices for React components. Use when creating UI components, forms, interactive elements, or reviewing code for accessibility comp896skills.sh installs
6framara avatarreact-flowframara/react-flow-skillExpert guidance for React Flow (@xyflow/react): building interactive node-based graphs, custom nodes and edges, handles, state management, layouting, TypeScript857skills.sh installs