cc-skill-frontend-patterns

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

1|Updated Aug 17, 2025
One-click install
npx skills add https://github.com/ratnesh-maurya/mdconverter --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/mdconverter/tree/main/.claude/skills/cc-skill-frontend-patterns
Command: npx skills add https://github.com/ratnesh-maurya/mdconverter --skill cc-skill-frontend-patterns-ratnesh-maurya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Frontend developers often reinvent common solutions for component composition, data fetching, state management, and performance tuning, leading to inconsistent and hard-to-maintain React and Next.js 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 plus Reducer pattern for shared state. - Performance & Accessibility: Covers memoization, code splitting, list virtualization, error boundaries, Framer Motion animations, 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 rendering fast. ## Quick Start Ask the assistant to apply these frontend patterns to refactor a React component for better performance and accessibility.

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 implement compound components in React?

Create a parent component that holds shared state in a React Context, then expose child components like TabList and Tab that consume that context. Each child reads and updates the shared state, throwing an error if used outside the parent provider.

How to debounce search input in React?

Use a useDebounce hook that stores the value in state and updates it inside a setTimeout within useEffect, clearing the timer on each change. Pass the debounced value to your search effect so API calls only fire after the user stops typing.

When should I use Context with useReducer for state management?

Use Context plus useReducer when multiple components need shared state with predictable update logic, such as a market list with selection and loading flags. It suits medium-complexity apps where external state libraries would be excessive.

Does React.lazy work with Next.js applications?

React.lazy with Suspense works for client-side code splitting of heavy components like charts or 3D backgrounds. In Next.js you can also use dynamic imports, but the lazy and Suspense pattern shown here applies to client-rendered subtrees.

Why is my React list rendering slowly with many items?

Rendering thousands of DOM nodes at once causes slow performance. Use list virtualization with @tanstack/react-virtual to render only visible rows, and wrap pure item components in React.memo to avoid unnecessary re-renders.

How do I trap focus inside a modal for accessibility?

Store the previously focused element in a ref when the modal opens, move focus to the modal container, and restore focus on close. Add role="dialog", aria-modal="true", and handle the Escape key to close.