postgresql-optimization
Skill0 starsChanged 4 months agoMITView on GitHub
PostgreSQL-specific development — JSONB, arrays, custom/range types, full-text search, window functions, indexing, and extensions. Use when writing, tuning, or modeling anything on PostgreSQL.
12 other projects use a version of this.
Adopted by
Most recently taken up by
- liushikuan63/Qoder-Optimizationtheir own version, first seen Nov 1, 2026
- github/awesome-copilottheir own version, first seen Oct 25, 2026
- storlay/crypto-alert-apitheir own version, first seen Oct 20, 2026
- workatustadarshajay/CareLoop-AItheir own version, first seen Oct 9, 2026
- Ghosteken/agent-harnesstheir own version, first seen Oct 1, 2026
- Adhamxon/claude-code-skillstheir own version, first seen Jul 30, 2026
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- github/awesome-copilot★ 41ksame name
- Adhamxon/claude-code-skills★ 2same name
- Ghosteken/agent-harness★ 2same name
- kimtth/agent-skill-100-lines-or-less★ 2same name
- liushikuan63/Qoder-Optimization★ 2same name
- Boboc135612/skills★ 1same name
- jornalistainclusivo/jinc-skills★ 1same name
- dhriyatinandu-bot/claude-skills★ 0same name
- ReaperOAK/ForgeOS★ 0same name
- storlay/crypto-alert-api★ 0same name
2 more not listed
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 repository63 other files it gives its agents.
- .claude/skills/nestjs-best-practices/AGENTS.mdAGENTS.md
- accessibility-a11ySkill
- architecture-blueprint-generatorSkill
- backend-delivery-loopSkill
- backend-designSkill
- backend-dev-guidelinesSkill
- backend-testingSkill
- backend-to-frontend-handoff-docsSkill
- building-componentsSkill
- bullmq-specialistSkill
- canvas-designSkill
- code-patternsSkill
- components-composition-patternsSkill
- conventional-commitSkill
- core-web-vitalsSkill
- create-svgSkill
- css-architectureSkill
- cypress-authorSkill
- cypress-docsSkill
- cypress-explainSkill
- delivery-loop-retroSkill
- diagnoseSkill
- fastify-best-practicesSkill
- figma-code-connectSkill
- frontend-delivery-loopSkill
- frontend-fundamentalsSkill
- fullstack-delivery-loopSkill
- grill-meSkill
- hunt-race-conditionSkill
- impeccableSkill
- mermaid-diagramsSkill
- nestjs-best-practicesSkill
- nextjs-best-practicesSkill
- nextjs-performanceSkill
- nodejs-backend-patternsSkill
- owasp-security-reviewSkill
- performance-hunterSkill
- playwright-best-practicesSkill
- postgresql-code-reviewSkill
- postmanSkill
- prisma-postgresSkill
- pro-state-machineSkill
- race-conditionSkill
- react-best-practicesSkill
- react-performanceSkill
- react-querySkill
- redis-coreSkill
- redis-query-engineSkill
- redis-securitySkill
- refactorSkill
- review-panelSkill
- run-delivery-chainSkill
- spec-drivenSkill
- sql-optimizationSkill
- system-designSkill
- testing-strategySkill
- tune-skills-and-agentsSkill
- ui-ux-pro-maxSkill
- vercel-react-view-transitionsSkill
- viteSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 10 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Prefer PostgreSQL-native modeling: ENUMs and domains over free VARCHAR, TIMESTAMPTZ over TIMESTAMP, range types with EXCLUDE constraints …
- Very specific: line 17
Keep the planner honest: regular VACUUM/ANALYZE, partition large tables, pool connections (pgbouncer).
“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PostgreSQL Optimization
You are a PostgreSQL specialist. Leverage what makes PostgreSQL special — its type system, index variety, and extension ecosystem — rather than treating it as a generic SQL database (for cross-database tuning, prefer the sibling sql-optimization skill).
Core Principles
- Measure before optimizing:
EXPLAIN (ANALYZE, BUFFERS)for a query,pg_stat_statementsfor the workload. - Match the index type to the data type: B-tree for scalars, GIN for JSONB/arrays/tsvector, GiST for ranges and geometry.
- Query JSONB and arrays with indexable operators (
@>,?,&&) — not text casts orANY()on large tables. - Prefer PostgreSQL-native modeling: ENUMs and domains over free VARCHAR,
TIMESTAMPTZoverTIMESTAMP, range types withEXCLUDEconstraints over app-side overlap checks. - Paginate by cursor (keyset), never by large OFFSET; replace correlated subqueries with window functions.
- Keep the planner honest: regular
VACUUM/ANALYZE, partition large tables, pool connections (pgbouncer).
References
Each file is loaded on demand — read one only when the task needs that depth (progressive disclosure).
references/advanced-data-types.md— JSONB, arrays, custom types & domains, range types (withEXCLUDEconstraints), geometric types, and the GIN/GiST indexes each needs · read when modeling schemas or querying these types.references/query-performance.md— EXPLAIN-driven analysis, index strategies (composite, partial, expression, covering), window functions, recursive CTEs, full-text search, pagination & aggregation patterns · read when a query is slow or you're designing indexes.references/extensions-monitoring.md— the extension ecosystem (uuid-ossp, pgcrypto, pg_trgm, …), slow-query/index-usage/size monitoring, connection & memory management, routine maintenance · read when picking extensions or operating an instance.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

