postgres-query-performance
Skill0 starsChanged 7 months agoApache-2.0View on GitHub
Guardrail for evidence-first Postgres and Supabase query, schema, index, RLS, and migration performance reviews.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- codecharmhq/claude-code-skillstheir own version, first seen May 17, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- codecharmhq/claude-code-skills★ 1same 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 repository57 other files it gives its agents.
- ai-app-integrationSkill
- anti-llm-frontend-designSkill
- aspnet-core-web-developmentSkill
- async-python-patternsSkill
- browser-game-foundationsSkill
- browser-local-qaSkill
- build-mcp-server-sdk-v2Skill
- canva-design-opsSkill
- check-completionSkill
- cli-tool-creatorSkill
- cloudflare-agents-mcpSkill
- cloudflare-durable-objectsSkill
- cloudflare-workers-platformSkill
- deployment-preview-workflowsSkill
- docx-document-artifactsSkill
- durable-workflow-orchestrationSkill
- dynamic-og-imagesSkill
- eval-auditSkill
- evaluate-ragSkill
- figma-design-to-code-rulesSkill
- fine-tuningSkill
- frontend-product-builderSkill
- game-asset-pipeline-expansionSkill
- game-ui-playtestSkill
- generate-synthetic-dataSkill
- github-pr-ci-opsSkill
- gmail-inbox-opsSkill
- golden-datasetSkill
- huggingface-llm-trainerSkill
- javascript-monorepo-buildsSkill
- linear-issue-managementSkill
- media-generation-transcriptionSkill
- millrace-rs-contract-paritySkill
- minecraft-mod-qa-automationSkill
- notion-workspace-flowsSkill
- openai-docsSkill
- optimize-agentic-cliSkill
- pdf-artifact-workflowSkill
- phaser-2d-game-developmentSkill
- product-ui-polish-reviewSkill
- pydantic-v2-patternsSkill
- python-repo-refactoring-hygieneSkill
- rag-corpus-hygieneSkill
- react-next-performance-reviewSkill
- rust-best-practicesSkill
- shadcn-ui-compositionSkill
- skill-evaluation-harnessSkill
- tauri-desktopSkill
- tauri-mcp-cliSkill
- tauri-ptySkill
- tile-pixel-art-transitionsSkill
- train-sentence-transformersSkill
- typer-cli-patternsSkill
- using-dbt-for-analytics-engineeringSkill
- validate-evaluatorSkill
- visual-asset-pipelineSkill
- watchdog-file-watcher-patternsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 14 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 42
If evidence is missing, say what you are assuming and name the next verifier instead of pretending the plan is proven.
- Distinctive: line 46
Do not tune without a plan or plan evidence.
- Distinctive: line 47
Do not guess indexes from column names alone.
- Distinctive: line 48
Do not treat RLS as free; account for policy cost and plan shape.
- Distinctive: line 49
Do not recommend a migration without rollback and verification.
- Distinctive: line 50
Do not expand into generic DBA advice, connection pooling, or platform-ops territory.
- Distinctive: line 51
Keep the recommended fix small: add or adjust one index, rewrite one query, change one schema detail, or split one migration.
- Distinctive: line 52
Prefer concrete evidence over theory when the claim is about performance.
- Distinctive: line 59
If a migration is involved, the rollback shape, deploy order, and verification target.
- Distinctive: line 62
Start by naming the classification and the first evidence to inspect.
- Distinctive: line 66
If evidence is missing, state the assumption and the next verifier explicitly.
- Distinctive: line 67
If a migration is part of the answer, include rollback and verification in the same pass.
- Very specific: line 73
Use EXPLAIN or EXPLAIN ANALYZE as the primary proof surface when available.
- Distinctive: line 75
If the needed evidence is missing, state the assumption, the next verifier, and the specific artifact still needed.
- Distinctive: line 77
If the task involves a migration, add rollback and verification before concluding.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Postgres Query Performance
Purpose
Help agents diagnose slow Postgres or Supabase-backed paths by reading the query, plan, schema, indexes, and RLS policies first, then recommending the smallest safe change class. This is a guardrail, not a generic DBA manual.
Use When
- the task is a slow query, suspect plan regression, missing index, late RLS filtering, or risky migration
- the database is Postgres or Supabase-backed Postgres
- the answer needs evidence before recommending a query rewrite, index change, schema change, or rollback shape
Do Not Use When
- the issue is pure SQL syntax or correctness, not performance
- the database is not Postgres
- the work belongs to broad database administration, hosting, or connection-tuning advice
Quick Start
- Classify the task first: query review, schema/index review, RLS/perf review, or migration/rollback planning.
- Inspect the query text and the first plan evidence available:
EXPLAIN,EXPLAIN ANALYZE, actual row counts, and execution metrics. - Then inspect the schema facts that change plan shape: indexes, keys, table size, selectivity, and relevant RLS policies.
- Rule in or out the likely bottleneck class: missing index, bad join shape, low selectivity or cardinality, policy evaluation cost, or migration risk.
- If evidence is missing, say what you are assuming and name the next verifier instead of pretending the plan is proven.
- End with the smallest safe change class and the evidence captured for the next check.
Operating Constraints
- Do not tune without a plan or plan evidence.
- Do not guess indexes from column names alone.
- Do not treat RLS as free; account for policy cost and plan shape.
- Do not recommend a migration without rollback and verification.
- Do not expand into generic DBA advice, connection pooling, or platform-ops territory.
- Keep the recommended fix small: add or adjust one index, rewrite one query, change one schema detail, or split one migration.
- Prefer concrete evidence over theory when the claim is about performance.
Inputs This Skill Expects
- The query text and any bind parameters or filters that affect selectivity.
- The current plan evidence, ideally
EXPLAIN ANALYZEplus actual rows and timing. - Existing indexes, keys, constraints, table sizes, and row-count context.
- Relevant schema details, joins, and RLS policy snippets.
- If a migration is involved, the rollback shape, deploy order, and verification target.
Output Contract
- Start by naming the classification and the first evidence to inspect.
- Separate plan evidence from schema or policy assumptions.
- Identify the most likely bottleneck class before suggesting a fix.
- Give the smallest safe change class and the evidence that makes it safe enough.
- If evidence is missing, state the assumption and the next verifier explicitly.
- If a migration is part of the answer, include rollback and verification in the same pass.
- End with a handoff line naming the next verifier and the evidence intentionally captured.
Procedure
- Classify the request before recommending any change.
- Inspect query text and plan evidence first, then compare the observed shape with indexes, schema, and policies.
- Use
EXPLAINorEXPLAIN ANALYZEas the primary proof surface when available. - Decide whether the main issue is index coverage, join shape, selectivity or cardinality, policy evaluation cost, or migration risk.
- If the needed evidence is missing, state the assumption, the next verifier, and the specific artifact still needed.
- Recommend the smallest safe fix class and keep the change bounded to the observed bottleneck.
- If the task involves a migration, add rollback and verification before concluding.
Pitfalls And Gotchas
- Rejected trope: tuning without a plan or plan evidence. Better alternative: start from
EXPLAIN ANALYZEand actual rows. - Rejected trope: guessing indexes from column names. Better alternative: match the filter, join, and sort order to the observed plan and selectivity.
- Rejected trope: treating RLS as free. Better alternative: inspect the policy predicates and account for when they are evaluated.
- Rejected trope: recommending a migration without rollback or verification. Better alternative: include the rollback path and the evidence that proves the change safe.
- Rejected trope: broad DBA advice. Better alternative: stay within the smallest query, schema, index, or policy change that addresses the observed bottleneck.
Progressive Disclosure
Start with the query and plan, then widen only if schema, policy, or migration facts change the bottleneck class. Keep one umbrella skill for query, index, schema, RLS, and migration guidance so the evidence loop stays in one place. Add deeper references only if later QA shows the plan-reading guidance needs more detail.
Verification Pattern
- Confirm the first evidence named is the query and plan, not a guessed optimization.
- Confirm the bottleneck class matches the observed plan and schema facts.
- Confirm the recommendation is one small change class rather than a broad rewrite.
- Confirm RLS cost is checked separately from base query cost when policies exist.
- Confirm any migration includes rollback and verification.
- Confirm the handoff names the next verifier and the evidence intentionally captured.
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.

