mcpField
P
postgres-best-practices

postgres-best-practices

github.com/sickn33Data & databases48.8k430 installsUpdated today
Repository

About postgres-best-practices

postgres-best-practices is a community-bundled guide attributed to Supabase for Postgres query optimization and schema design. It organizes rules into eight impact-prioritized categories, with explanations and SQL examples for database practitioners.

Key features

  1. 01Eight prioritized rule categories
  2. 02Query and index optimization guidance
  3. 03Connection and pooling guidance
  4. 04Security and RLS recommendations
  5. 05SQL examples in individual rule files

Use cases

  1. 01Reviewing Postgres query performance
  2. 02Designing schemas and indexes
  3. 03Configuring connection pooling
  4. 04Assessing Row-Level Security

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/sickn33/agentic-awesome-skills --skill postgres-best-practices

After installing, type/postgres-best-practicesin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

AGENTS.md
metadata.json
README.md
rules/
_contributing.md
_sections.md
_template.md
advanced-full-text-search.md
advanced-jsonb-indexing.md
conn-idle-timeout.md
conn-limits.md
conn-pooling.md
conn-prepared-statements.md
data-batch-inserts.md
data-n-plus-one.md
data-pagination.md
data-upsert.md
lock-advisory.md
lock-deadlock-prevention.md
lock-short-transactions.md
lock-skip-locked.md
monitor-explain-analyze.md
monitor-pg-stat-statements.md
monitor-vacuum-analyze.md
query-composite-indexes.md
query-covering-indexes.md
query-index-types.md
query-missing-indexes.md
query-partial-indexes.md
schema-data-types.md
schema-foreign-key-indexes.md

Details

From the project README

Supabase Postgres Best Practices

Community-bundled Postgres guide attributed to Supabase; upstream maintenance and example performance numbers are not independently certified. Contains rules across 8 categories, prioritized by impact to guide automated query optimization and schema design.

When to Use

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)

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Query PerformanceCRITICALquery-
2Connection ManagementCRITICALconn-
3Security & RLSCRITICALsecurity-
4Schema DesignHIGHschema-
5Concurrency & LockingMEDIUM-HIGHlock-
6Data Access PatternsMEDIUMdata-
7Monitoring & DiagnosticsLOW-MEDIUMmonitor-
8Advanced FeaturesLOWadvanced-

How to Use

Read individual rule files for detailed explanations and SQL examples:

rules/query-missing-indexes.md
rules/query-partial-indexes.md
rules/_sections.md

Each 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)

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

Comments

Markdown supported