react-rules
dlupiak/claude-session-dashboard/.claude/skills/react-rules/SKILL.md
React and component patterns
Skill66 starsChanged 7 months ago
What's in it
- React Rules
- Components
- Data Fetching
- State
- Patterns
- File Naming
- Slice Boundaries (enforced by automated tests)
---
name: react-rules
description: React and component patterns
user-invocable: false
---
# 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 `className` with 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 `useEffect` for data fetching
- Prefetch on the server with `queryClient.prefetchQuery` in 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.tsx` or grouped in `ui.tsx` within a slice
- Hooks: `use-kebab-case.ts` (must start with `use` prefix — 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.ts` facade, not from internal files
- Route files must be thin — compose from slice hooks and components, don't import from `domain/` or `infra/` directly
- Example: `import { useAgents } from '@/features/registry/model'` (correct) vs `import { useAgents } from '@/features/registry/hooks/useAgents'` (wrong from outside registry)
More agent context in dlupiak/claude-session-dashboard
17 other files this repository gives its agents.
CLAUDE.md
Skill
- analyze-skills.claude/skills/analyze-skills/SKILL.md
- dashboard.claude/skills/dashboard/SKILL.md
- feature.claude/skills/feature/SKILL.md
- fix-ci.claude/skills/fix-ci/SKILL.md
- fix-issue.claude/skills/fix-issue/SKILL.md
- investigate.claude/skills/investigate/SKILL.md
- open-issue.claude/skills/open-issue/SKILL.md
- playwright-cli.claude/skills/playwright-cli/SKILL.md
- quality-check.claude/skills/quality-check/SKILL.md
- review.claude/skills/review/SKILL.md
- sdlc.claude/skills/sdlc/SKILL.md
- ship.claude/skills/ship/SKILL.md
- tanstack-start.claude/skills/tanstack-start/SKILL.md
- testing.claude/skills/testing/SKILL.md
- typescript-rules.claude/skills/typescript-rules/SKILL.md
- uiux.claude/skills/uiux/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

