Index of every page on this site: llms.txt
All skills
davila7 avatar

/postgres-best-practices

@c1bc5c1
Run it yourself

Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.

Use this Skill: https://skilld.dev/gh/davila7/claude-code-templates/postgres-best-practices

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

README.md

≈794 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Postgres Best Practices - Contributor Guide

This repository contains Postgres performance optimization rules optimized for AI agents and LLMs.

Quick Start

# Install dependencies
cd packages/postgres-best-practices-build
npm install

# Validate existing rules
npm run validate

# Build AGENTS.md
npm run build

Creating a New Rule

  1. Choose a section prefix based on the category:

    • query- Query Performance (CRITICAL)
    • conn- Connection Management (CRITICAL)
    • security- Security & RLS (CRITICAL)
    • schema- Schema Design (HIGH)
    • lock- Concurrency & Locking (MEDIUM-HIGH)
    • data- Data Access Patterns (MEDIUM)
    • monitor- Monitoring & Diagnostics (LOW-MEDIUM)
    • advanced- Advanced Features (LOW)
  2. Copy the template:

    cp rules/_template.md rules/query-your-rule-name.md
  3. Fill in the content following the template structure

  4. Validate and build:

    npm run validate
    npm run build
  5. Review the generated AGENTS.md

Repository Structure

skills/postgres-best-practices/
├── SKILL.md           # Agent-facing skill manifest
├── AGENTS.md          # [GENERATED] Compiled rules document
├── README.md          # This file
├── metadata.json      # Version and metadata
└── rules/
    ├── _template.md      # Rule template
    ├── _sections.md      # Section definitions
    ├── _contributing.md  # Writing guidelines
    └── *.md              # Individual rules

packages/postgres-best-practices-build/
├── src/               # Build system source
├── package.json       # NPM scripts
└── test-cases.json    # [GENERATED] Test artifacts

Rule File Structure

See rules/_template.md for the complete template. Key elements:

---
title: Clear, Action-Oriented Title
impact: CRITICAL|HIGH|MEDIUM-HIGH|MEDIUM|LOW-MEDIUM|LOW
impactDescription: Quantified benefit (e.g., "10-100x faster")
tags: relevant, keywords
---

## [Title]

[1-2 sentence explanation]

**Incorrect (description):**

```sql
-- Comment explaining what's wrong
[Bad SQL example]
```

Correct (description):

-- Comment explaining why this is better
[Good SQL example]
## Writing Guidelines

See `rules/_contributing.md` for detailed guidelines. Key principles:

1. **Show concrete transformations** - "Change X to Y", not abstract advice
2. **Error-first structure** - Show the problem before the solution
3. **Quantify impact** - Include specific metrics (10x faster, 50% smaller)
4. **Self-contained examples** - Complete, runnable SQL
5. **Semantic naming** - Use meaningful names (users, email), not (table1, col1)

## Impact Levels

| Level | Improvement | Examples |
|-------|-------------|----------|
| CRITICAL | 10-100x | Missing indexes, connection exhaustion |
| HIGH | 5-20x | Wrong index types, poor partitioning |
| MEDIUM-HIGH | 2-5x | N+1 queries, RLS optimization |
| MEDIUM | 1.5-3x | Redundant indexes, stale statistics |
| LOW-MEDIUM | 1.2-2x | VACUUM tuning, config tweaks |
| LOW | Incremental | Advanced patterns, edge cases |

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts7d3 checks · Risk SAFE
  • Gen Agent Trust Hub7d

    The postgres-best-practices skill is a comprehensive documentation set providing rules and SQL examples for optimizing Postgres performance and security. It covers topics like index optimization, connection management, and Row-Level Security (RLS). No malicious patterns or security vulnerabilities were detected.

  • Socket7d

    No alerts

  • Snyk7d

    Risk: LOW · No issues

Signed by skilld at c1bc5c1. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
metadata
{
  "author": "supabase",
  "version": "1.0.0"
}

README badge

README badge for davila7/claude-code-templates/postgres-best-practices