
postgres-best-practices
Best practices and guidelines for working with Postgres. Covers schema design, indexing strategies, query optimization, migrations, and common pitfalls. Use when writing SQL, designing database schemas, optimizing queries, or setting up a Postgres database.
- Installs
- 1.9K
- Last 24h
- +18
- Trending rank
- #6214
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/neondatabase/postgres-skills --skill postgres-best-practices- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads postgres-best-practices automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Postgres Best Practices
Guidelines and best practices for working with Postgres, covering schema design, indexing, query optimization, and common pitfalls.
Supported Versions
This skill covers PostgreSQL 14 through 18. Version-specific features are tagged (e.g., [PG15+], [PG18+]); environment-dependent examples identify required privileges, extensions, or multi-node setup.
PostgreSQL provides 5 years of support per major version. Always run the latest minor release.
| Version | Initial Release | End of Life |
|---|---|---|
| 18 | September 2025 | November 2030 |
| 17 | September 2024 | November 2029 |
| 16 | September 2023 | November 2028 |
| 15 | October 2022 | November 2027 |
| 14 | September 2021 | November 2026 |
Source: postgresql.org/support/versioning
References
| Area | Resource | When to Use |
|---|---|---|
| Schema Design | references/schema-design.md | Designing tables, choosing data types, normalizing, partitioning |
| Indexing | references/indexing.md | Choosing index types, composite indexes, partial/covering indexes |
| Query Optimization | references/query-optimization.md | Reading EXPLAIN ANALYZE, fixing bottlenecks, planner tuning |
| Query Patterns | references/query-patterns.md | CTEs, window functions, lateral joins, UPSERT, JSONB, anti-patterns |
| Performance Diagnostics | references/performance-diagnostics.md | pg_stat views, lock analysis, VACUUM, connection management |
| Logical Replication | references/logical-replication.md | Pub/sub replication, live migrations, CDC |
| Hot Standby | references/hot-standby.md | Streaming replication, read replicas, failover |
| Transaction Isolation | references/transaction-isolation.md | Isolation levels, lost updates, serialization failures, retry logic |
| Backup & Restore | references/backup-restore.md | pg_dump/pg_restore, pg_basebackup, PITR, recovery |
| Security & Roles | references/security-roles.md | Privileges, RLS, pg_hba.conf, authentication, SSL |
| Bulk Data Loading | references/bulk-loading.md | COPY patterns, ETL staging, optimizing large loads, batch ops |
| Connection Pooling | references/connection-pooling.md | PgBouncer config, pool modes, prepared statements, sizing |
| Major Version Upgrades | references/major-version-upgrades.md | pg_upgrade, logical replication migration, pre/post checklists |
FAQ
What does the postgres-best-practices skill do?
Best practices and guidelines for working with Postgres. Covers schema design, indexing strategies, query optimization, migrations, and common pitfalls. Use when writing SQL, designing database schemas, optimizing queries, or setting up a Postgres database.
How do I install postgres-best-practices?
Run npx skills add https://github.com/neondatabase/postgres-skills --skill postgres-best-practices in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/postgres-best-practices/ (personal) or .claude/skills/postgres-best-practices/ (project).
Which AI agents can use postgres-best-practices?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is postgres-best-practices safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains postgres-best-practices?
It is published by neondatabase in neondatabase/postgres-skills, and it is an official skill from the maker of the technology it covers. It has 1,882 recorded installs.
More from neondatabase/postgres-skills
skill-creator
neondatabase/postgres-skills
Open the skill to read its SKILL.md instructions.
Popular data & databases skills
supabase-postgres-best-practices
supabase/agent-skills
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 (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) 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.
prisma-client-api
prisma/skills
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
prisma-database-setup
prisma/skills
Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.
prisma-cli
prisma/skills
Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.
prisma-postgres
prisma/skills
Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.
prisma-driver-adapter-implementation
prisma/skills
Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.