postgres-best-practices
Skill46 starsChanged 9 months agoApache-2.0View on GitHub
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.
Files
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 |
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- baekenough/oh-my-customcode★ 42same name
- kumaran-is/claude-code-onboarding★ 35same name
- bcastelino/agent-skills-kit★ 2same name
- Ghosteken/agent-harness★ 2same name
- allanninal/claude-code-skills★ 1same name
- jahongashtamc/hallwright★ 1same name
- jornalistainclusivo/jinc-skills★ 1same name
- mahik504/orchestra-workflow★ 1same name
- storlay/crypto-alert-api★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository2 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skill-creatorSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

