Database postgresql
Skill ComeOnOliver/skillshub/skills/HoangNguyen0403/agent-skills-standard/database-postgresql
🧠The right skill, one API call. AI agent skills registry with token-efficient skill resolution. 5,000+ skills from 500+ top repos.
npx -y skills add ComeOnOliver/skillshub --skill database-postgresqlAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
What its author says it does
Copied from the file, not written here
Data access patterns, scaling, migrations, and ORM selection for PostgreSQL. (triggers: **/*.entity.ts, prisma/schema.prisma, **/migrations/*.sql, TypeOrmModule, PrismaService, PostgresModule)
SKILL.md
1.6 KB, as published. Nobody here has run it
PostgreSQL Database Standards
Priority: P0 (FOUNDATIONAL)
Integration patterns and ORM standards for PostgreSQL applications.
Patterns & Architecture
- Repository Pattern: Isolate database logic. Use
@InjectRepository()orPrismaService. - Relationship Integrity: Avoid redundant raw ID columns. Favor relation properties.
Migrations (Strict Rules)
- NEVER use
synchronize: truein production. - Generation: Modify
.entity.ts-> runpnpm migration:generate. - Zero-Downtime: Use Expand-Contract pattern (Add -> Backfill -> Drop) for destructive changes.
- RLS:
typeorm migration:generatecannot detect Row-Level Security. Use rawqueryRunner.query()SQL for RLS.
Performance & Gotchas
- Pagination: Mandatory. Use limit/offset or cursor-based pagination.
- Indexing: Define indexes in code for frequently filtered columns. RLS columns MUST be indexed.
- Transactions: Use
QueryRunneror$transactionfor multi-step mutations.
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 the query/view layer.
- No synchronize in production: Always run explicit migrations;
synchronize: trueis destructive.