# .cursorrules — Basic Template

Save as `.cursorrules` in your project root. Cursor checks this on every single request it makes.

The difference between Cursor "kinda working" and Cursor "holy shit it nailed it" is this file. Most people skip it. Don't.

## General Rules

- Follow the patterns already in this codebase — don't invent new ones
- TypeScript strict mode. No `any`. If you don't know the type, use `unknown` and narrow it.
- Add tests for all new business logic
- Run the type checker after changes

## Code Style

Fill these in with your actual preferences:

- [Framework patterns, e.g., "Use Next.js App Router, not Pages Router"]
- [Naming conventions, e.g., "camelCase variables, PascalCase components, SCREAMING_SNAKE constants"]
- [Import style, e.g., "Group imports: external libs first, then internal modules, then types last"]

## Architecture Rules

These matter more than style rules. They prevent the AI from creating structural messes:

- [e.g., "All database queries go through lib/db/ — never raw queries in components"]
- [e.g., "Server components by default. Add 'use client' only when you need interactivity"]
- [e.g., "Validation happens at the API boundary, not inside business logic functions"]

## Testing

- Framework: [Vitest | Jest | Playwright]
- Tests live in `tests/` mirroring `src/` structure
- Mock external APIs in tests. Don't hit real endpoints.

---

**The premium version** has specialized .cursor/rules/*.mdc files with glob-based activation — different rules auto-apply depending on whether you're editing an API route, a database file, or a test. Way more targeted than a single .cursorrules file. [Get it here →](#)
