Cursor Workflow

The boilerplate includes Cursor rules and commands in .cursor/ that accelerate development while maintaining code quality.


What's included

Rules (.cursor/rules/)

Rules are "prompt enhancers" that give Cursor context about your codebase conventions:

  • app-layout.mdc - Route group structure and navigation patterns
  • auth-routes.mdc - Protected routes and auth helpers
  • auth-magiclink.mdc - Magic link implementation details
  • ai-chat.mdc - AI chat routes, persistence, rate limiting
  • billing.mdc - Stripe/Polar architecture and subscription patterns
  • db.mdc - Drizzle schema conventions and query patterns
  • email.mdc - Email templates and sending patterns
  • landing-page.mdc - Landing page structure + customization patterns
  • seo.mdc - Metadata, sitemap, and JSON-LD patterns
  • hardening.mdc - Security headers, rate limiting, logging
  • coding-standards.mdc - General code style and best practices

Commands (.cursor/commands/)

Commands are pre-defined prompts for common tasks:

  • /add-protected-page - Create a new protected page with navigation
  • /add-model - Create a Drizzle table with CRUD helpers
  • /add-plan - Add a new billing plan
  • /add-email-template - Create a new email template
  • /generate-env-secret - Generate a secure secret for .env.local
  • /wire-email-to-event - Connect an email to a domain event
  • /wire-magic-link-auth - Set up or audit magic link auth
  • /seo-audit-page - Audit and fix SEO on a page
  • /security-audit - Audit the repo for common security issues
  • /scaffold - Scaffold a new feature with repo-native structure
  • /refactor - Refactor code with minimal churn
  • /brainstorm - Generate options and converge on a recommendation
  • /deslop - Remove AI-generated “slop” from a diff

How rules work

Rules are .mdc files with alwaysApply: true in the frontmatter. Cursor automatically includes them in context when you're working in the codebase.

Example rule structure:

cursor-rule.md
---
alwaysApply: true
---

# Rule Title

Description of when this applies.

## Key patterns

- Pattern 1
- Pattern 2

## Code examples

Using commands

  1. Open Cursor chat
  2. Type / to see available commands
  3. Select a command (e.g., /add-protected-page)
  4. Cursor will ask for required inputs (route name, title, etc.)
  5. Follow the generated steps

Customizing rules

Rules are designed to be customized for your project:

  1. Read the existing rule to understand its purpose
  2. Update patterns to match your conventions
  3. Add project-specific examples
  4. Keep rules focused (one concern per rule)

Adding new rules

Create a new .mdc file in .cursor/rules/:

cursor-rule.md
---
alwaysApply: true
---

# My Custom Rule

## When this applies

Description of when Cursor should follow this rule.

## Patterns

- Key pattern 1
- Key pattern 2

## Examples

Show good and bad examples.

Best practices

  • Keep rules concise and actionable
  • Include code examples that Cursor can follow
  • Update rules as your codebase evolves
  • Use commands for multi-step tasks
  • Rules complement each other; don't duplicate content