frontend-patterns

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

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/diazMelgarejo/orama-system --skill frontend-patterns-diazmelgarejo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frontend-patterns
Source: https://github.com/diazMelgarejo/orama-system/tree/main/.cursor/.agents/skills/frontend-patterns
Command: npx skills add https://github.com/diazMelgarejo/orama-system --skill frontend-patterns-diazmelgarejo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Frontend developers often reinvent solutions for common UI challenges like component composition, async data fetching, form validation, and list performance, leading to inconsistent and buggy code. This Skill provides proven, copy-ready TypeScript patterns for React and Next.js so you can build maintainable interfaces without trial and error. ## Core Features & Use Cases - Component & Hook Patterns: Composition, compound components, render props, and reusable hooks like useToggle, useQuery, and useDebounce. - State & Performance: Context + Reducer state management, memoization with useMemo/useCallback/React.memo, code splitting, and list virtualization with @tanstack/react-virtual. - Forms, Errors & Accessibility: Controlled form validation, error boundaries, Framer Motion animations, keyboard navigation, and focus management. - Use Case: When building a dashboard with a long scrollable list of items, apply the virtualization pattern to render only visible rows and the lazy-loading pattern to defer heavy chart components. ## Quick Start Ask the AI to apply frontend-patterns to build a React component with debounced search, memoized sorting, and an accessible dropdown.

Frequently Asked Questions about frontend-patterns

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

FAQPage Schema
How do I optimize React list rendering performance?

Use virtualization with @tanstack/react-virtual to render only visible rows in long lists, combined with React.memo on row components and useMemo for expensive computations like sorting. This avoids rendering thousands of DOM nodes at once.

How to fetch data in React with a custom hook?

Create a useQuery hook that manages data, loading, and error states with useState, and stores the fetcher in a ref to keep the refetch callback referentially stable. This prevents infinite fetch loops caused by inline function props changing every render.

When should I use Context vs Zustand for state management?

Context with useReducer works well for localized state shared within a component subtree, such as a market selection panel. For global state accessed across many unrelated components, an external store like Zustand avoids provider nesting and unnecessary re-renders.

Why does my React useEffect run in an infinite loop?

Infinite loops happen when effect dependencies are inline objects or functions recreated each render. Store them in refs updated in a separate effect, and keep the main effect's dependency array limited to stable primitive values.

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 previously focused element on close, and handle the Escape key to dismiss. Trap keyboard focus within the modal while it is open.