supabase-postgres-best-practices
Skill72 starsChanged 17 days agoMITView on GitHub
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pg_cron, pgmq), vector/semantic search (pgvector), and restoring dumps (pg_restore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
77 other projects use a version of this, 74 of them edited.
Adopted by
Most recently taken up by
- elbionredenica/consumer-app-starteredited, first seen Nov 8, 2026
- HeteroCat/heterocat-skillsedited, first seen Nov 8, 2026
- schornai/schornaiedited, first seen Nov 8, 2026
- crbnos/carbonedited, first seen Nov 7, 2026
- midudev/bigibai-2025edited, first seen Nov 1, 2026
- sunavoine-sys/Claude-Skillsedited, first seen Nov 1, 2026
Used with
Projects with it also use supabase, building-native-ui and 5 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
OpenAISkillsupabase
Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies, getSession, getUser, getClaims, RLS); Supabase CLI or MCP server; schema changes, migrations, security audits, Postgres extensions (pg_graphql, pg_cron, pg_vector).
Also in 28 projects that use this
OpenAISkillbuilding-native-ui
Complete guide for building beautiful apps with Expo Router. Covers fundamentals, styling, components, navigation, animations, patterns, and native tabs.
Also in 3 projects that use this
studio-lgtmSkillmake-interfaces-feel-better
Apply design engineering best practices to polish UI components - use when reviewing or improving interfaces, animations, typography, or interaction details.
Also in 3 projects that use this
VercelSkillfind-skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Also in 12 projects that use this
VercelSkillagent-browser
Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.
Also in 8 projects that use this
VercelSkillremotion-best-practices
Best practices for Remotion - Video creation in React
Also in 4 projects that use this
- +1 more from openai
Other versions77 projects use a version of this.
Word for word · 0
None found.
Edited · 74
- openai/plugins★ 7.8k85% same
- crbnos/carbon★ 2.8k88% same
- supabase/agent-skills★ 2.8k97% same
- FidelusAleksander/ghcertified★ 99688% same
- imbhargav5/nextbase-nextjs-supabase-starter★ 82797% same
- syahiidkamil/Software-Engineer-AI-Agent-Atlas★ 40497% same
- JetBrains/skills★ 38677% same
- julianromli/ai-skills★ 21572% same
- happycapy-ai/Happycapy-skills★ 13785% same
- midudev/bigibai-2025★ 12897% same
64 more not listed
Wrote their own version · 3
- baekenough/oh-my-customcode★ 42same name
- drubleat/mobile-stack-skills★ 4same name
- ecocee/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository30 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/ai-sdk-6/references/agents.mdAGENTS.md
- skills/ai-sdk-7/references/agents.mdAGENTS.md
- skills/openai-agents-sdk/references/agents.mdAGENTS.md
- skills/react-best-practices/AGENTS.mdAGENTS.md
- skills/vercel-react-view-transitions/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-harness-reviewSkill
- ai-appSkill
- ai-elementsSkill
- ai-sdk-6Skill
- ai-sdk-7Skill
- ai-sdkSkill
- cache-componentsSkill
- chrome-devtoolsSkill
- frontend-designSkill
- goSkill
- handoffSkill
- hetzner-cloudSkill
- iconsSkill
- next-best-practicesSkill
- nextjs-chatbotSkill
- nextjs-seoSkill
- nextjs-shadcnSkill
- openai-agents-sdkSkill
- postgres-semantic-searchSkill
- react-best-practicesSkill
- shadcnSkill
- vercel-react-view-transitionsSkill
- web-design-guidelinesSkill
The file
We split this skill into the rules it gives an agent
1 rule. 1 is common, 0 are distinctive, and 0 are very specific to this project.
1
Common
Most of the 76 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Common: line 60
Read individual rule files for detailed explanations and SQL examples:
“Common” is measured: kept by at least 6 in 10 of the 76 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Supabase Postgres Best Practices
Comprehensive performance optimization guide for Postgres, maintained by Supabase. Contains rules across 8 categories, prioritized by impact to guide automated query optimization and schema design.
When to Apply
Reference these guidelines when:
- Writing SQL queries or designing schemas
- Implementing indexes or query optimization
- Reviewing database performance issues
- Configuring connection pooling or scaling
- Optimizing for Postgres-specific features
- Working with Row-Level Security (RLS)
Quick Decision Tree
Problem?
├─ Slow query → query-missing-indexes, query-composite-indexes, monitor-explain-analyze
├─ Connection errors / timeouts → conn-pooling, conn-limits, conn-idle-timeout
├─ Deadlocks / long transactions → lock-short-transactions, lock-deadlock-prevention
├─ Bulk load slow → data-batch-inserts, data-upsert
├─ Table bloat / VACUUM issues → monitor-vacuum-analyze
├─ JSONB queries slow → advanced-jsonb-indexing
├─ FTS / search quality → advanced-full-text-search (pair with /postgres-semantic-search for BM25 + vector)
└─ Security / multi-tenant → security-* rules, RLSRelated Skills
/postgres-semantic-search— Vector search (pgvector), hybrid BM25 + semantic, ParadeDB/ai-sdk— AI SDK patterns for backend integration
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
| 1 | Query Performance | CRITICAL | query- |
| 2 | Connection Management | CRITICAL | conn- |
| 3 | Security & RLS | CRITICAL | security- |
| 4 | Schema Design | HIGH | schema- |
| 5 | Concurrency & Locking | MEDIUM-HIGH | lock- |
| 6 | Data Access Patterns | MEDIUM | data- |
| 7 | Monitoring & Diagnostics | LOW-MEDIUM | monitor- |
| 8 | Advanced Features | LOW | advanced- |
How to Use
Read individual rule files for detailed explanations and SQL examples:
references/query-missing-indexes.md
references/query-partial-indexes.md
references/_sections.mdEach rule file contains:
- Brief explanation of why it matters
- Incorrect SQL example with explanation
- Correct SQL example with explanation
- Optional EXPLAIN output or metrics
- Additional context and references
- Supabase-specific notes (when applicable)
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

