moai-ref-react-patterns

Identify reusable React/Next.js design patterns for component design, state management, and project structure.

Updated Apr 19, 2026
One-click install
npx skills add https://github.com/windysky/snake-game --skill moai-ref-react-patterns-windysky
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moai-ref-react-patterns
Source: https://github.com/windysky/snake-game/tree/main/.claude/skills/moai-ref-react-patterns
Command: npx skills add https://github.com/windysky/snake-game --skill moai-ref-react-patterns-windysky

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Frontend teams often struggle to apply consistent React/Next.js patterns across components, state management, and project structure. This guide provides a curated reference of proven design patterns to accelerate development and improve maintainability.

Core Features & Use Cases

  • Compound Components: share implicit state via Context to build cohesive UI primitives.
  • Custom Hooks (Extraction Pattern): encapsulate reusable logic like form handling, API calls, and localStorage interactions.
  • Container/Presentational Separation: divide data logic from UI for better testability.
  • Headless Components: provide behavior/state independent of UI to enable design-system agnostic implementations.
  • State Management Guidance: recommended tools (React Query, Zustand, Immer) and usage patterns for UI state, server state, and persistence.
  • Next.js App Router Patterns: structure and routing conventions to maximize modularity and performance.

Quick Start

Outline a production-ready React pattern blueprint for a Next.js project using compound components and custom hooks.

Frequently Asked Questions about moai-ref-react-patterns

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

FAQPage Schema
What are the best React patterns for structuring a maintainable Next.js app?

Production-ready React patterns for structuring a maintainable Next.js app include compound components, container/presentational separation, and custom hook extraction to align component design and state management with best practices for maintainability and scalability.

How do I separate data logic from UI in React components?

To separate data logic from UI in React components, apply the container/presentational separation pattern, which divides data fetching and state logic from rendering to improve component testability and maintainability.

Which state management tools should I use for server state and UI state in Next.js?

For state management in Next.js, use React Query for server state, Zustand for UI state, and Immer for persistence to ensure scalable and maintainable application architecture.

How do compound components share state in React?

Compound components share implicit state via Context in React to build cohesive UI primitives, allowing parent components to distribute state to children without prop drilling.

When should I use headless components in a React design system?

Use headless components in a React design system when you need to provide behavior and state independent of UI, enabling design-system agnostic implementations that separate logic from rendering.

How do I organize routing conventions using the Next.js App Router?

Organize routing conventions using Next.js App Router patterns to maximize project modularity and performance, ensuring structure aligns with scalable frontend development guidelines.