Database postgresql
Skill ComeOnOliver/skillshub/skills/HoangNguyen0403/agent-skills-standard/database-postgresql
Data access patterns, scaling, migrations, and ORM selection for PostgreSQL. (triggers: **/*.entity.ts, prisma/schema.prisma, **/migrations/*.sql, TypeOrmModule, PrismaService, PostgresModule)From its SKILL.md
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.
SKILL.md
1.6 KB, 313 tokens by cl100k_base, 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.
References
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.