Agent skill
react-rules
React and component patterns
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/react-rules
SKILL.md
React Rules
Components
- Use named exports, not default exports:
export function AgentCard() {} - One component per file for route-level components
- Co-locate small helper components in the same file
- Use
classNamewith Tailwind — no CSS modules or styled-components
Data Fetching
- Use TanStack Query (
useQuery,useSuspenseQuery) for all data fetching - Server Functions for mutations via
useMutation - Never use
useEffectfor data fetching - Prefetch on the server with
queryClient.prefetchQueryin route loaders
State
- URL state first (search params via TanStack Router)
- Server state via TanStack Query (no Redux, no Zustand)
- Local UI state only with
useState— keep it minimal - Form state with controlled components or
useForm
Patterns
- Suspense boundaries at route level, not per-component
- Error boundaries for slice-level error handling
- Compose with props, not render props or HOCs
- Use shadcn/ui components — don't build custom UI primitives
File Naming
- Route files:
route.tsx(TanStack Router file-based routing) - UI components:
PascalCase.tsxor grouped inui.tsxwithin a slice - Hooks:
use-kebab-case.ts(must start withuseprefix — enforced by architecture tests)
Slice Boundaries (enforced by automated tests)
- Never import a component from another feature's
ui/directory directly - Shared UI primitives go in
src/components/ui/(shadcn convention) - Cross-slice data: import hooks/types from the other slice's
model.tsfacade, not from internal files - Route files must be thin — compose from slice hooks and components, don't import from
domain/orinfra/directly - Example:
import { useAgents } from '@/features/registry/model'(correct) vsimport { useAgents } from '@/features/registry/hooks/useAgents'(wrong from outside registry)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?