cc-skill-frontend-patterns

Implements React and Next.js component, state management, and performance optimization patterns.

1|Updated Dec 29, 2025
One-click install
npx skills add https://github.com/ratnesh-maurya/tracker.ratnesh-maurya.com --skill cc-skill-frontend-patterns-ratnesh-maurya
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cc-skill-frontend-patterns
Source: https://github.com/ratnesh-maurya/tracker.ratnesh-maurya.com/tree/main/.claude/skills/cc-skill-frontend-patterns
Command: npx skills add https://github.com/ratnesh-maurya/tracker.ratnesh-maurya.com --skill cc-skill-frontend-patterns-ratnesh-maurya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Frontend developers often reinvent solutions for common UI challenges like state management, data fetching, form validation, and list performance, leading to inconsistent and hard-to-maintain code. ## Core Features & Use Cases - Component Patterns: Provides composition, compound components, and render props implementations for reusable React UI structures. - Custom Hooks & State Management: Includes useToggle, useQuery, useDebounce hooks and Context + Reducer patterns for predictable state handling. - Performance & Accessibility: Covers memoization, code splitting, list virtualization, keyboard navigation, and focus management. - Use Case: When building a dashboard with a long scrollable list of items, apply the virtualization pattern with @tanstack/react-virtual to render only visible rows and keep the UI responsive. ## Quick Start Ask the AI to apply the frontend patterns skill to refactor a React component using composition, debounced search, and memoization.

Frequently Asked Questions about cc-skill-frontend-patterns

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

FAQPage Schema
How do I manage state in React without external libraries?▼

Use the Context + Reducer pattern to combine React's createContext with useReducer for centralized state. Define typed actions and a reducer function, then expose state and dispatch through a custom hook like useMarkets.

How to debounce search input in React?▼

Create a useDebounce hook that delays updating a value using setTimeout inside useEffect, clearing the timer on each change. Pass the raw input value and a delay like 500ms, then trigger searches only when the debounced value settles.

What React pattern works best for reusable tab components?▼

Compound components work best for tabs because they share implicit state through context while keeping a flexible JSX API. A Tabs provider tracks the active tab, and child Tab components read and update it via useContext.

Does React virtualization help with long lists?▼

Yes, virtualization renders only visible rows instead of the full list, dramatically reducing DOM nodes. Libraries like @tanstack/react-virtual calculate item positions and sizes, keeping scrolling smooth for thousands of entries.

When should I use React.memo and useCallback?▼

Use React.memo for pure components that re-render unnecessarily when parents update, and useCallback for functions passed as props to memoized children. Apply them only after identifying actual performance bottlenecks, since premature memoization adds complexity.

How do I make a modal accessible in React?▼

Manage focus by saving the previously focused element, moving focus into the modal on open, and restoring it on close. Add role="dialog", aria-modal="true", and handle the Escape key to close.