An RLS policy that calls a function per row can run it a million times on a million-row table; wrapping it in a SELECT means it's evaluated once. That's the kind of rule packed into supabase-postgres-best-practices, the Postgres skill maintained by Supabase. It's on the skills.sh Trending list with 1,400 installs, and its repo, supabase/agent-skills, has 3,180 stars and saw commits on December 2, 2026.
What it does
It's an instructions-only skill (MIT licensed, version 1.1.1 in its metadata). Its description tells the agent to load it before touching anything that lives in Postgres: creating or altering tables, migrations, RLS policies, indexes, triggers, functions, queues with pg_cron or pgmq, pgvector search, or pg_restore. Also when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, or rows visible to the wrong user. The description insists it applies "even for a one-column change".
The SKILL.md sorts its rules into eight categories by impact:
| Priority | Category | Impact |
|---|---|---|
| 1 | Query performance | Critical |
| 2 | Connection management | Critical |
| 3 | Security & RLS | Critical |
| 4 | Schema design | High |
| 5 | Concurrency & locking | Medium-high |
| 6 | Data access patterns | Medium |
| 7 | Monitoring & diagnostics | Low-medium |
| 8 | Advanced features | Low |
Each rule is a file under references/ with the same shape: why it matters, an incorrect SQL example, the correct one and, where relevant, EXPLAIN output. Some are Postgres 101 (index your WHERE and JOIN columns); others are exactly what agents forget: keep HTTP calls out of the transaction so a FOR UPDATE isn't held for seconds, set a statement_timeout, put a pooler in transaction mode, or keep SECURITY DEFINER functions in a private schema and revoke EXECUTE from public roles.
How to install it
With the skills.sh installer, just this skill:
npx skills add supabase/agent-skills --skill supabase-postgres-best-practicesOr as a Claude Code plugin from the repo's marketplace:
claude plugin marketplace add supabase/agent-skills
claude plugin install postgres-best-practices@supabase-agent-skillsYou don't call it yourself: the agent loads it when the task matches the description, say "review the indexes on this table" or "optimize this query".
Risks and limits
Execution risk is minimal: the skill ships no scripts or hooks, declares no tools and doesn't touch the network or credentials; it's Markdown files with SQL examples. What the agent runs afterwards (a CREATE INDEX, a migration) depends on the database permissions you give it, not on the skill.
The limits are about content:
- It's billed as "Postgres running anywhere", but it has a Supabase accent. The headline RLS example uses
auth.uid(), a Supabase function; elsewhere you'll have to swap in your own app's identity mechanism. - The description promises more than the index delivers. It mentions migrations, queues and restores, yet none of the eight categories in
SKILL.mdis about migrations — which is where an agent does the most damage in production (anALTER TABLEthat locks the table, an index built withoutCONCURRENTLY). - Some numbers are rules of thumb. Claims like "100-1000x faster" or the pool-size formula
(cores × 2) + spindlesare a starting point, not the truth for your workload.
Compared with what you had
Without the skill, the agent falls back on its training data, which is fine for syntax and weak on operational detail: long transactions, slow RLS, a connection per request. The classic alternative is your own checklist in the project's CLAUDE.md: tighter to your schema, but maintained by hand. This skill is a solid common baseline, especially on Supabase; if you're not on Supabase, review the RLS examples before letting the agent copy them.
Sources
- supabase/agent-skills — Supabase (GitHub), 2026-12-02
- supabase-postgres-best-practices — skills.sh, 2026-12-03
- SKILL.md: Supabase Postgres Best Practices — Supabase (GitHub), 2026-12-02
- Optimize RLS Policies for Performance — Supabase (GitHub), 2026-12-02