claude-code-configs / claude-config-composer
CLAUDE.md622 starsChanged 15 months agoMITView on GitHub
This configuration combines: Next.js 15, shadcn/ui Combined from: Next.js 15, shadcn/ui This is a Next.js 15 application using: - App Router (not Pages Router) - React 19 with Server Components by default - TypeScript for type safety - Tailwind CSS for styling (if configured) - Server Actions for mutations - Turbopack for faster builds (optional) This is a shadcn/ui project focused on: - Component-first development with copy-paste architecture - Radix UI primitives for behavior and accessibility - Tailwind CSS for…
The file
We split this CLAUDE.md into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Sanitize user input: before rendering
- Very specific: line 84
Update React types: "@types/react": "^19.0.0"
- Very specific: line 86
useFormState→useActionState: Import from 'react' not 'react-dom' - Very specific: line 107
Update tsconfig.json for stricter checking
- Distinctive: line 108
Use new TypeScript features like const type parameters
- Very specific: line 112
Always use these file names in the app/ directory:
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Composed Claude Code Configuration
This configuration combines: Next.js 15, shadcn/ui
Project Context
Combined from: Next.js 15, shadcn/ui
This is a Next.js 15 application using:
- App Router (not Pages Router)
- React 19 with Server Components by default
- TypeScript for type safety
- Tailwind CSS for styling (if configured)
- Server Actions for mutations
- Turbopack for faster builds (optional) This is a shadcn/ui project focused on:
- Component-first development with copy-paste architecture
- Radix UI primitives for behavior and accessibility
- Tailwind CSS for utility-first styling
- TypeScript for type-safe component APIs
- React 18/19 with modern patterns (Server Components when applicable)
- Accessibility-first design with full keyboard and screen reader support
Security Best Practices
Combined from: Next.js 15, shadcn/ui
- Always validate Server Actions input with Zod or similar
- Authenticate and authorize in Server Actions and middleware
- Sanitize user input before rendering
- Use environment variables correctly:
NEXT_PUBLIC_*for client-side- Others stay server-side only
- Implement rate limiting for public actions
- Configure CSP headers in next.config.js
- Sanitize user input in dynamic content
- Validate form data with Zod schemas
- Use TypeScript for type safety
- Escape HTML in user-generated content
- Implement CSP headers when applicable
Performance Optimization
- Use Server Components to reduce bundle size
- Implement streaming with Suspense boundaries
- Optimize images with next/image component
- Use dynamic imports for code splitting
- Configure proper caching strategies
- Enable Partial Prerendering (experimental) when stable
- Monitor Core Web Vitals
⚠️ Breaking Changes from Next.js 14
Async Request APIs:
params,searchParams,cookies(), andheaders()are now async// ❌ OLD (Next.js 14) export default function Page({ params, searchParams }) { const id = params.id; } // ✅ NEW (Next.js 15) export default async function Page({ params, searchParams }) { const { id } = await params; const { query } = await searchParams; } // Server Actions and API Routes import { cookies, headers } from 'next/headers'; export async function GET() { const cookieStore = await cookies(); const headersList = await headers(); const token = cookieStore.get('auth'); const userAgent = headersList.get('user-agent'); }- React 19 Required: Minimum React version is 19.0.0
- Update package.json:
"react": "19.0.0" - Update React types:
"@types/react": "^19.0.0"
- Update package.json:
useFormState→useActionState: Import from 'react' not 'react-dom'// ❌ OLD import { useFormState } from 'react-dom'; // ✅ NEW import { useActionState } from 'react';- Fetch Caching: Fetch requests are no longer cached by default
// ❌ OLD (cached by default) const data = await fetch('/api/data'); // ✅ NEW (explicit caching required) const data = await fetch('/api/data', { next: { revalidate: 3600 } // Cache for 1 hour }); - TypeScript 5+: Minimum TypeScript version is 5.0
- Update tsconfig.json for stricter checking
- Use new TypeScript features like const type parameters
2. File Conventions
Always use these file names in the app/ directory:
page.tsx- Route page componentlayout.tsx- Shared layout wrapperloading.tsx- Loading UI (Suspense fallback)error.tsx- Error boundary (must be Client Component)not-found.tsx- 404 pageroute.ts- API route handlertemplate.tsx- Re-rendered layoutdefault.tsx- Parallel route fallback
3. Data Fetching Patterns
// ✅ GOOD: Fetch in Server Component
async function ProductList() {
const products = await db.products.findMany();
return <div>{/* render products */}</div>;
}
// ❌ AVOID: Client-side fetching when not needed
'use client';
function BadPattern() {
const [data, setData] = useState(null);
useEffect(() => { fetch('/api/data')... }, []);
}3. Installation Patterns
## 3. Animation Performance
```tsx
// Use CSS transforms for animations
className="transition-transform hover:scale-105"
// Avoid layout shifts
className="transform-gpu"Testing Approach
- Unit tests: Jest/Vitest for logic and utilities
- Component tests: React Testing Library
- E2E tests: Playwright or Cypress
- Server Components: Test data fetching logic separately
- Server Actions: Mock and test validation/business logic
Testing
npm run test
1. Component Testing
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
test('button click', async () => {
const user = userEvent.setup()
const handleClick = jest.fn()
render(<Button onClick={handleClick}>Click me</Button>)
await user.click(screen.getByRole('button'))
expect(handleClick).toHaveBeenCalledTimes(1)
})2. Accessibility Testing
import { axe } from 'jest-axe'
test('no accessibility violations', async () => {
const { container } = render(<Card>Content</Card>)
const results = await axe(container)
expect(results).toHaveNoViolations()
})Deployment Checklist
- Environment variables configured
- Database migrations run
- Build succeeds locally
- Tests pass
- Security headers configured
- Error tracking setup (Sentry)
- Analytics configured
- SEO metadata in place
- Performance monitoring active
Debugging Tips
- Check Radix UI data attributes for component state
- Use React DevTools to inspect component props
- Verify Tailwind classes are being applied
- Check CSS variable values in browser DevTools
- Test keyboard navigation manually
- Validate ARIA attributes with accessibility tools
Resources
- shadcn/ui Documentation
- Radix UI Documentation
- Tailwind CSS Documentation
- CVA Documentation
- React Hook Form
- TanStack Table
- Recharts
Remember: Beautiful, Accessible, Customizable, and Yours!
Next.js 15 Development Assistant
You are an expert Next.js 15 developer with deep knowledge of the App Router, React Server Components, and modern web development best practices.
1. Server Components First
- Default to Server Components - Only use Client Components when you need interactivity
- Data fetching on the server - Direct database access, no API routes needed for SSR
- Zero client-side JavaScript for static content
- Async components are supported and encouraged
4. Caching Strategy
- Use
fetch()with Next.js extensions for HTTP caching - Configure with
{ next: { revalidate: 3600, tags: ['products'] } } - Use
revalidatePath()andrevalidateTag()for on-demand updates - Consider
unstable_cache()for expensive computations
Development
Combined from: Next.js 15, shadcn/ui
npm run dev # Start dev server with hot reload
npm run dev:turbo # Start with Turbopack (faster)
npm run build # Production build
npm run start # Start production server
npm run lint # Run ESLint
npm run type-check # TypeScript validationCode Generation
npx create-next-app@latest # Create new app
npx @next/codemod@latest # Run codemods for upgradesProject Structure
app/
├── (auth)/ # Route group (doesn't affect URL)
├── api/ # API routes
│ └── route.ts # Handler for /api
├── products/
│ ├── [id]/ # Dynamic route
│ │ ├── page.tsx
│ │ ├── loading.tsx
│ │ └── error.tsx
│ └── page.tsx
├── layout.tsx # Root layout
├── page.tsx # Home page
└── globals.css # Global stylesServer Action with Form
// actions.ts
'use server';
export async function createItem(prevState: any, formData: FormData) {
// Validate, mutate, revalidate
const validated = schema.parse(Object.fromEntries(formData));
await db.items.create({ data: validated });
revalidatePath('/items');
}
// form.tsx
'use client';
import { useActionState } from 'react';
export function Form() {
const [state, formAction] = useActionState(createItem, {});
return <form action={formAction}>...</form>;
}Optimistic Updates
'use client';
import { useOptimistic } from 'react';
export function OptimisticList({ items, addItem }) {
const [optimisticItems, addOptimisticItem] = useOptimistic(
items,
(state, newItem) => [...state, newItem]
);
// Use optimisticItems for immediate UI update
}shadcn/ui Development Assistant
You are an expert shadcn/ui developer with deep knowledge of React component architecture, Tailwind CSS, Radix UI primitives, and modern web accessibility standards. You specialize in building beautiful, accessible, and performant UI components following shadcn/ui patterns and conventions.
Memory Integration
This CLAUDE.md follows Claude Code memory management patterns:
- Project memory - Shared shadcn/ui component patterns with team
- Component library - Reusable UI component definitions
- Design system - Consistent styling and accessibility standards
- Auto-discovery - Loaded when working with components/ui/ files
Available Commands
Project-specific slash commands for shadcn/ui development:
/shadcn-add [component]- Add shadcn/ui component to project/shadcn-theme [variant]- Update theme configuration/shadcn-custom [name]- Create custom component following patterns/shadcn-compose [components]- Compose complex component from primitives/shadcn-test [component]- Generate accessibility and unit tests
Core Technologies
- React 18/19 - Component framework
- TypeScript - Type-safe development
- Tailwind CSS v3.4+ - Utility-first styling
- Radix UI - Unstyled, accessible primitives
- Class Variance Authority (CVA) - Component variants
- tailwind-merge - Intelligent class merging
- clsx - Conditional classes
- Lucide React - Icon system
Framework Support
- Next.js 13-15 (App Router preferred)
- Vite with React
- Remix with React Router
- Astro with React integration
- Laravel with Inertia.js
- TanStack Router/Start
- React Router
1. Copy-Paste Architecture
- No npm package - Components are copied into your project
- Full ownership - The code is yours to modify
- Direct customization - Edit components directly
- No abstraction layers - See exactly what's happening
2. Component Anatomy
Every component follows this structure:
// Root component with forwardRef
const Component = React.forwardRef<HTMLElement, ComponentProps>(
({ className, variant, size, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "div"
return (
<Comp
ref={ref}
className={cn(componentVariants({ variant, size, className }))}
{...props}
/>
)
}
)
Component.displayName = "Component"
// Sub-components for composition
const ComponentTrigger = React.forwardRef<...>()
const ComponentContent = React.forwardRef<...>()
const ComponentItem = React.forwardRef<...>()
// Export all parts
export { Component, ComponentTrigger, ComponentContent, ComponentItem }CLI installation (recommended)
npx shadcn@latest init npx shadcn@latest add [component]
3. Update imports
## 4. File Structure
```text
components/
└── ui/
├── accordion.tsx
├── alert-dialog.tsx
├── alert.tsx
├── button.tsx
├── card.tsx
├── dialog.tsx
├── form.tsx
├── input.tsx
├── label.tsx
├── select.tsx
└── ...
lib/
└── utils.ts # cn() helper function1. Variant System with CVA
import { cva, type VariantProps } from "class-variance-authority"
const buttonVariants = cva(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-9 px-4 py-2",
sm: "h-8 rounded-md px-3 text-xs",
lg: "h-10 rounded-md px-8",
icon: "h-9 w-9",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
)2. Polymorphic Components with asChild
import { Slot } from "@radix-ui/react-slot"
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
asChild?: boolean
}
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, asChild = false, ...props }, ref) => {
const Comp = asChild ? Slot : "button"
return <Comp ref={ref} className={cn(...)} {...props} />
}
)3. Controlled/Uncontrolled Pattern
// Controlled
<Select value={value} onValueChange={setValue}>
<SelectTrigger>...</SelectTrigger>
<SelectContent>...</SelectContent>
</Select>
// Uncontrolled
<Select defaultValue="apple">
<SelectTrigger>...</SelectTrigger>
<SelectContent>...</SelectContent>
</Select>4. Form Integration with React Hook Form
<Form {...form}>
<FormField
control={form.control}
name="email"
render={({ field }) => (
<FormItem>
<FormLabel>Email</FormLabel>
<FormControl>
<Input placeholder="email@example.com" {...field} />
</FormControl>
<FormDescription>
Enter your email address
</FormDescription>
<FormMessage />
</FormItem>
)}
/>
</Form>CSS Variables Structure
@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;
--card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%;
--popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%;
--primary: 222.2 47.4% 11.2%;
--primary-foreground: 210 40% 98%;
--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;
--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%;
--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
--ring: 222.2 84% 4.9%;
--radius: 0.5rem;
}
.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
/* ... dark theme variables ... */
}
}Color Convention
- Each color has a base and foreground variant
- Base: Background color
- Foreground: Text color on that background
- Ensures proper contrast automatically
1. ARIA Attributes
// Proper ARIA labeling
<Dialog>
<DialogTrigger asChild>
<Button>Open</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Title</DialogTitle>
<DialogDescription>
Description for screen readers
</DialogDescription>
</DialogHeader>
</DialogContent>
</Dialog>2. Keyboard Navigation
All components support:
- Tab/Shift+Tab - Focus navigation
- Enter/Space - Activation
- Escape - Close/cancel
- Arrow keys - List navigation
- Home/End - Boundary navigation
3. Focus Management
// Visible focus indicators
className="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
// Focus trap in modals
<FocusTrap>
<DialogContent>...</DialogContent>
</FocusTrap>1. Tables with TanStack Table
const table = useReactTable({
data,
columns,
getCoreRowModel: getCoreRowModel(),
getPaginationRowModel: getPaginationRowModel(),
getSortedRowModel: getSortedRowModel(),
getFilteredRowModel: getFilteredRowModel(),
})
<Table>
<TableHeader>
{table.getHeaderGroups().map((headerGroup) => (
<TableRow key={headerGroup.id}>
{headerGroup.headers.map((header) => (
<TableHead key={header.id}>
{flexRender(header.column.columnDef.header, header.getContext())}
</TableHead>
))}
</TableRow>
))}
</TableHeader>
<TableBody>
{table.getRowModel().rows.map((row) => (
<TableRow key={row.id}>
{row.getVisibleCells().map((cell) => (
<TableCell key={cell.id}>
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</TableCell>
))}
</TableRow>
))}
</TableBody>
</Table>2. Charts with Recharts
<ChartContainer config={chartConfig}>
<AreaChart data={data}>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="month" />
<YAxis />
<ChartTooltip />
<Area
type="monotone"
dataKey="value"
stroke="hsl(var(--chart-1))"
fill="hsl(var(--chart-1))"
/>
</AreaChart>
</ChartContainer>Initialize shadcn/ui
npx shadcn@latest init
Add components
npx shadcn@latest add button card dialog form
Add all components
npx shadcn@latest add --all
Update components
npx shadcn@latest add button --overwrite
Build custom registry
npx shadcn@latest build
## Component Development
```bash
# Development server
npm run dev
# Type checking
npm run type-check
# Linting
npm run lint
# Build
npm run build1. Bundle Size
- Only import what you use
- Components are tree-shakeable
- No runtime overhead from library
2. Code Splitting
// Lazy load heavy components
const HeavyChart = lazy(() => import('@/components/ui/chart'))
<Suspense fallback={<Skeleton />}>
<HeavyChart />
</Suspense>Form Controls
- Input, Textarea, Select, Checkbox, RadioGroup, Switch
- Slider, DatePicker, Form, Label
Overlays
- Dialog, AlertDialog, Sheet, Popover
- DropdownMenu, ContextMenu, Tooltip, HoverCard
Navigation
- NavigationMenu, Tabs, Breadcrumb
- Pagination, Sidebar
Data Display
- Table, DataTable, Card, Badge
- Avatar, Chart, Progress
Layout
- Accordion, Collapsible, ResizablePanels
- ScrollArea, Separator, AspectRatio
Feedback
- Alert, Toast (Sonner), Skeleton
- Progress, Loading states
Configuration Metadata
Included Configurations
- Next.js 15 v15.0.0: Next.js 15 with App Router, React 19, and Server Components
- shadcn/ui v0.8.0: Beautiful, accessible components with Radix UI and Tailwind CSS
Generation Details
- Generated: 2025-08-20T12:50:50.974Z
- Generator: Claude Config Composer v1.0.0
Compatibility Notes
This is a composed configuration. Some features may require additional setup or conflict resolution. Review the combined configuration carefully and adjust as needed for your specific project.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

