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 patternsauth-routes.mdc- Protected routes and auth helpersauth-magiclink.mdc- Magic link implementation detailsai-chat.mdc- AI chat routes, persistence, rate limitingbilling.mdc- Stripe/Polar architecture and subscription patternsdb.mdc- Drizzle schema conventions and query patternsemail.mdc- Email templates and sending patternslanding-page.mdc- Landing page structure + customization patternsseo.mdc- Metadata, sitemap, and JSON-LD patternshardening.mdc- Security headers, rate limiting, loggingcoding-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
- Open Cursor chat
- Type
/to see available commands - Select a command (e.g.,
/add-protected-page) - Cursor will ask for required inputs (route name, title, etc.)
- Follow the generated steps
Customizing rules
Rules are designed to be customized for your project:
- Read the existing rule to understand its purpose
- Update patterns to match your conventions
- Add project-specific examples
- 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