mirror of
https://github.com/duthaho/claudekit.git
synced 2026-09-05 17:50:51 +03:00
2.9 KiB
2.9 KiB
name, description
| name | description |
|---|---|
| frontend | Use when building React components, Next.js applications, or shadcn/ui interfaces — including hooks, useState, useEffect, useCallback, useMemo, Server Components, App Router, Server Actions, SSR, SSG, ISR, Radix primitives, cn() utility, next/navigation, or component architecture. |
Frontend
When to Use
- Building React components, custom hooks, or managing component state
- Next.js App Router, Server Components, Server Actions, route handlers
- shadcn/ui components with Radix primitives and react-hook-form
- Client-side interactivity, context providers, or component composition
- SEO-critical sites needing SSR/SSG/ISR
When NOT to Use
- Styling and accessibility — use
frontend-styling - Backend API development — use
backend-frameworks - State management architecture decisions — use
state-management
Quick Reference
| Topic | Reference | Key features |
|---|---|---|
| React | references/react.md |
Hooks, memo, context, composition, effect cleanup, custom hooks |
| Next.js | references/nextjs.md |
App Router, Server Components, Server Actions, loading.tsx, middleware |
| shadcn/ui | references/shadcn-ui.md |
Radix primitives, cn(), asChild, CSS variables, Zod forms |
Best Practices
- Keep components small and single-purpose (~100 lines max).
- Use TypeScript interfaces for all props. Avoid
any. - Clean up all effects. Return cleanup from every
useEffectthat subscribes to events or starts timers. - Derive state instead of syncing it. Compute from props/state during render or with
useMemo. - Default to Server Components — only add
"use client"when you need interactivity (Next.js). - Colocate data fetching with the component that uses it (Next.js).
- Use
loading.tsxfor instant loading states (Next.js). - Validate Server Action inputs — Server Actions are public HTTP endpoints (Next.js).
- Install shadcn/ui components individually — only add what you need.
- Use
cn()for all conditional styling (shadcn/ui). - Keep forms type-safe end to end — Zod schema + inferred type +
useForm<T>(shadcn/ui).
Common Pitfalls
- Missing or wrong dependency arrays in hooks.
- Setting state during render — causes infinite loops.
- Using
useEffectfor derived state — causes double renders; compute inline instead. - Using hooks in Server Components (Next.js).
- Large client bundles from misplaced
"use client"(Next.js). - Stale data from aggressive caching (Next.js).
- Forgetting
"use client"for shadcn/ui components in Next.js App Router. - Hardcoded colors instead of CSS variables (shadcn/ui).
Related Skills
frontend-styling— Tailwind CSS and accessibilitystate-management— State architecture decisionserror-handling— Error boundaries in React