Skip to content

PostgreSQL Patterns

Gives the agent PostgreSQL best-practice guidance for indexes, schemas, queries and security

Repository
affaan-m/ECC
Stars
295,127
Licence
MIT
Files
1 file

What it does

When installed, the agent answers and writes PostgreSQL code using a built-in quick-reference of recommended practices. It suggests the right index type (such as B-tree, GIN or BRIN), better column data types (such as bigint IDs, timestamptz timestamps and numeric for money), efficient pagination and upserts, and Row Level Security policies. It also offers ready-made SQL for spotting unindexed foreign keys, slow queries and table bloat, plus example server configuration settings.

Great for

  • Backend developers writing SQL queries or migrations who want sensible defaults
  • Engineers troubleshooting a slow PostgreSQL database
  • Teams setting up Row Level Security or connection and timeout settings in Supabase or self-hosted Postgres

Skip it if

  • Production database changes without review: the skill gives general patterns, and ALTER SYSTEM and REVOKE statements can affect a live server if run blindly
  • Non-PostgreSQL databases such as MySQL or SQL Server, where the syntax and tuning differ
  • Complex database audits: the skill itself points to the separate database-reviewer agent for detailed guidance

Try asking

  • “Review this schema and suggest the right data types and indexes for my orders table”
  • “Why is this query slow? Help me find the missing index”
  • “Write a cursor-based pagination query for my products endpoint”
  • “Set up Row Level Security so users can only see their own rows”
Step-by-step guide: how to use PostgreSQL PatternsInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 1 original files, the MIT licence and an attribution note.

    postgres-patterns.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip postgres-patterns.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip postgres-patterns.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Test every suggested index and configuration change on a staging copy before applying it to production
  • Ask the agent to explain the trade-offs for your data size and workload, since the cheat sheets are generic
  • Use the diagnostic queries (pg_stat_statements, pg_stat_user_tables) to confirm a problem exists before changing anything

What's inside

  • SKILL.md

Redistributed unmodified from affaan-m/ECC under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.