# Master Your Next.js Conventions with a Bulletproof .cursorrules File

Your agent forgets your conventions the moment the context window rolls. Every Cursor session starts blank. You spend an hour telling it where things live, what's banned, which patterns you hate. Then you compact, switch branches, or open a new chat. The next session reinvents `app/components/Button.tsx` from scratch because it doesn't know you put components in `components/ui/`, that you use `cn()` from `lib/utils`, and that you never want a raw `<img>` tag.

`.cursorrules` fixes this. It's a file Cursor reads on every interaction — a persistent constitution for the model. Most files I've seen are vague ("write clean code"), a wall of prose no model parses well, or a flat list of bans without context.

---

*This is an excerpt. Read the full post at [otf-kit.dev/blog/cursor-rules-nextjs](https://otf-kit.dev/blog/cursor-rules-nextjs) — full-stack kits your AI coding agent can actually ship to production. [Browse the kits →](https://otf-kit.dev)*
