Postgres Patterns
PostgreSQL reference covering index selection, data types, RLS policies, and slow-query diagnosis in one quick-reference sheet.
- CCM score
- 71 of 100
- skills.sh installs
- 15.2K
- GitHub stars
- 312.6K
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers index type choice (B-tree, GIN, BRIN, composite, covering, partial), data type picks, and common query patterns like UPSERT and cursor pagination
- Includes ready-to-run SQL for finding unindexed foreign keys, slow queries via
pg_stat_statements, and table bloat - Provides a configuration template setting
max_connections,work_mem, and statement and idle-transaction timeouts, plus aREVOKEon the public schema - Designed for developers writing schemas, migrations, or RLS policies, or troubleshooting slow queries
Install
$ npx -y skills add affaan-m/ecc --skill postgres-patterns -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
PostgreSQL Patterns
Quick reference for PostgreSQL best practices. For detailed guidance, use the database-reviewer agent.
When to Activate
- Writing SQL queries or migrations
- Designing database schemas
- Troubleshooting slow queries
- Implementing Row Level Security
- Setting up connection pooling
Quick Reference
Index Cheat Sheet
| Query Pattern | Index Type | Example |
|---|---|---|
WHERE col = value | B-tree (default) | CREATE INDEX idx ON t (col) |
WHERE col > value | B-tree | CREATE INDEX idx ON t (col) |
WHERE a = x AND b > y | Composite | CREATE INDEX idx ON t (a, b) |
WHERE jsonb @> '{}' | GIN | CREATE INDEX idx ON t USING gin (col) |
WHERE tsv @@ query | GIN | CREATE INDEX idx ON t USING gin (col) |
| Time-series ranges | BRIN | CREATE INDEX idx ON t USING brin (col) |
Data Type Quick Reference
| Use Case | Correct Type | Avoid |
|---|---|---|
| IDs | bigint | int, random UUID |
| Strings | text | varchar(255) |
| Timestamps | timestamptz | timestamp |
| Money | numeric(10,2) | float |
| Flags | boolean | varchar, int |
Common Patterns
Details
- Repository
- github.com/affaan-m/ecc
- Category
- Databases
- First seen
- Jul 14, 2026
Questions
What does the postgres-patterns skill help with?
The postgres-patterns skill gives an agent PostgreSQL patterns for query optimization, schema design, indexing, and security. It includes quick references for index types, data type choices, cursor pagination, queue processing, and Row Level Security policies.
Is postgres-patterns a good fit for debugging slow PostgreSQL queries?
Yes, the skill is meant to be used when a query is too slow or when designing PostgreSQL schemas, indexes, or RLS policies. It includes anti-pattern detection queries that find unindexed foreign keys, slow statements through pg_stat_statements, and table bloat.
How do I install the postgres-patterns skill?
Run npx -y skills add affaan-m/ecc --skill postgres-patterns -y inside your project. Once installed, the agent can use the PostgreSQL index cheat sheet, data type guidance, and configuration template in its work.
Which skills lead the Databases category where postgres-patterns ranks?
postgres-patterns ranks in the top 50 of the Databases category on Claude Marketplaces. Its neighbors there include supabase-postgres-best-practices and several Prisma skills, while postgres-patterns focuses on raw PostgreSQL tuning and Row Level Security.
More from affaan-m/ecc
All 257- Frontend Slides15.2K
- Django Patterns15.2K
- Tdd Workflow15K
- Rust Testing14.8K
- Prompt Optimizer14.5K
- Java Coding Standards14.5K
- Django Security14.4K
- Python Testing14.3K
- Laravel Security14.3K
- Android Clean Architecture14.3K
- Article Writing14.3K
- Cpp Coding Standards14.3K
- Springboot Security14.2K
- Liquid Glass Design14.2K
- Database Migrations14.1K
- E2e Testing14.1K
- Strategic Compact14K
- Laravel Patterns13.8K
- Verification Loop13.6K
- Codebase Onboarding13.6K
- Springboot Tdd13.4K
- Security Scan13.4K
- Django Tdd13.3K
- Deployment Patterns13.3K
Similar to Postgres Patterns
More Databasespostgresql-best-practicesmindrally/skills1.6K installsReference guide of PostgreSQL practices for schema design, indexing, query tuning, and administration.
supabase-postgres-best-practicessupabase/agent-skills496.8K installsPostgres best-practices guide covering query performance, connections, RLS, schema, locking, and advanced features.
sql-optimization-patternswshobson/agents21K installsPractical SQL query tuning guide covering EXPLAIN analysis, index design, and common anti-pattern fixes.
postgres-best-practicesneondatabase/postgres-skills2.2K installsComprehensive Postgres guidance covering schema design, indexing, query tuning, and replication for PostgreSQL 14 through 18.
postgresplanetscale/database-skills8.8K installsPostgreSQL best-practices guide with PlanetScale-specific references for schema, query, and connection work.
postgresql-optimizationgithub/awesome-copilot17.3K installsPostgreSQL-specific guidance covering JSONB, arrays, range and geometric types, full-text search, and query tuning.