postgres-best-practices
Optimize Postgres Queries and Schemas
Slow queries and unsafe database patterns are hard to catch during ordinary code review. This skill gives Claude, Codex, and Claude Code structured Postgres guidance for indexes, RLS, pooling, transactions, and diagnostics.
Install with my Agent
Copy this request to your Agent. It includes the canonical Skill page and manifest.
Review the Skillstore skill "postgres-best-practices" from https://skillstore.io/skills/sickn33-postgres-best-practices.md and its manifest at https://skillstore.io/api/skills/sickn33-postgres-best-practices/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.Your Agent should still show its plan and request any confirmation required by the security policy.
Agent-readable resources
Use these links when an AI agent, crawler, or script needs clean context instead of reading the full page.
Test it
Using "postgres-best-practices". A query filters orders by status and created date but only has separate single-column indexes.
Expected outcome:
- Recommend one composite index with equality columns before range columns.
- Explain why separate indexes may require extra bitmap and table work.
- Suggest validation with a real execution plan on representative data.
Using "postgres-best-practices". A Supabase policy checks the current user directly on each row of a large table.
Expected outcome:
- Recommend evaluating the current user once per statement.
- Confirm an index exists on the policy column used for filtering.
- Flag complex membership checks for a reviewed helper function.
Using "postgres-best-practices". A worker queue selects the oldest pending job, and multiple workers block each other.
Expected outcome:
- Recommend a non-blocking locked-row claim pattern for parallel workers.
- Prefer one claim-and-update operation that returns the selected job.
- Keep the transaction short to reduce lock contention.
Security Audit
SafeStatic analysis reported many suspicious patterns, but review found they are SQL examples, Markdown formatting, and documentation links. No executable scripts, network clients, command execution, credential access, exfiltration behavior, or prompt-injection instructions were found. The remaining operational risk is that users should review administrative SQL before applying it to production databases.
Risk Factors
โก Contains scripts (4)
๐ Network access (6)
โ๏ธ External commands (11)
Share & cite this report
Share the versioned assessment report, neutral badge, embed card, and citations. Skillstore reports evidence without deciding whether this Skill is safe.
Copy report link
https://skillstore.io/skills/sickn33-postgres-best-practices/audits/4?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_reportMarkdown badge
[](https://skillstore.io/skills/sickn33-postgres-best-practices?utm_source=security_passport_badge)HTML badge
<a href="https://skillstore.io/skills/sickn33-postgres-best-practices?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/sickn33-postgres-best-practices/security.svg" alt="Skillstore security assessment" loading="lazy"></a>Embed card
<iframe src="https://skillstore.io/embed/skills/sickn33-postgres-best-practices.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>Academic citations (APA ยท BibTeX ยท CFF)
APA citation
sickn33. (2026). postgres-best-practices security audit report (audit version 4) [Author version 1.0.0]. Skillstore. https://skillstore.io/skills/sickn33-postgres-best-practices/audits/4BibTeX citation
@techreport{sickn33-sickn33-postgres-best-practices-2026,
author = {sickn33},
title = {postgres-best-practices security audit report (audit version 4)},
institution = {Skillstore},
year = {2026},
number = {4},
url = {https://skillstore.io/skills/sickn33-postgres-best-practices/audits/4},
note = {Author version 1.0.0}
}CITATION.cff
cff-version: 1.2.0
message: "If you use this Skill, cite its author and this versioned security audit report."
title: "postgres-best-practices security audit report (audit version 4)"
version: "1.0.0"
type: report
authors:
- name: "sickn33"
date-released: "2026-07-07"
url: "https://skillstore.io/skills/sickn33-postgres-best-practices/audits/4"
identifiers:
- type: other
value: "skillstore:sickn33-postgres-best-practices:audit:4"
description: "Skillstore immutable audit report identifier"
Skillstore Score
Why this score Evidence Confidence: HighWhat You Can Build
Review a slow query before release
Check filters, joins, pagination, and selected columns against Postgres indexing rules before merging application code.
Design a scalable tenant schema
Plan primary keys, RLS policies, foreign key indexes, partitioning, and data types for a multi-tenant product.
Improve Supabase operational settings
Review connection pooling, idle timeouts, prepared statements, and monitoring queries for a growing Supabase workload.
Try These Prompts
Review this Postgres query for performance problems. Identify missing indexes, inefficient filters, and safer alternatives. Explain each recommendation briefly.
Review this Postgres migration for data type choices, primary keys, foreign key indexes, naming, and future scaling risks. Suggest precise migration changes.
Review these Supabase RLS policies for security and performance. Check function calls, indexes, policy scope, and least-privilege access.
Build a prioritized Postgres tuning plan from these queries, schema notes, and workload constraints. Include indexes, pooling, transactions, monitoring, and rollout risks.
Best Practices
- Validate recommendations with execution plans and representative production-like data.
- Prioritize indexes for frequent filters, joins, ordering, and RLS policy columns.
- Review administrative SQL in a staging environment before applying it to production.
Avoid
- Adding separate single-column indexes for every multi-column query without checking column order.
- Using application-only tenant filters instead of database-enforced RLS policies.
- Keeping transactions open while external API calls or long application work runs.
Frequently Asked Questions
Does this skill run SQL against my database?
Is it specific to Supabase?
Can it replace EXPLAIN ANALYZE?
Does it cover security?
Can beginners use it?
What should I review before applying examples?
Developer Details
Author
sickn33License
MIT
Author version
v1.0.0
Skillstore revision
r1
Repository
https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/postgres-best-practicesRef
816c62b2546ddb1c6a0453e7c781b5e095117819
Maintenance freshness
7/18/2026
Usage
10 downloads ยท 117 views
File structure
๐ rules/
๐ _contributing.md
๐ _sections.md
๐ _template.md
๐ advanced-full-text-search.md
๐ advanced-jsonb-indexing.md
๐ conn-idle-timeout.md
๐ conn-limits.md
๐ conn-pooling.md
๐ conn-prepared-statements.md
๐ data-n-plus-one.md
๐ data-pagination.md
๐ data-upsert.md
๐ lock-advisory.md
๐ lock-deadlock-prevention.md
๐ lock-short-transactions.md
๐ lock-skip-locked.md
๐ monitor-explain-analyze.md
๐ monitor-pg-stat-statements.md
๐ monitor-vacuum-analyze.md
๐ query-composite-indexes.md
๐ query-covering-indexes.md
๐ query-index-types.md
๐ schema-data-types.md
๐ schema-foreign-key-indexes.md
๐ schema-lowercase-identifiers.md
๐ security-rls-performance.md
๐ AGENTS.md
๐ metadata.json
๐ README.md
๐ SKILL.md