Frontend CLAUDE.md Templates
Framework-calibrated project setups that carry rendering-model, styling, state, and directory conventions into every Claude Code session. The single highest-leverage file to commit for frontend work.
Why frontend projects benefit most from a well-tuned CLAUDE.md
Frontend has more moving parts — and more opinionated per-framework conventions — than almost any other part of the stack. A single page in a modern web app can involve four rendering models (SSR, SSG, RSC, CSR), three or four state systems (URL state, server state, form state, client state), a design system with hundreds of tokens, a styling framework with its own directives, and a routing convention with rules about where files can live. That's a lot for Claude to hold in mind unprompted. A well-tuned CLAUDE.md carries that context every session so Claude arrives already up-to-speed.
The 11 templates on this page are calibrated for the frameworks in current use in 2026: the two Next.js majors, Remix, Astro, SvelteKit, Nuxt, Angular, Solid, Qwik, plus plain React + Vite for SPA work. Each is refreshed within 48 hours of a meaningful framework release and includes the current-version idioms, gotchas, and Do NOTs specific to that framework.
The five sections every frontend CLAUDE.md needs
1. Rendering model rules
The Server/Client boundary is the single most consequential decision in a modern React app, and getting it wrong is the single most common Claude Code frontend mistake. Every Next.js 15 or Remix template on this page opens with an explicit posture: "Server Components by default; add 'use client' only when a specific interactive dependency requires it." The rule doesn't need to be elaborate — it just needs to be present, so Claude reaches for the server-side option first.
2. Styling system rules
Tailwind projects, styled-components projects, CSS Modules projects, and vanilla CSS projects all need different guidance. Tell Claude explicitly what your project uses, whether utility classes are preferred over component styles, and which design tokens exist. For Tailwind projects specifically, name the design system if you have one (shadcn, Untitled UI, custom) so Claude reaches for the right component patterns.
3. State management defaults
Modern frontends usually have three or four state systems: URL state (searchParams or router state), server state (TanStack Query, SWR, tRPC, RSC), form state (React Hook Form, Conform, framework-native), and client state (Zustand, Redux, Context). Tell Claude which system handles which kind of state so it doesn't reach for the wrong one. A one-line rule like "URL state via searchParams; server state via TanStack Query; form state via React Hook Form; client state via Zustand only when needed" is enough.
4. File conventions
Where components live, where hooks live, where utilities live, and what naming pattern is used. Frontend projects fragment into many small files, and Claude will happily invent new locations if not told the existing convention. A five-line directory map at the top of CLAUDE.md prevents that.
5. Version-specific gotchas
Next.js 15 changed caching defaults. React 19 shipped new hooks. Angular 18 added Signals. These changes are recent enough that Claude sometimes reaches for pre-change patterns. Explicit Do NOTs in the CLAUDE.md close the gap. Every template here documents its framework's most-recent-major gotchas.
Anatomy of the Next.js 15 template
Under 50 lines and it covers every decision Claude would otherwise guess at. That's the template pattern: dense, specific, opinionated.
Templates + framework agents: the frontend trifecta
A CLAUDE.md tells Claude about your project. A framework subagent tells Claude about the framework itself. Install both for maximum leverage on frontend work:
- Next.js 15 template — project conventions loaded every session.
- nextjs-15-expert subagent — deep framework expertise on demand.
- Optional: matching testing template for the framework-specific test setup (Playwright config, Vitest workspace patterns).
The pair produces frontend code that reads like a senior on the team wrote it — not because Claude is different, but because it now has the context it always needed.
All 11 frontend templates, grouped by ecosystem
Each template covers rendering model, styling system, state management, directory conventions, and version-specific gotchas — the five sections that matter most.
Which frontend template should I use?
Match your framework and major version exactly. Mixing versions is the top source of broken generated code.
Related sub-categories in CLAUDE.md Templates
Frontend templates pair naturally with backend, full-stack, mobile, and product-type templates for teams building across the stack.
🐛 Hit an error while using these?
Our sister site AI Error Hub covers Claude Code errors, MCP connection failures, and stack traces — cross-referenced with everything on this site.
Frequently asked questions
The questions developers ask most about frontend.
Match your project's actual Next.js version. Next.js 15 changed defaults significantly:
- Caching is opt-in (was opt-out).
- Params and searchParams are async (were sync).
Mixing templates produces code that looks right but fails at runtime. Check package.json, then install the matching template.
If you're migrating from 14 to 15, keep both installed briefly and remove the older one once the migration is complete.
CLAUDE.md is project-specific and versioned in git. That gives you:
- Every developer on the team gets the same conventions on their next pull.
- New hires get productive on day one.
- Changes go through PR review.
A system prompt is either global (all projects share it, which is wrong) or per-session (nobody remembers to set it, so it drifts). CLAUDE.md solves both.
Under 300 lines is the discipline target — every line eats tokens on every session start.
The Next.js 15 template on this page is about 50 lines and covers rendering model, styling, state, directory structure, version specifics, and Do NOTs. That's the density you want.
If your CLAUDE.md exceeds 300 lines, move detailed sub-topics to separate docs and reference them via @path/to/file.md imports.
A short section, yes. Name:
- The test frameworks in use (Vitest, Playwright).
- The test file convention (colocated
.test.tsxor__tests__/folder). - The coverage bar if you have one.
Deep testing rules belong in a separate testing.md file that CLAUDE.md references. That way the main file stays scannable.
No, and you'd be worse off. The react-vite template assumes:
- Client-side rendering.
- No server.
- No framework routing.
- No build-time optimization beyond Vite defaults.
A Next.js project reads those assumptions and produces wrong-shaped code — server-side rendering opportunities missed, no data-fetching primitives used, no Server Component boundary.
Use the Next.js template for Next.js.
Whenever a change makes it stale:
- New dependency? Update CLAUDE.md in the same PR.
- Renamed a directory convention? Update.
- Upgraded framework major? Copy the new template and diff against your current file.
A stale frontend CLAUDE.md is worse than none — Claude will confidently use the wrong test command or dead directory name.
Yes, for maximum leverage:
- CLAUDE.md — tells Claude about your project (which framework version, where files live, team conventions).
- Framework subagent — tells Claude about the framework itself (current-version idioms, gotchas, output patterns).
Together they're the frontend trifecta — project brief plus framework expert, loaded on every session.
In a monorepo, use nested CLAUDE.md files:
- Root CLAUDE.md — shared conventions (pnpm workspace commands, Turborepo, top-level directory structure).
- apps/web/CLAUDE.md — Next.js rules.
- apps/marketing/CLAUDE.md — Astro rules.
Nested files augment the parent rather than replacing it. Claude Code loads all of them hierarchically at session start.
Yes, with light adaptation:
- Remove app-specific sections (rendering model, routing conventions).
- Keep technical stack, styling system, and Do NOT sections.
- Add a peer dependencies section — "Consumers use React 19+; do not import React internals; do not depend on Next.js primitives."
That kind of boundary-defining rule is exactly what CLAUDE.md is for.
Reference it, don't duplicate it. If your design system has its own CLAUDE.md or documentation, reference the specific parts you rely on from your app's CLAUDE.md.
For shadcn/ui specifically, the useful rule is:
"shadcn primitives live at components/ui/; do not edit — regenerate with pnpm shadcn add."
That single line prevents Claude from breaking your customization boundary.
Get the weekly Claude Code digest
Every Tuesday: new frontend, Anthropic release recap, and the best community submission. 13,000+ developers read it.