ProSkillsLibraryFreePassScan
Data & SQL

Data & SQL · agent skill

Schema Designer

Tables, keys and constraints from your domain.

What it does

Loads when it is needed

Your agent loads it when the user designs tables or a data model. It carries 5 rules and reads a profile.md with your details before it starts, so the output matches your brand and project.

Same prompt, with and without

Multi-tenant invoicing schema

Prompt · Design the Postgres schema for our B2B invoicing app: tenants, customers, invoices with line items, and payments. Prisma on top.

Domain: each tenant (a company) has customers; a customer gets invoices; an invoice has 1-50 lines; payments are applied to invoices (partial payments allowed).
Top queries: (1) a customer's 20 most recent invoices, run constantly; (2) outstanding balance per customer for a tenant; (3) find an invoice by its human number, e.g. INV-2041, within a tenant.
Scale: ~2,000 tenants, ~5M invoices, ~30M lines. Multi-currency. Invoices are never deleted, only voided.

Profile used: Postgres 16, Prisma, ~30M rows largest table; snake_case, plural tables, bigint ids, timestamptz

Without the skill
Core idea: every table carries tenant_id, and child tables use composite FKs so a row can never point at another tenant's data. tenants(id bigint PK, name, created_at timestamptz) customers(id, tenant_id FK, name, email, currency char(3), created_at; UNIQUE(tenant_id, id)) invoices(id, tenant_id, customer_id, number text, status text check in (draft, open, paid, void), currency char(3), total_cents bigint, issued_at timestamptz, due_at, voided_at, created_at) FK (tenant_id, customer_id) -> customers(tenant_id, id) UNIQUE (tenant_id, number) -- query 3 INDEX (customer_id, issued_at DESC, id DESC) -- query 1 UNIQUE (tenant_id, id) invoice_lines(id, tenant_id, invoice_id, position int, description, quantity numeric, unit_price_cents bigint, amount_cents bigint) FK (tenant_id, invoice_id) -> invoices(tenant_id, id); INDEX (invoice_id) payments(id, tenant_id, customer_id, amount_cents bigint, currency char(3), received_at, method) payment_applications(id, tenant_id, payment_id, invoice_id, amount_cents bigint check > 0; INDEX (invoice_id), (payment_id)) Money is stored as integer minor units plus a currency code. Never use floats. …
With the skill
Schema: B2B invoicing ERD: tenants ||--o{ customers; customers ||--o{ invoices; invoices ||--|{ invoice_lines; invoices ||--o{ payments CREATE TABLE invoices ( id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY, tenant_id bigint NOT NULL REFERENCES tenants (id) ON DELETE RESTRICT, customer_id bigint NOT NULL, number text NOT NULL, status text NOT NULL DEFAULT 'draft' CHECK (status IN ('draft','open','paid','void')), currency char(3) NOT NULL, total_cents bigint NOT NULL CHECK (total_cents >= 0), created_at timestamptz NOT NULL DEFAULT now(), UNIQUE (tenant_id, number), UNIQUE (tenant_id, id), FOREIGN KEY (tenant_id, customer_id) REFERENCES customers (tenant_id, id) ON DELETE RESTRICT); CREATE TABLE invoice_lines ( tenant_id bigint NOT NULL, invoice_id bigint NOT NULL, line_no int NOT NULL CHECK (line_no > 0), description text NOT NULL, quantity int NOT NULL CHECK (quantity > 0), unit_price_cents bigint NOT NULL CHECK (unit_price_cents >= 0), PRIMARY KEY (invoice_id, line_no), FOREIGN KEY (tenant_id, invoice_id) REFERENCES invoices (tenant_id, id) ON DELETE CASCADE); -- payments: same pattern, amount_cents > 0 CREATE INDEX idx_invoices_customer_recent ON invoices (tenant_id, customer_id, created_at DESC); -- query 1 CREATE INDEX idx_invoices_open ON invoices (tenant_id, customer_id) INCLUDE (total_cents) WHERE status = 'open'; -- query 2 -- query 3: UNIQUE (tenant_id, number) Decisions 1. bigint identity ids; invoices are found by (tenant_id, number), so no public uuid. 2. Money: bigint cents plus currency; line totals computed, not stored. 3. tenant_id leads every key and index; composite FKs block cross-tenant links. Add RLS; the app role must not own tables. 4. No soft delete: RESTRICT plus status 'void'. 5. No stored balance (open total minus payments); add paid_cents only if measured slow. 6. Prisma: @@unique([tenantId, id]) on parents, @@id([invoiceId, lineNo]). DDL not run.

Both answers from the same model (Claude sonnet), 2026-10-16. The one without the skill was written in a separate session that never saw it. Shortened where marked with …

Install

One command, in your project

It detects your agent; add --agent all for every agent.

npx proskills-cli add schema-designer --order <order id from your receipt>

Or copy the skill folder (the one holding SKILL.md) into the directory your agent reads, then restart it or start a new session.

AgentThis projectEvery project
Claude Code.claude/skills/~/.claude/skills/
Cursor.agents/skills/ (or .cursor/skills/)~/.cursor/skills/
Codex.agents/skills/~/.agents/skills/
Gemini CLI.agents/skills/ (or .gemini/skills/)~/.gemini/skills/

Changelog

What changed

  • v1.0.0 · 2026-10-16
    • First versioned release: Tables, keys and constraints from your domain.
    • Scanned 100/100 before release.

Keep it current with npx proskills-cli update; your profile.md is never touched. Everyone who bought it gets the update free and an email when it lands.

Same collection

More from Data & SQL

The scan checks spec compliance, token cost, clarity and security patterns. A clean scan is not a guarantee: static scanners can be evaded. Scan any skill yourself.