installskill

Skills / supabase/agent-skills

supabase-postgres-best-practices

Postgres best practices for schema, migrations, RLS, indexes, queries and performance tuning.

Pinned commit
c9be0e931b79Committed 2026-10-02
Files
3661 KB
License
MIT
Snapshot taken
2026-11-28
Description from the skill
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.

This is the text your agent reads to decide when to use the skill.

Install

Choose your agent. Pinned commands install exactly the commit this page describes.

Skill directory .claude/skills/Claude Code · Official docs

Does not read the shared .agents/skills directory. A skill must land in .claude/skills, or arrive inside a plugin.

GitHub CLIpinned

$ gh skill install supabase/agent-skills skills/supabase-postgres-best-practices --agent claude-code --pin c9be0e931b7930f7d02126d04774d904c381e7d7

gh picks the directory for the agent, names the folder after the source directory (supabase-postgres-best-practices), and writes source metadata into the SKILL.md frontmatter, so the content hash below will not match. Check the github-tree-sha it records instead: it should read 27bde25111c4cd5e6f803fc9db5fbffe27bb26cf.

skills CLIpinned

$ npx skills add supabase/agent-skills@c9be0e931b7930f7d02126d04774d904c381e7d7 --skill supabase-postgres-best-practices -a claude-code --copy

Downloads and runs the skills package from npm. --copy writes real files instead of symlinks. The CLI sends anonymous telemetry unless DISABLE_TELEMETRY=1 is set, and that setting also turns off its audit lookups.

Claude Code pluginnot pinnedrun inside the agent

> /plugin marketplace add supabase/agent-skills
> /plugin install postgres-best-practices@supabase-agent-skills

Not pinned: installs whatever the marketplace currently serves. Plugin scope is chosen in the /plugin dialog.

Plain gitpinned

$ tmp=$(mktemp -d)
$ git clone --quiet https://github.com/supabase/agent-skills.git "$tmp"
$ git -C "$tmp" checkout --quiet c9be0e931b7930f7d02126d04774d904c381e7d7
$ mkdir -p .claude/skills
$ cp -R "$tmp/skills/supabase-postgres-best-practices" .claude/skills/supabase-postgres-best-practices

No extra tooling. Files land byte for byte as published in .claude/skills/supabase-postgres-best-practices, so the content hash below can be checked directly.

Check what landed

Run this after installing. It prints one SHA-256 for the whole directory. If your installer reported a different directory, cd there instead.

$ cd .claude/skills/supabase-postgres-best-practices && find . -type f -print0 | LC_ALL=C sort -z | xargs -0 shasum -a 256 | shasum -a 256

Expected35fc91b01a833965cfa778335b4e87bf191cbf2cd9b2e3beaf13d295be9c1c76

It matches only when the files are byte for byte as published. A difference means something changed: by the installer, by you, or upstream.

What is inside

Pattern matches in the files, each linked to its line. A match is a place to read, not a verdict, and no match is not proof of absence.

Docs · 35SKILL.md · 1

Runs commandsNo match

Code that spawns other processes, or shell code blocks in the instructions.

Network accessNo match

Calls that fetch from or send to a remote host.

Installs packagesNo match

Commands that pull and run third-party packages at use time.

Reads env or credentialsNo match

References to environment variables, tokens, keys or credential files.

Privileged or destructiveNo match

sudo, recursive deletes, permission changes and similar commands.

Dynamic or encoded codeNo match

eval, exec, base64 decoding and remote-script piping, which hide what runs.

Outside hosts mentioned

Hostnames of every URL in the text files.

  • github.com×49
  • www.postgresql.org×21
  • supabase.com×16
  • wiki.postgresql.org×1

Entries worth a second look

No symlinks, submodules, hidden files, archives, compiled files or unscanned files.

File manifest

Every file in the skill directory at the pinned commit.

Content hash
35fc91b01a833965cfa778335b4e87bf191cbf2cd9b2e3beaf13d295be9c1c76
Git tree SHA
27bde25111c4cd5e6f803fc9db5fbffe27bb26cf
PathKindSizeSHA-256
CHANGELOG.mdDocs5.6 KB751ad110037c85d4…
SKILL.mdSKILL.md3.2 KBad65e776f45e761b…
references/_contributing.mdDocs4.0 KB191e039e7d94764e…
references/_sections.mdDocs1.6 KBc9e992612b422c71…
references/_template.mdDocs1.0 KB6299954250f212ca…
references/advanced-full-text-search.mdDocs1.4 KB40c2606bbb4c4dce…
references/advanced-jsonb-indexing.mdDocs1.4 KB24cacf6a8bc35901…
references/conn-idle-timeout.mdDocs1.3 KB630588902c00fcec…
references/conn-limits.mdDocs1.3 KB11b2a67a7c7679cb…
references/conn-pooling.mdDocs1.3 KB88cf086bf98ba865…
references/conn-prepared-statements.mdDocs1.5 KB174e9332fe3dda5c…
references/data-batch-inserts.mdDocs1.3 KB531933b82d6a622d…
references/data-n-plus-one.mdDocs1.3 KB21a44905e5b16a42…
references/data-pagination.mdDocs1.3 KB73c9fa10a3d439be…
Show all files (36)
references/data-upsert.mdDocs1.4 KB2612af83b20a2701…
references/lock-advisory.mdDocs1.5 KBc88d259dbf81c377…
references/lock-deadlock-prevention.mdDocs1.8 KB09aee46f51d7178c…
references/lock-short-transactions.mdDocs1.3 KB5aa7f61095916986…
references/lock-skip-locked.mdDocs1.3 KB6c45077f430f29cd…
references/monitor-explain-analyze.mdDocs1.4 KB4cb67ffbf8e57f2e…
references/monitor-pg-stat-statements.mdDocs1.4 KB89dca99d4e894fcb…
references/monitor-vacuum-analyze.mdDocs1.5 KB2892272011710eb4…
references/query-composite-indexes.mdDocs1.4 KB73e42424e671f026…
references/query-covering-indexes.mdDocs1.3 KBdaf2a7f0477fb735…
references/query-index-types.mdDocs1.5 KB472a74f22c2df203…
references/query-missing-indexes.mdDocs1.2 KB91ad8b0ff4365704…
references/query-partial-indexes.mdDocs1.3 KB6448982bc8558c65…
references/schema-constraints.mdDocs1.8 KB90e8efda3e9e8109…
references/schema-data-types.mdDocs1.4 KBe01b58c14c7f3f65…
references/schema-foreign-key-indexes.mdDocs1.6 KB7587713d12a65a21…
references/schema-lowercase-identifiers.mdDocs1.7 KB4bc80f70865f2390…
references/schema-partitioning.mdDocs1.5 KB541e13fbeaf4bb14…
references/schema-primary-keys.mdDocs1.8 KB3c8beabef82066f9…
references/security-privileges.mdDocs1.5 KB095909274a4fb43d…
references/security-rls-basics.mdDocs1.3 KBe04dd1a3a382aafd…
references/security-rls-performance.mdDocs2.1 KB2e1faeca7d5746e2…

Spec and portability

Checked against the Agent Skills specification.

Frontmatter
Parses as YAML
Name matches directory
Yes
Name uses lowercase letters, digits and hyphens
Yes
Description length
834limit 1,024 characters
SKILL.md body
54 linesthe spec suggests under 500 lines
Fields outside the spec
None
License field
MIT
License file
None declared
Repository license
LICENSE (MIT)
Claude Code plugin
postgres-best-practices@supabase-agent-skills

Change history

No changes recorded since the first snapshot on 2026-11-28.

Follow changes to this skill in a feed reader: Atom feed · all skills

Get an email when this skill changes

Email alerts are not built yet. Leave your address and we will write to you once, when they are. The feed above works today.

We store your address, the name of this skill and the date. It is used for nothing else.