ToggleOps

Postgres Rules Checker

Postgres best practices maintained by Supabase, for Postgres running anywhere.

Open in the library
Postgres Rules Checker

What it does

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 (pg_cron, pgmq), vector/semantic search (pgvector), and restoring dumps (pg_restore) 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. Use when writing or changing anything that lives in a Postgres database.

What’s inside

35files
51 KBin total
5,707words of method
261hard numbers
SKILL.md3 KB
Markdown · 62 lines · 216 words · sha 0804e649105a
Postgres Rules Checker1 line · 1 number
When to Apply7 lines
Rule Categories by Priority10 lines · 8 numbers
How to Use13 lines
References2 lines
CREDITS.md1 KB
Markdown · 26 lines · 98 words · sha e0c7662bec33
Credits5 lines · 3 numbers
Changes from upstream15 lines
LICENSE1 KB
references32 files · 46 KB
_sections.md2 KB
Markdown · 40 lines · 156 words · sha c9e992612b42
Section Definitions3 lines
1. Query Performance (query)2 lines
2. Connection Management (conn)2 lines
3. Security & RLS (security)2 lines
4. Schema Design (schema)2 lines
5. Concurrency & Locking (lock)2 lines
6. Data Access Patterns (data)2 lines · 1 number
7. Monitoring & Diagnostics (monitor)2 lines
8. Advanced Features (advanced)2 lines
advanced-full-text-search.md1 KB
Markdown · 55 lines · 149 words · sha f5b67b8a47aa
Use tsvector for Full-Text Search32 lines
advanced-jsonb-indexing.md1 KB
Markdown · 50 lines · 163 words · sha 24cacf6a8bc3
Index JSONB Columns for Efficient Querying29 lines · 2 numbers
conn-idle-timeout.md1 KB
Markdown · 47 lines · 117 words · sha 630588902c00
Configure Idle Connection Timeouts27 lines · 5 numbers
conn-limits.md1 KB
Markdown · 44 lines · 158 words · sha be0758399201
Set Appropriate Connection Limits24 lines · 13 numbers
conn-pooling.md1 KB
Markdown · 41 lines · 146 words · sha 1f59d5b9378e
Use Connection Pooling for All Applications21 lines · 10 numbers
conn-prepared-statements.md1 KB
Markdown · 46 lines · 167 words · sha 157ee274910a
Use Prepared Statements Correctly with Pooling26 lines · 10 numbers
data-batch-inserts.md1 KB
Markdown · 55 lines · 156 words · sha 531933b82d6a
Batch INSERT Statements for Bulk Data35 lines · 15 numbers
data-n-plus-one.md1 KB
Markdown · 53 lines · 188 words · sha 45e54faf82d1
Eliminate N+1 Queries with Batch Loading31 lines · 19 numbers
data-pagination.md1 KB
Markdown · 50 lines · 179 words · sha dc0c0f6ccd37
Use Cursor-Based Pagination Instead of OFFSET29 lines · 33 numbers
data-upsert.md1 KB
Markdown · 51 lines · 156 words · sha 2612af83b20a
Use UPSERT for Insert-or-Update Operations32 lines · 6 numbers
lock-advisory.md1 KB
Markdown · 57 lines · 139 words · sha c88d259dbf81
Use Advisory Locks for Application-Level Locking36 lines
lock-deadlock-prevention.md2 KB
Markdown · 69 lines · 244 words · sha 09aee46f51d7
Prevent Deadlocks with Consistent Lock Ordering46 lines · 22 numbers
lock-short-transactions.md1 KB
Markdown · 51 lines · 156 words · sha 5aa7f6109591
Keep Transactions Short to Reduce Lock Contention30 lines · 7 numbers
lock-skip-locked.md1 KB
Markdown · 55 lines · 175 words · sha 6c45077f430f
Use SKIP LOCKED for Non-Blocking Queue Processing36 lines · 13 numbers
monitor-explain-analyze.md1 KB
Markdown · 45 lines · 179 words · sha 8242e58a4c65
Use EXPLAIN ANALYZE to Diagnose Slow Queries27 lines · 14 numbers
monitor-pg-stat-statements.md1 KB
Markdown · 55 lines · 137 words · sha e2803b9b2305
Enable pg_stat_statements for Query Analysis35 lines · 5 numbers
monitor-vacuum-analyze.md1 KB
Markdown · 55 lines · 157 words · sha 8f11ce62da69
Maintain Table Statistics with VACUUM and ANALYZE35 lines · 7 numbers
query-composite-indexes.md1 KB
Markdown · 45 lines · 160 words · sha 73e42424e671
Create Composite Indexes for Multi-Column Queries25 lines · 12 numbers
query-covering-indexes.md1 KB
Markdown · 41 lines · 137 words · sha daf2a7f0477f
Use Covering Indexes to Avoid Table Lookups21 lines
query-index-types.md1 KB
Markdown · 49 lines · 170 words · sha 472a74f22c2d
Choose the Right Index Type for Your Data28 lines · 2 numbers
query-missing-indexes.md1 KB
Markdown · 43 lines · 124 words · sha 7733305745db
Add Indexes on WHERE and JOIN Columns22 lines · 8 numbers
query-partial-indexes.md1 KB
Markdown · 46 lines · 150 words · sha 6448982bc855
Use Partial Indexes for Filtered Queries26 lines
schema-constraints.md2 KB
Markdown · 81 lines · 209 words · sha 90e8efda3e9e
Add Constraints Safely in Migrations60 lines · 5 numbers
schema-data-types.md1 KB
Markdown · 47 lines · 161 words · sha e01b58c14c7f
Choose Appropriate Data Types30 lines · 7 numbers
schema-foreign-key-indexes.md2 KB
Markdown · 60 lines · 206 words · sha 7587713d12a6
Index Foreign Key Columns40 lines · 7 numbers
schema-lowercase-identifiers.md2 KB
Markdown · 56 lines · 198 words · sha 4bc80f70865f
Use Lowercase Identifiers for Compatibility35 lines · 2 numbers
schema-partitioning.md2 KB
Markdown · 56 lines · 172 words · sha 541e13fbeaf4
Partition Large Tables for Better Performance34 lines · 18 numbers
schema-primary-keys.md2 KB
Markdown · 62 lines · 204 words · sha 3c8beabef820
Select Optimal Primary Key Strategy42 lines · 1 number
security-privileges.md1 KB
Markdown · 54 lines · 184 words · sha 70596ac774fd
Apply Principle of Least Privilege33 lines
security-rls-basics.md1 KB
Markdown · 50 lines · 149 words · sha beaabcbf4ae7
Enable Row Level Security for Multi-Tenant Data29 lines · 2 numbers
security-rls-performance.md2 KB
Markdown · 63 lines · 247 words · sha 2b8d865cc5d8
Optimize RLS Policies for Performance39 lines · 3 numbers

The text is never on this site. It loads into your Claude when a task needs it.

More skills

ExploreFor creatorsDiscordTermsPrivacy
Not affiliated with Anthropic. Claude is a trademark of Anthropic.
Get early access