Skill

Supabase Postgres Best Practices

Review PostgreSQL queries, indexes, schemas, connection handling and row-level security.

postgresdatabaseperformancesecurity
View original source ↗

When to choose it

A source-based PostgreSQL review with actual SQL, schemas and workload context.

Choose it if: you can supply concrete database artifacts to review.

Look elsewhere if: you expect this installation to connect automatically to a database.

What the source describes

  • Prioritized guidance on queries, indexes, connection handling and database design.
  • Reference examples include RLS and query-plan considerations for Postgres hosted anywhere.

Requirements

  • Claude Code with Skill support.
  • Node.js 22.20.0+ for the reviewed skills CLI 1.7.1 and npm.
  • Relevant SQL, schema files or a sanitized query plan; live database access is separately configured.

The focused Skill can be installed separately. The alternative postgres-best-practices plugin ships this Skill; database connections are independent.

Install the focused Skill

  1. Choose the intended project. Run the focused install below from the intended project. The reviewed, published skills CLI 1.7.1 requires Node.js 22.20.0+ and npm. Review the installation scope and symlink or copy prompt. The npx skills command resolves the npm release available when you run it; a later release may differ from this review.
  2. Check discovery. Run the project-scope list from the same project. If you installed globally, check that scope separately with npx skills list --global --agent claude-code. The reviewed 1.7.1 list implementation defaults to project scope.
    Shell • setup check
    npx skills list --agent claude-code
  3. Optional plugin distribution. The focused plugin is postgres-best-practices. The repository also has a broader supabase plugin; install only the intended one.
    Shell • alternative plugin install
    claude plugin marketplace add supabase/agent-skills
    claude plugin install postgres-best-practices@supabase-agent-skills --scope local
  4. Prepare a bounded review packet. Supply the PostgreSQL version, relevant table definitions, current indexes, query and representative sanitized plan. For pooling questions, name the driver and direct/session/transaction connection mode without including the connection string or password. The Skill neither opens a connection nor grants database access.

Run this command from the intended project folder after reviewing the source. The skills CLI targets Claude Code and defaults to project scope. Review its scope and symlink or copy prompt; use --global only if you want a user-wide installation.

Shell • project Skill install
npx skills add supabase/agent-skills --skill supabase-postgres-best-practices --agent claude-code
Installation and loading troubleshooting

How to use it

Ask naturally about PostgreSQL queries, migrations, indexes or RLS. Supply sanitized context and state whether you want recommendations or edits.

Ask the agent to consult query-composite-indexes.md for the filter/index question, conn-prepared-statements.md for a transaction-pool issue, and monitor-explain-analyze.md for plan interpretation. These are reference files inside this Skill, not extra plugins or database tools.

An original example for a bounded task. This request example is written by ClaudeStack; it is not a transcript of a tested session.

Request example
Review this sanitized orders query and schema without editing files or accessing a database. The query filters status = pending and created_at after a cutoff, then orders by created_at. List existing indexes first; compare candidate column order against the supplied PostgreSQL version and plan. Also review the supplied transaction-pool driver settings for named prepared statements. Return recommendations, trade-offs and staging validation steps; do not create indexes or apply policies.

The external skills CLI collects installation telemetry and makes public-repository security-audit requests. Its README documents DISABLE_TELEMETRY=1 or DO_NOT_TRACK=1 to disable both. ClaudeStack did not run this installer.

November 3 follow-up: the rechecked Skill remains version 1.1.1 at the same MIT-licensed source revision. The official RLS documentation supplies the additional request-identity and UPDATE-policy checks. No database connection, SQL statement, policy change or installer was executed for this source review.

What to expect

The reviewed source describes these observations. ClaudeStack has not loaded or run this extension.

  • Recommendations tied to the supplied SQL, existing indexes and the relevant reference files, with assumptions stated.
  • A comparison of estimated versus actual plan information, plus candidate index and pooling changes to validate in your own staging environment.
  • The source’s priority labels and example performance figures are guidance, not measured results or guaranteed speed-ups for your workload.

Self-check: Check each recommendation against the supplied database version, existing indexes, data distribution and real plan. PostgreSQL EXPLAIN without ANALYZE produces an estimate; adding ANALYZE executes the statement and its side effects. Request interpretation of an existing sanitized plan before authorizing any new database execution.

Troubleshooting

Advice is too general

Supply table definitions, existing indexes, approximate data scale and a sanitized query plan.

No database tool is available

Review supplied files or plans. The Skill does not install a database connector or create permissions.

A suggested composite index is treated as a guaranteed fix

Compare equality/range filters and ordering against the real workload and existing indexes. Consult the PostgreSQL documentation for your version; current multicolumn-index documentation includes planner behavior that cannot be reduced to a universal leftmost-column rule. A sequential scan is not, by itself, proof of a missing index.

Prepared statement does not exist, or already exists

Confirm whether the connection uses transaction pooling and whether the driver creates named prepared statements. Check that driver’s supported configuration against current Supabase connection guidance; session and transaction modes have different connection lifetimes. Do not copy a setting from another driver or expose credentials in the review.

An EXPLAIN example is about to be run on production data

Distinguish plain EXPLAIN from EXPLAIN ANALYZE: ANALYZE runs the statement. Keep this Skill review on supplied plans until execution is separately approved in the intended environment; removing output rows does not remove statement side effects.

RLS advice does not match the application’s identity model

State the application role, authenticated identity and intended tenant policy. The source includes both an application-setting example and a Supabase auth.uid() example; neither is a drop-in policy for every schema. Review policy behavior under the actual role before applying changes.

An unauthenticated request returns no rows under a user-matching RLS policy

Inspect the identity and role attached to the actual application request. Supabase documents auth.uid() as null when no authenticated user is present, so auth.uid() = user_id does not match. Review the policy’s target role and intended behavior for unauthenticated requests; a dashboard session or another client does not establish this request’s identity.

An UPDATE policy exists, but the intended row still cannot be updated

Supabase documents that UPDATE also needs a corresponding SELECT policy. Review row visibility under the same request role, then check USING against the existing row and WITH CHECK against the proposed row. If WITH CHECK is omitted, the USING expression is reused. Diagnose with the supplied policy and request context before proposing a policy change.

Disable or remove it

  • For a project installation, run npx skills remove supabase-postgres-best-practices --agent claude-code from the same project. Add --global only when removing a global installation.
  • Review any edits and generated artifacts separately; removing the Skill does not revert its work.
  • For the plugin route, disable or uninstall postgres-best-practices in /plugin.

Limitations & considerations

  • The Skill does not configure database access or provide live telemetry.
  • Proposed index, schema and RLS changes need workload-specific validation before application.
  • RLS results depend on the actual request role, authenticated identity and matching policies.

Source & review record

Our description is based on public documentation and manifests available on 2026-11-03. Installation formats were checked against Claude Code and the relevant installer documentation. No extension code was executed: this is a source review, not a runtime compatibility test or security audit.

Repository last pushed at the time of review: 2026-10-02T12:34:51Z. This date does not prove that the extension works with a particular Claude Code release.

Usage guide sources

Upstream revision checked for this guide: c9be0e931b7930f7d02126d04774d904c381e7d7. Command names and behavior in this guide are documentation and registration-source findings, not runtime verification.

More skills

Browse this type
Skill

Vercel React Best Practices

Review React and Next.js code for request waterfalls, bundle size and rendering work.

Vercel EngineeringPublisher-maintained skill
Skill

Differential Review

Examine code changes for security regressions with Git history and affected callers.

Omar Inuwa / Trail of BitsPublisher-maintained skill
Skill

Property-Based Testing

Design meaningful property tests and assess reduced counterexamples.

Henrik Brodin / Trail of BitsPublisher-maintained skill

Each listing records its own source-review date. Listings are documentation reviews, not runtime tests or security audits. Our editorial method