postgres-best-practices
Skill1 starsChanged 10 days agoMITView on GitHub
Enforces Supabase and Neon Postgres 8-category best practices covering schema design, zero-downtime migrations, RLS security, indexing, EXPLAIN query plans, and pooling.
11 other projects use a version of this.
Adopted by
Most recently taken up by
- bepaldes/heimdall-agenttheir own version, first seen Nov 8, 2026
- jahongashtamc/hallwrighttheir own version, first seen Nov 1, 2026
- storlay/crypto-alert-apitheir own version, first seen Oct 20, 2026
- allanninal/claude-code-skillstheir own version, first seen Oct 17, 2026
- mahik504/orchestra-workflowtheir own version, first seen Oct 15, 2026
- baekenough/oh-my-customcodetheir own version, first seen Oct 3, 2026
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- neondatabase/postgres-skills★ 46same name
- baekenough/oh-my-customcode★ 42same name
- kumaran-is/claude-code-onboarding★ 35same name
- bcastelino/agent-skills-kit★ 2same name
- bepaldes/heimdall-agent★ 2same name
- Ghosteken/agent-harness★ 2same name
- allanninal/claude-code-skills★ 1same name
- jahongashtamc/hallwright★ 1same name
- jornalistainclusivo/jinc-skills★ 1same name
- mahik504/orchestra-workflow★ 1same name
1 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 repository45 other files it gives its agents.
- ask-mattSkill
- audit-context-buildingSkill
- codebase-designSkill
- code-eleganceSkill
- code-reviewSkill
- diagnosing-bugsSkill
- differential-reviewSkill
- dispatching-parallel-agentsSkill
- domain-modelingSkill
- elegant-delivery-docsSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- impeccableSkill
- implementSkill
- implement-specSkill
- improve-codebase-architectureSkill
- karpathy-guidelinesSkill
- mcp-builderSkill
- ponytail-auditSkill
- ponytail-debtSkill
- ponytail-gainSkill
- ponytail-helpSkill
- ponytail-reviewSkill
- ponytailSkill
- prior-art-researchSkill
- prototypeSkill
- prSkill
- react-best-practicesSkill
- receiving-code-reviewSkill
- researchSkill
- retroSkill
- ruflo-swarm-sparcSkill
- scrapling-officialSkill
- setup-matt-pocock-skillsSkill
- setup-pre-commitSkill
- subagent-prompt-architectureSkill
- tddSkill
- to-specSkill
- to-ticketsSkill
- triageSkill
- using-git-worktreesSkill
- verification-before-completionSkill
- wayfinderSkill
- webapp-testingSkill
The file
Files
/postgres-best-practices — 数据库 Schema、零停机迁移、RLS 安全与慢查询优化手册
融合 supabase/agent-skills 与 neondatabase/postgres-skills,适用于 PostgreSQL 及各类关系型数据库:
八大数据库工程铁律
- 精确类型与约束:时间统一用
timestamptz;金额用numeric或整数最小货币单位;主键优先bigint identity或UUIDv7。 - 零停机安全迁移:大表建索引使用
CONCURRENTLY;分步新增非空约束(NOT VALID→VALIDATE);迁移设置lock_timeout。 - 多租户隔离与 RLS 测试:多租户表强制校验租户边界,并编写跨租户越权访问被拒绝的反向回归测试。
- 外键与复合索引:所有外键列必须建索引;复合索引遵循“等值列在前、范围/排序列在后”,高频过滤使用 Partial Index。
- 消灭 N+1 与深分页慢查询:严禁循环内查库;大数据集分页采用基于游标的 Keyset Pagination 取代大
OFFSET;结合EXPLAIN (ANALYZE, BUFFERS)实测优化。 - 短事务原则:严禁在数据库事务块内发起外部 HTTP 请求、文件上传或大模型调用。
- 并发原子写入:状态流转或扣减采用原子条件更新或
FOR UPDATE SKIP LOCKED;幂等写入采用ON CONFLICT。 - 向量与队列扩展:合理配置
pgvectorHNSW 索引与队列消费幂等性。
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.

