postgresql

Designs and reviews PostgreSQL schemas, TypeORM entities, and versioned migrations for multi-tenant NestJS backends.

Updated Apr 4, 2026
One-click install
npx skills add https://github.com/SleyiW/iWana-neXt --skill postgresql-sleyiw
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgresql
Source: https://github.com/SleyiW/iWana-neXt/tree/main/.agents/skills/postgresql
Command: npx skills add https://github.com/SleyiW/iWana-neXt --skill postgresql-sleyiw

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Designing and evolving a PostgreSQL database in a multi-tenant NestJS modulith is error-prone: weak tenant isolation, unsafe migrations, wrong data types, and cross-module coupling can silently compromise data integrity. This Skill provides concrete modeling rules, review heuristics, and anti-patterns so schema decisions stay consistent with the project's architecture. ## Core Features & Use Cases - Multi-tenant schema modeling: Enforces schema-per-tenant isolation, correct data types (bigint identity, numeric, timestamptz, disciplined jsonb), and explicit constraints. - TypeORM and migration review: Checks entities and versioned migrations for destructive changes, missing indexes, and rollback plans. - Audit and sensitive-data design: Guides audit trail structures, retention policies, and logical deletion for compliance-sensitive data. - Use Case: When adding a billing module, use this Skill to design the invoices table with numeric money columns, tenant-scoped uniqueness, proper foreign key indexes, and a reversible migration. ## Quick Start Ask the assistant to review your TypeORM entity and its migration for multi-tenant safety, correct data types, and missing indexes.

Frequently Asked Questions about postgresql

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design PostgreSQL tables for multi-tenant schema isolation?

Use schema-per-tenant isolation where the tenant is resolved per authenticated request and never hardcoded in business logic. Every migration and query must work across schemas, and any design that weakens this isolation should be rejected.

How to review TypeORM migrations before deploying?

Check that migrations are versioned, reviewable, and reversible where applicable, with rollback or backfill plans for destructive changes. Never rely on TypeORM synchronize as the schema evolution policy in any environment.

What PostgreSQL data types should I use for money and timestamps?

Use numeric(p,s) for money and exact values, and timestamptz for time. Avoid float for billable amounts, timestamp without time zone, and the money type, since they introduce rounding or timezone bugs.

When should I use jsonb columns in PostgreSQL?

Use jsonb only for optional or variable-shape attributes that do not yet justify their own table. If you query internal jsonb fields, add a suitable index or extract the value into a materialized or generated column.

Can modules share database tables in a NestJS modulith?

Modules should not query each other's tables directly even when sharing a database. Define a contract, projection, or controlled integration for cross-module data to preserve bounded context boundaries.

Why is physical deletion risky for audited business data?

Physical deletes destroy evidence needed for audit, compliance, and traceability. Prefer a business status or logical deletion, and evaluate retention and operational impact before removing any records.