Development · Tip
Supabase Sample Cursor Rules
Pre-configured Cursor AI rules and prompt templates for Supabase development
A collection of ready-to-use Cursor .mdc rule files and prompt templates provided by the Supabase team. They configure Cursor AI to follow official best practices when writing Supabase Edge Functions, SQL migrations, and RLS policies. It also demonstrates how to structure glob patterns and descriptions in Cursor rules.
How it works
Walkthrough shown in video: In Cursor, run command palette '>new ru' → 'File: New Cursor Rule'. Rules live in .cursor/rules/ as .mdc files. Example pasted rule (edge-functions.mdc): description: 'Coding rules for Supabase Edge Functions'; globs: 'supabase/functions/**/*.ts'; body: '# Writing Supabase Edge Functions — You're an expert in writing TypeScript and Deno JavaScript runtime. Generate high-quality Supabase Edge Functions that adhere to the following best practices:' with Guidelines including: (1) prefer Web APIs and Deno core APIs over external deps (fetch over Axios, WebSockets API over node-ws); (2) reuse utility methods between Edge Functions via supabase/functions/_shared with relative imports, no cross dependencies; (3) no bare specifiers — prefix external deps with npm: or jsr: (e.g. @supabase/supabase-js → npm:@supabase/supabase-js); (4) always pin versions for external imports (npm:express → npm:express@4.18.2); (5) prefer npm: and jsr: imports over deno.land/x, esm.sh, unpkg.com; replace CDN hostnames with npm: specifiers; (6) Node built-in APIs imported via node: specifier (import process from 'node:process'); use Node APIs where Deno has gaps. The Supabase repo's examples/prompts folder also contains: code-format-sql.md, database-create-migration.md, database-functions.md, database-rls-policies.md, edge-functions.md, nextjs-supabase-auth.md.
What it's for
- Configure Cursor AI to follow Deno and TypeScript best practices for Supabase Edge Functions
- Scope AI editor rules to specific directory globs like supabase/functions/**/*.ts
- Standardize SQL formatting and migration creation across a team using Cursor
- Generate secure Row Level Security (RLS) policies using tailored prompt guidelines
Key points
- Uses Cursor's native .cursor/rules directory structure with .mdc files
- Includes scoped glob patterns to trigger rules only on relevant project files
- Edge function rules enforce Deno core APIs and Web APIs over external dependencies
- Specifies pinned dependency syntax using npm: and jsr: specifiers
- Collection includes templates for SQL formatting, migrations, edge functions, and Next.js auth
Pricing
Free
Details
- Type
- Tip
- Category
- Development
- Topic
- AI Prompts
- Open source
- Yes
- Platforms
- macOS, Windows, Linux
- For
- Developers building Supabase projects inside the Cursor editor
- Tags
- cursor, supabase, ai, edge functions, deno, developer tools
Why it was saved
- @dshukertjr: Drop-in AI coding rules for a Supabase codebase; also demonstrates how to author Cursor rules properly.
Related
Curated library of specialized AI agent personas and workflows for Claude Code
System prompt to convert rough software ideas into structured, agent-ready PRDs
A cheat sheet of 15 business and marketing prompts for ChatGPT.
Three-step transactional analysis prompt sequence for forecasting your future life trajectory
A collection of reusable ChatGPT prompts designed for studying and mastering topics
A system prompt that removes conversational fluff and engagement-seeking behaviors from LLMs
Updated