CLAUDE.md Starter Kit for Next.js + TypeScript
A CLAUDE.md template you can adapt to share your Next.js conventions with Claude Code from the first session.

Stop explaining the same conventions to Claude every session. Put them in CLAUDE.md at the root of your repo, and Claude starts with the right context.
If you want the full reasoning before copying the template, read CLAUDE.md: the file every developer should have in their projects.
This starter kit gives you a CLAUDE.md template you can adapt for Next.js projects using App Router, strict TypeScript, Tailwind, Shadcn/ui, and Prisma. Adapt it to your stack after checking your existing conventions.
What's inside
1. Stack - framework, language, key libraries and versions. These details help Claude look for suitable APIs; verify calls against the documentation for your version.
2. Architecture - folder structure, with one sentence explaining what lives where.
3. Coding conventions - imports, errors, logs, naming. The details new contributors usually miss.
4. Hard no's - console.log, raw try/catch in actions, { success: false } return shapes, blank lines between imports.
5. Pattern examples - server action, service with error handling, and logger.
6. Rule scope - keep project conventions here; put applicable personal rules in your global configuration after adapting them.
The template
This example reflects a Next.js 15 stack and personal preferences, not universal rules. Check versions and adapt or remove each convention before use. Instructions do not guarantee agent behaviour.
# CLAUDE.md
## Stack
- Next.js 15 (App Router), React 19
- TypeScript strict
- Tailwind 4 + Shadcn/ui
- Prisma (PostgreSQL)
- next-safe-action for server actions
- next-themes
## Architecture
src/
├── app/ # Routes (App Router) - layouts, pages, loading/error
├── components/ # UI: layout/ (Header, Footer) | ui/ (Shadcn) | providers/
├── domain/ # Entities + typed errors (DomainError, NotFoundError, etc.)
├── lib/ # env, utils, safe-action, date, mdx
├── actions/ # next-safe-action server actions (client-facing)
├── queries/ # RSC-only data fetching (no "use server", no safe-action)
└── services/ # Business logic - throw DomainError, never return { success }
## Conventions
### Imports - single block, no blank lines
\`\`\`ts
import { foo } from "external";
import { cn } from "@/lib/utils";
import { Header } from "./header";
// Never put blank lines between imports
\`\`\`
### Server actions - always next-safe-action
\`\`\`ts
export const myAction = authenticatedAction
.schema(MySchema)
.action(async ({ parsedInput, ctx }) => {
return await service.doThing(ctx.userId, parsedInput);
});
\`\`\`
### Services - throw DomainError, return data directly
\`\`\`ts
export async function getThing(id: string) {
const thing = await db.thing.findUnique({ where: { id } });
if (!thing) throw new NotFoundError(`thing/${id}`);
return thing;
}
\`\`\`
### Logging - single line, no object args
\`\`\`ts
const log = logger.for("module-name");
log.info(\`Message | key=\${value} count=\${count}\`);
\`\`\`
## Never do this
- No console.log (use logger)
- No try/catch in actions
- No { success: false, error } return shapes in actions or services
- No blank lines between imports
- No magic numbers (use named constants)
- No useTransition for actions (use useAction from next-safe-action)The template above is the whole resource, free to copy.
If you want the same base packaged with the AGENTS.md file, the first-run checklist and the reusable prompts, take the Coding Agent Setup Kit. It also includes Skills and agent profiles.
Get this free resource
Enter your email. I'll send a confirmation link to unlock this resource on your device.
This request does not subscribe you to the newsletter. Your email is used to send the requested download. See our privacy policy.