API Scaffolding
Avoid AI Writing
Before You Build
Block No Verify
Brand Landingpage
Business Analytics
Database Design
Documentation Generation
Documentation Standards
File Conversion
Framework Migration
Frontend Mobile Development
Game Development
Hermes Tweet
Hr Legal Compliance
Incident Response
Kubernetes Operations
Machine Learning Ops
NET Contribution
Observability Monitoring
Payment Processing
Plugin Eval
Protect MCP
Python Development · Python…
Quantitative Trading
Review Agent Governance
Ship Mate
Signed Audit Trails
Skill Forge Essentials
Social Publishing
Superself
Systems Programming
183 skills · 335 min
Database Design
Skill 48 of 183
Use this skill when designing or reviewing a PostgreSQL-specific schema.
3 minutes · 739 words · 10 sections
Install
npx skills add wshobson/agents --skill postgresql-table-designnpx skills add wshobson/agents/plugin marketplace add wshobson/agentsThe first command installs just this skill, by the name in its SKILL.md; the second installs the whole repository.
The rules and decision points for a PostgreSQL schema. The full data-type catalog, workload
patterns (update-heavy, insert-heavy, upsert, schema evolution), extensions, JSONB indexing,
and worked DDL examples are in references/details.md; open it when a section below points there.
BIGINT GENERATED ALWAYS AS IDENTITY; use UUID only when global uniqueness/opacity is needed.NUMERIC for exact decimal arithmetic).snake_case.UNIQUE NULLS NOT DISTINCT (...) (PG15+) to restrict to one NULL.NUMERIC(2,0) fails, unlike databases that silently truncate or round.CLUSTER is a one-off reorganization, not maintained on later inserts.BIGINT GENERATED ALWAYS AS IDENTITY; UUID for distributed or opaque IDs, generated with uuidv7() (PG18+) or gen_random_uuid().BIGINT unless storage is critical; DOUBLE PRECISION over REAL; NUMERIC(p,s) for money and exact decimals.TEXT, with CHECK (LENGTH(col) <= n) when a limit is needed; BYTEA for binary. Case-insensitive lookups: expression index on LOWER(col), or CITEXT when a constraint must be case-insensitive.TIMESTAMPTZ, DATE, INTERVAL. now() is transaction start; clock_timestamp() is wall clock.BOOLEAN NOT NULL unless tri-state is required.CREATE TYPE ... AS ENUM only for small, stable sets; evolving business values get TEXT + CHECK or a lookup table.references/details.md.| Avoid | Use instead |
|---|---|
timestamp (without time zone) | timestamptz |
char(n), varchar(n) | text (+ CHECK on length if needed) |
money | numeric |
timetz | timestamptz |
timestamptz(0) or any precision | timestamptz |
serial | generated always as identity |
ON DELETE/UPDATE (CASCADE, RESTRICT, SET NULL, SET DEFAULT). Index the referencing column. Use DEFERRABLE INITIALLY DEFERRED for circular dependencies checked at commit.NULLS NOT DISTINCT (PG15+). Prefer NULLS NOT DISTINCT unless duplicate NULLs are wanted.NOT NULL: price NUMERIC NOT NULL CHECK (price > 0).EXCLUDE USING gist (room_id WITH =, booking_period WITH &&) stops double-booking. Needs a GiST-capable type.=, <, >, BETWEEN, ORDER BY).WHERE a = ? AND b > ? uses (a,b); WHERE b = ? does not). Most selective columns first.CREATE INDEX ON tbl (id) INCLUDE (name, email) for index-only scans.CREATE INDEX ON tbl (user_id) WHERE status = 'active'.CREATE INDEX ON tbl (LOWER(email)); the query must use the same expression.PARTITION BY RANGE (created_at); TimescaleDB automates it with retention and compression), LIST for discrete values, HASH for even distribution without a natural key.CHECK constraints; declarative partitioning (PG10+) creates them for you.CREATE TABLE users (
user_id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
email TEXT NOT NULL UNIQUE,
name TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE UNIQUE INDEX ON users (LOWER(email));
CREATE TABLE orders (
order_id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
user_id BIGINT NOT NULL REFERENCES users(user_id),
status TEXT NOT NULL DEFAULT 'PENDING' CHECK (status IN ('PENDING','PAID','CANCELED')),
total
-- JSONB attributes with a generated, indexable scalar
CREATE TABLE profiles (
user_id BIGINT PRIMARY KEY REFERENCES users(user_id),
attrs JSONB NOT NULL DEFAULT '{}',
theme TEXT GENERATED ALWAYS AS (attrs->>'theme') STORED
);
CREATE INDEX profiles_attrs_gin ON profiles USING GIN (attrs);references/details.md holds the material this file only names:
TEMPORARY, UNLOGGED) and row-level security.pg_trgm, citext, timescaledb, postgis, pgvector, and more).jsonb_path_ops and extracted B-tree columns.Use this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features
The verbatim description from this skill’s front matter — the string an agent matches on to decide whether to load it.
main, last pushed 21 September 2026.SKILL.md, not by matching a directory convention. 51 distinct layouts observed: plugins/accessibility-compliance/skills/*/SKILL.md, plugins/agent-teams/skills/*/SKILL.md, plugins/api-scaffolding/skills/*/SKILL.md, plugins/avoid-ai-writing/skills/*/SKILL.md, plugins/backend-development/skills/*/SKILL.md, plugins/before-you-build/skills/*/SKILL.md, plugins/block-no-verify/skills/*/SKILL.md, plugins/blockchain-web3/skills/*/SKILL.md, plugins/brand-landingpage/skills/*/SKILL.md, plugins/business-analytics/skills/*/SKILL.md, plugins/cicd-automation/skills/*/SKILL.md, plugins/cloud-infrastructure/skills/*/SKILL.md, plugins/conductor/skills/*/SKILL.md, plugins/data-engineering/skills/*/SKILL.md, plugins/database-design/skills/*/SKILL.md, plugins/developer-essentials/skills/*/SKILL.md, plugins/dgx-spark-ops/skills/*/SKILL.md.plugins/documentation-generation/skills/*/SKILL.mdplugins/documentation-standards/skills/*/SKILL.mdplugins/dotnet-contribution/skills/*/SKILL.mdplugins/file-conversion/skills/*/SKILL.mdplugins/framework-migration/skills/*/SKILL.mdplugins/frontend-mobile-development/skills/*/SKILL.mdplugins/game-development/skills/*/SKILL.mdplugins/hermes-tweet/skills/*/SKILL.mdplugins/hr-legal-compliance/skills/*/SKILL.mdplugins/incident-response/skills/*/SKILL.mdplugins/javascript-typescript/skills/*/SKILL.mdplugins/kubernetes-operations/skills/*/SKILL.mdplugins/llm-application-dev/skills/*/SKILL.mdplugins/llm-finetuning/skills/*/SKILL.mdplugins/machine-learning-ops/skills/*/SKILL.mdplugins/observability-monitoring/skills/*/SKILL.mdplugins/payment-processing/skills/*/SKILL.mdplugins/plugin-eval/skills/*/SKILL.mdplugins/pptx-deck-creation/skills/*/SKILL.mdplugins/protect-mcp/skills/*/SKILL.mdplugins/python-development/skills/*/SKILL.mdplugins/quantitative-trading/skills/*/SKILL.mdplugins/reverse-engineering/skills/*/SKILL.mdplugins/review-agent-governance/skills/*/SKILL.mdplugins/security-scanning/skills/*/SKILL.mdplugins/shell-scripting/skills/*/SKILL.mdplugins/ship-mate/skills/*/SKILL.mdplugins/signed-audit-trails/skills/*/SKILL.mdplugins/skill-forge-essentials/skills/*/SKILL.mdplugins/social-publishing/skills/*/SKILL.mdplugins/startup-business-analyst/skills/*/SKILL.mdplugins/superself/skills/*/SKILL.mdplugins/systems-programming/skills/*/SKILL.mdplugins/ui-design/skills/*/SKILL.mdh1 and no skipped levels:.claude-plugin/marketplace.json by Seth Hobson, declaring 94 plugins. It is read for editorial metadata only — never as the skill index, which is always the repository tree./wshobson/agents.md, and each skill at its own .md URL.1 file · 12 KB
Everything this skill ships beside its prose. All of it is set here, as a subchapter of skill 48.
Documentation the agent loads on demand, rather than up front.