Most weak CLAUDE.md or .cursorrules files fail for the same reason: they say vague things like "write clean code" instead of specifying exact commands, directory boundaries, and forbidden anti-patterns.

Generate & Download Custom Rules Files
Export CLAUDE.md, .cursorrules, .cursor/rules/project.mdc, or AGENTS.md for your stack

4 Sections Every Project Rules File Needs

Starter Next.js + TypeScript CLAUDE.md Template

# Project Rules
## Verify Commands
- Run before finishing: `pnpm typecheck && pnpm lint && pnpm test`

## Architecture & Security
- Default to React Server Components; add `'use client'` only on leaf widgets.
- Validate all API inputs with Zod before database writes.
- Keep diffs scoped to the requested task and preserve unrelated comments.

Frequently Asked Questions

How long should CLAUDE.md or .cursorrules be?

Keep always-loaded files under 80 lines (~500–900 tokens). Check size quickly with the LLM Token Counter.

Should I use .cursorrules or .cursor/rules/*.mdc?

Use .cursor/rules/*.mdc when scoping rules by file extension (such as **/*.tsx vs **/*.sql); keep a concise root AGENTS.md or CLAUDE.md for cross-agent basics.