Cursor Rule - vm5lab/SaaSKit GitHub Wiki

🧠 SaaSKit Cursor AI Rules

This document outlines the custom AI rules for Cursor to support consistent, type-safe, and scalable SaaSKit development using TypeScript, Next.js 15, Supabase, Prisma, Tailwind CSS, and MUI.


📌 Project Info

  • Project: SaaSKit
  • Description: A modern SaaS framework using Next.js 15 App Router, React 19, Supabase, Prisma, and Tailwind CSS. Built for rapid SaaS prototyping with Server Actions, MUI UI system, and secure access control via RLS.

📜 Custom AI Rules

🟦 Type Safety

  • When: Writing any code
    Then: Use TypeScript with full type safety and avoid using any unless absolutely necessary.

🟨 Server Logic

  • When: Writing server logic
    Then: Use Next.js Server Actions instead of API routes; avoid creating traditional REST handlers.

🟩 Database Access

  • When: Accessing the database
    Then: Use Prisma Client with type-safe queries and apply user context for access control.

🟪 Prisma Schema

  • When: Writing Prisma schema
    Then: Use PascalCase for model names, snake_case for fields, and maintain relational integrity.

🟧 UI Component Design

  • When: Creating UI components
    Then: Use Tailwind for layout and spacing, and MUI for standardized components; ensure all components are responsive and follow atomic design principles.

🎨 UI/UX Design Principles

  • When: Designing UI
    Then: Adhere to a consistent design system with spacing, typography, color tokens, and component hierarchy; maintain visual balance and responsive behavior across breakpoints.

🧱 Layout System

  • When: Building layout components
    Then: Use LayoutShell with responsive Sidebar and Topbar; include dark mode support using Tailwind's dark: and MUI theming.

📝 Form Handling

  • When: Writing forms
    Then: Use Server Actions for submissions, Zod for validation, and display user feedback states (loading, error, success).

🔐 Authentication

  • When: Implementing authentication
    Then: Use Supabase Auth and enforce Row-Level Security (RLS) policies.

🗂 Naming Conventions

  • When: Naming files or folders
    Then: Use kebab-case for folders/files, PascalCase for React components.

⚙️ Client Logic

  • When: Writing client-side logic
    Then: Prefer Server Components when possible to reduce bundle size and improve performance.

📚 Documentation

  • When: Writing documentation
    Then: Add JSDoc comments for public functions, complex logic, and exported modules.

These rules guide Cursor AI to generate consistent, scalable, and secure code that aligns with SaaSKit's architecture and team development standards.