database-postgresql
/database-postgresql
Apply PostgreSQL standards for migrations, indexing, transactions, and ORM boundaries. Use when editing entities, Prisma schema, migrations, RLS, or query-performance work for PostgreSQL.
- Author
- HoangNguyen0403 ↗
- Repository
- agent-skills-standard ↗
- Licence
- MIT
- Last repository change
- 22.10.2026
Assessment and security
- Files in this package
- 7
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 22.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Apply PostgreSQL standards for migrations, indexing, transactions, and ORM boundaries. Use when editing entities, Prisma schema, migrations, RLS, or query-performance work for PostgreSQL.
Original author description
Apply PostgreSQL standards for migrations, indexing, transactions, and ORM boundaries. Use when editing entities, Prisma schema, migrations, RLS, or query-performance work for PostgreSQL.
How it works
- Priority: P0 (CRITICAL)
- Rules
- Verify
- Anti-Patterns
- References
SKILL.md preview
---
name: database-postgresql
description: Apply PostgreSQL standards for migrations, indexing, transactions, and ORM boundaries. Use when editing entities, Prisma schema, migrations, RLS, or query-performance work for PostgreSQL.
metadata:
triggers:
files:
- "**/*.entity.ts"
- "prisma/schema.prisma"
- "**/migrations/*.sql"
keywords:
- TypeOrmModule
- PrismaService
- PostgresModule
upstream:
- name: postgresql
source: github
repo: postgres/postgres
pinned: "17"
tag_pattern: "^REL_(\\d+)_(\\d+)$"
reviewed: "2026-06-17"
---
# PostgreSQL Database Standards
## **Priority: P0 (CRITICAL)**
## Rules
- Keep PostgreSQL choices driven by real read/write paths.
- Use explicit migrations; never rely on `synchronize: true` in production.
- Treat RLS, constraints, and indexes as first-class schema behavior; use `queryRunner.query()` when raw migration SQL is required.
- Enable RLS explicitly in a migration (`ALTER TABLE <table> ENABLE ROW LEVEL SECURITY`) and create tenant policies before application rollout.
- Put multi-step consistency inside one transaction boundary.
## Verify
- [ ] Destructive schema change uses expand -> backfill -> contract rollout.
- [ ] Query shape has matching indexes for filter, join, and sort paths.
- [ ] Pagination strategy is explicit.
- [ ] Transaction boundary matches one business action.
- [ ] RLS or tenant predicates are supported by indexes.
## Anti-Patterns
- **No N+1 queries**: Use query builders or eager-load relations instead of lazy-loading in loops.
- **No heavy RLS joins**: Keep RLS predicates simple; move complex logic to query/view layer.
- **No synchronize in production**: Always run explicit migrations; `synchronize: true` destructive.
- **No blind index sprawl**: each index needs a query owner.
## References
- [Framework Map](../references/framework-map.md)
- [Implementation Examples](references/implementation.md)
- [SQL Gotchas (UPDATE FROM)](references/sql-gotchas.md)
Files in this package (7)
- SKILL.md 2 KB
- evals/evals.json 2 KB
- references/anti-patterns.md 2 KB
- references/best-practices.md 4 KB
- references/checklist.md 2 KB
- references/implementation.md 1 KB
- references/sql-gotchas.md 2 KB
Versions
The database has no other skills named database-postgresql.
Database snapshot: 13.11.2026 · package version 690da2513dd5 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100prisma-workflow
Prisma ORM best practices, schema design, migrations, seeding, and query optimization for PostgreSQL. Use when working with database schemas, migrations, or Prisma queries. - 100prisma-expert
Provides Prisma ORM patterns for schema design, migrations, query optimization, and relation modeling. Use when working with Prisma schema files (schema.prisma) or when the user mentions Prisma, Prisma migrations, or Prisma queries. - 100prisma
TypeScript and Prisma ORM best practices for schema design, type-safe queries, migrations, and error handling. Use when writing Prisma schemas, building database access layers, or debugging query performance in TypeScript projects. - 100prisma-postgres-upgrade
Upgrade a PostgreSQL app from Prisma ORM 6 or 7 straight to Prisma 8 in one pass, keeping the existing schema.prisma, database and data. Use when a Postgres project on Prisma 6 or 7 wants Prisma 8, including before deploying it on Prisma Compute, which runs only Prisma 8.… - 95database-fundamentals
Reviews schema design, SQL queries, ORM patterns. Use when junior creates schema, writes queries, adds migrations, works with Prisma/MongoDB/PostgreSQL, or asks "is this SQL safe", "N+1", "index". - 100database-migrations
Database migration best practices for schema changes, data migrations, rollbacks, and zero-downtime deployments across PostgreSQL, MySQL, and common ORMs (Prisma, Drizzle, Django, TypeORM, golang-migrate). Use when planning or implementing database schema changes.