frontend-patterns
Frontend development patterns for React, Next.js, state management, performance optimization, and UI best practices.
Security Assessment
About frontend-patterns
Frontend Patterns is a guidance skill that collects modern React and Next.js development patterns into a single reference. It solves the problem of inconsistent, hard-to-maintain frontend code by demonstrating well-established idioms for component design, state management, data fetching, and performance, each illustrated with TypeScript examples. It is meant to activate when building components, managing state, fetching data, optimizing rendering, handling forms, or building accessible, responsive UI.
The single SKILL.md document walks through component patterns (composition over inheritance, compound components using Context, and render props), custom hooks (a toggle hook, an async data-fetching useQuery hook with ref-based stability to avoid infinite fetch loops, and a debounce hook), and state-management approaches (Context plus reducer, with mentions of Zustand and React Query for larger apps). Data fetching, memoization, virtualization, code splitting, form validation with Zod, and client-side routing are named as in-scope concerns. The examples are practical and emphasize correct dependency handling and referential stability.
It targets React and Next.js developers—particularly those working on component libraries or performant single-page and server-rendered apps—who want a consistent set of conventions to follow or to guide an AI assistant. It is documentation only, with no scripts or tooling, so it acts as a pattern catalogue and teaching aid rather than an automated generator. Its origin metadata marks it as part of the "ECC" collection.
FAQ
Which frameworks and libraries does it cover?
React and Next.js primarily, with references to state tools (useState, useReducer, Context, Zustand), data fetching (SWR, React Query, server components), and Zod for form validation.
Is this an installable tool or just guidance?
It is guidance only—a single SKILL.md of patterns and TypeScript code examples. There are no scripts to run.
What problems do the custom hook examples address?
The useQuery example specifically shows how to keep the refetch callback referentially stable using refs so inline fetchers and option objects do not trigger an infinite re-fetch loop; other hooks cover toggling state and debouncing input.
When should the skill be activated?
When building React components, managing client state, implementing data fetching, optimizing rendering performance, working with forms, or building accessible/responsive UI.
Does it prescribe a specific state management library?
No single mandate; it demonstrates Context+reducer and mentions Zustand and TanStack/React Query, letting you choose based on app complexity.
Install frontend-patterns
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
affaan-m/ecc