agentsclimarketplace

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

Install
npx -y skills add ComeOnOliver/skillshub --skill database-postgresql

Assembled 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() or PrismaService.
  • Relationship Integrity: Avoid redundant raw ID columns. Favor relation properties.

Migrations (Strict Rules)

  • NEVER use synchronize: true in production.
  • Generation: Modify .entity.ts -> run pnpm migration:generate.
  • Zero-Downtime: Use Expand-Contract pattern (Add -> Backfill -> Drop) for destructive changes.
  • RLS: typeorm migration:generate cannot detect Row-Level Security. Use raw queryRunner.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 QueryRunner or $transaction for 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: true is destructive.

References

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.