frontend-patterns

Implements React and Next.js patterns for components, hooks, state management, and performance optimization.

1|Updated May 10, 2026
One-click install
npx skills add https://github.com/Tgoldi/claude-skills --skill frontend-patterns-tgoldi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frontend-patterns
Source: https://github.com/Tgoldi/claude-skills/tree/main/frontend-patterns
Command: npx skills add https://github.com/Tgoldi/claude-skills --skill frontend-patterns-tgoldi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Frontend developers often reinvent common solutions for component design, data fetching, state management, and performance tuning, leading to inconsistent and hard-to-maintain React codebases. ## Core Features & Use Cases - Component Patterns: Provides composition, compound components, and render props implementations with TypeScript examples. - Custom Hooks & State Management: Includes useToggle, useQuery, useDebounce hooks and a Context + Reducer pattern for shared state. - Performance & Accessibility: Covers memoization, code splitting, list virtualization with @tanstack/react-virtual, keyboard navigation, and focus management. - Use Case: When building a dashboard with a long market list, apply the virtualization pattern with @tanstack/react-virtual and lazy-load heavy chart components to keep initial render fast. ## Quick Start Ask the assistant to apply the frontend-patterns skill to refactor a React component using compound components and memoization.

Frequently Asked Questions about frontend-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement compound components in React?

Create a parent component that holds shared state in a React Context, then expose child components that consume that context. The Tabs example shows a Tabs provider with TabList and Tab children communicating through TabsContext.

How to optimize React list rendering performance?

Use list virtualization with @tanstack/react-virtual to render only visible rows, memoize expensive computations with useMemo, and wrap pure components in React.memo. Lazy-load heavy components with React.lazy and Suspense.

When should I use Context with useReducer instead of useState?

Use Context with useReducer when multiple components share complex state with several update actions. It centralizes state transitions in a reducer function, making updates predictable and avoiding prop drilling across the tree.

Does React.lazy work with any component?

React.lazy works with default-exported components loaded via dynamic import. It must be wrapped in a Suspense boundary with a fallback UI, and it only code-splits client-side rendering bundles.

How do I make a React modal accessible?

Add role="dialog" and aria-modal="true", move focus into the modal on open, restore focus to the previous element on close, and handle the Escape key to dismiss. The focus management pattern demonstrates this with useRef and useEffect.