moai-ref-react-patterns

moai-ref-react-patterns is a skill for Claude Code, Codex from modu-ai/moai-adk. It costs 72 tokens per session (1,712 once invoked), scanned A, original, Apache-2.0.

A reference for designing React and Next.js components, organizing frontend code, and managing application state.

In plain words
What is it for?
Use it when building tabs, forms, dropdowns, data-fetching hooks, reusable components, or larger React applications.
Why use it?
It helps developers choose clear patterns for sharing behavior, separating data logic from display, and keeping components easier to test and reuse.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/modu-ai/moai-adk/moai-ref-react-patterns
Any agent
npx skills add modu-ai/moai-adk --skill moai-ref-react-patterns
Clone the repo
git clone --depth 1 https://github.com/modu-ai/moai-adk

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for moai-ref-react-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/modu-ai/moai-adk/moai-ref-react-patterns.svg)](https://agentmods.dev/skills/modu-ai/moai-adk/moai-ref-react-patterns)
Your own site
<a href="https://agentmods.dev/skills/modu-ai/moai-adk/moai-ref-react-patterns"><img src="https://agentmods.dev/badge/skills/modu-ai/moai-adk/moai-ref-react-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 72 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,712 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00072 $0.01712
Opus 5 $0.00036 $0.00856
Sonnet 5 $0.00014 $0.00342
Haiku 4.5 $0.00007 $0.00171

Measured 4d ago against content hash f603a0f75408, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

moai-ref-react-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/moai-ref-react-patterns/SKILL.md · 196 lines

How it starts

The opening of the file, as written. The whole thing — 196 lines — stays where its author put it; the contents beside it link to each section on GitHub.

React Patterns Reference

Target Spawn

Frontend domain work spawned via Agent(general-purpose) with frontend instructions - Applies these patterns directly to component design and state management.

Component Design Patterns

1. Compound Components

Parent and child share implicit state via Context.

Suited for: Tab, Accordion, Dropdown, Select Structure: <Select> + <Select.Trigger> + <Select.Option>

2. Custom Hooks (Extraction Pattern)

Extract state logic into reusable hooks.

Suited for: Form management, API calls, localStorage, debounce Naming: use prefix required - useForm, useDebounce, useAuth

3. Container/Presentational Separation

Separate data logic (Container) from UI (Presentational).

Suited for: Large apps, when testability is needed Container: Data fetch, state management, event handlers Presentational: Renders only from props, functionally pure

4. Headless Component

Provides behavior/state without UI.

Suited for: Design system-independent logic Examples: headless useCombobox, useDialog, useTable

State Management Selection Guide

State Type Tool Rationale
UI Local useState, useReducer Component-internal
Server State React Query / TanStack Query Caching, refetch, optimistic
Global Client Zustand Concise, minimal boilerplate
Complex Global Zustand + Immer Immutability convenience
URL State nuqs / useSearchParams Filters, pagination
Form State React Hook Form + Zod Integrated validation
Theme/i18n Context + Provider Low change frequency

Decision Flow

Restorable from URL? -> URL state (nuqs)
Server data? -> React Query
Shared across components? -> Zustand
Component-internal? -> useState
Complex transitions? -> useReducer

Next.js App Router Structure

src/
├── app/                    # App Router
│   ├── (auth)/             # Auth route group
│   │   ├── login/page.tsx
│   │   └── register/page.tsx
│   ├── (main)/             # Main route group
│   │   ├── dashboard/page.tsx
│   │   └── settings/page.tsx
│   ├── api/                # API Routes
│   ├── layout.tsx          # Root layout
│   └── page.tsx            # Home
├── components/
│   ├── ui/                 # Base UI (Button, Input, Modal)
│   └── features/           # Feature components
│       ├── auth/
│       └── dashboard/
├── hooks/                  # Custom hooks
├── lib/                    # Utilities, config
├── stores/                 # Zustand stores
├── types/                  # TypeScript types
└── styles/                 # Global styles

Read the full file on GitHub · 196 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 196 lines · 72 tokens per session scan A f603a0f75408

Subscribe to this mod's changes

moai-ref-react-patterns is a skill published in the GitHub repository modu-ai/moai-adk (1,197 stars, last pushed today), licensed Apache-2.0. It adds 72 tokens to every session and 1,712 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

nw-bugfix

Bug fix workflow: root cause analysis → user review → regression test + fix via TDD.

nWave-ai/nWave · 23 tokens

nw-ab-critique-dimensions

Review dimensions for validating agent quality - template compliance, safety, testing, and priority validation.

nWave-ai/nWave · 26 tokens

todos

This chat has a shared, live TODO plan — your tasks for the conversation, which the user also edits. Read this skill and reach for the todo tools whenever a request takes more than a couple of steps. It covers the plan model (group = task, items = its steps; loose items are the user's lane), how to work it: propose…

JetBrains/thinkrail · 127 tokens

reviewing-changes

Use when a review package asks you to review a plan step's change set (todo.startReview): you are the REVIEWER, not the author. How to judge an agent-written diff, file findings with addreviewcomment, and settle with exactly one reviewverdict.

JetBrains/thinkrail · 59 tokens

setting-up-a-project

Use whenever asked to set up, onboard, initialize, or spec a project — the front door when the workspace has no spec graph yet (brand-new or an existing codebase); also seeded by the app's Set-up-project card (/skill:setting-up-a-project). Not for feature work in an already-specced project — use the brainstorming…

JetBrains/thinkrail · 76 tokens

writing-specs

Use when a workflow step drafts or revises a spec artifact — a goal-and-requirements, an architecture, or a module SPEC — or when a workflow skill names it at such a step. The shared quality bar for specs — not a workflow, nothing to execute.

JetBrains/thinkrail · 59 tokens