cursor / claude rules

CLAUDE.md for Next.js Projects

CLAUDE.md template for Claude Code in Next.js projects. App Router conventions, server components, and TypeScript patterns.
by cache.directory updated May 18, 2026 CC-BY-4.0

## what it does

CLAUDE.md for Next.js

# Next.js Project

## Stack
- Next.js 15 (App Router ONLY)
- React 19 (use() hook, React Compiler)
- TypeScript 5.6 strict
- Tailwind CSS v4

## Commands
- `npm run dev` — start dev server
- `npm run build` — production build
- `npm run lint` — ESLint
- `npm test` — Vitest

## Architecture
- Server components by default
- "use client" only for interactive UI
- Data fetching in server components or server actions
- Server actions in `src/app/actions/`

## Conventions
- Named exports only (no default exports)
- Interface for component props, type for unions/utils
- No `any` — use `unknown` + type narrowing
- Error boundaries wrap every route segment
- Loading.tsx for suspense boundaries

## File Structure
- `src/app/` — routes and layouts
- `src/components/` — shared components (flat)
- `src/lib/` — utilities, config
- `src/types/` — shared TypeScript types

## embed this badge

cache ✓ in cache.directory
![cached](https://cache.directory/badge/claude-md-nextjs.svg)