Agent skill

Postgresql Table Design

by wshobson in wshobson/agents

A skill your agent uses when designing or reviewing a PostgreSQL-specific schema.

MITAuto-check passedDatabases

Install Postgresql Table Design

skills CLI
$ npx skills add wshobson/agents --skill postgresql-table-design -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install wshobson/agents postgresql-table-design --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/wshobson/agents.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/database-design/skills/postgresql-table-design .claude/skills/postgresql-table-design && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
postgresql-table-design
GitHub stars
40k
Token cost
~2k tokens
SKILL.md length
835 words
Files
2 (incl. references)
Skills in repo
142
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when designing or reviewing a PostgreSQL-specific schema.

  • Reviewing a PostgreSQL-specific schema
  • SKILL.md covers When to Use, Core Rules, PostgreSQL Gotchas and Data Types, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Postgresql Table Design is an agent skill from wshobson/agents. Use this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/details.md`).

It sits in Databases. It works with PostgreSQL. The repository describes itself as: Multi-harness agentic plugin marketplace for Claude Code, Codex, Cursor, OpenCode, GitHub Copilot, Google Antigravity, and Pi. The licence is MIT.

When your agent uses it

  • Reviewing a PostgreSQL-specific schema

Example prompts

  • “/postgresql-table-design”

What it can do on your machine

Read from SKILL.md and the folder at commit 46891e7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are sql).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Postgresql Table Design loads about 2k tokens when it runs, and up to ~5k if it reads all its reference files. Until then it costs about 50 tokens; SKILL.md has 835 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~50
When it runs · the whole SKILL.md, loaded when a task matches
~2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from wshobson/agents at commit 46891e7, republished under its MIT licence (© wshobson). 835 words, ~1,977 tokens.

Download SKILL.mdSave it as .claude/skills/postgresql-table-design/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
postgresql-table-design
description
Use this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features

PostgreSQL Table Design

When to Use

  • Designing a new PostgreSQL schema, or reviewing one before it ships.
  • Choosing column types, keys, constraints, or indexes for PostgreSQL specifically.
  • Deciding whether and how to partition a large table, or how to store semi-structured data.
  • Planning a schema change on a live database without downtime.

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.

Core Rules

  • Define a PRIMARY KEY for reference tables (users, orders, etc.). Not always needed for time-series/event/log data. When used, prefer BIGINT GENERATED ALWAYS AS IDENTITY; use UUID only when global uniqueness/opacity is needed.
  • Normalize first (to 3NF) to eliminate data redundancy and update anomalies; denormalize only for measured, high-ROI reads where join performance is proven problematic.
  • Add NOT NULL everywhere it is semantically required; use DEFAULTs for common values.
  • Create indexes for access paths you actually query: PK/unique (auto), FK columns (manual!), frequent filters/sorts, and join keys.
  • Prefer TIMESTAMPTZ for event time; NUMERIC for money; TEXT for strings; BIGINT for integers; DOUBLE PRECISION for floats (or NUMERIC for exact decimal arithmetic).

PostgreSQL Gotchas

  • Identifiers: unquoted → lowercased. Avoid quoted/mixed-case names; use snake_case.
  • Unique + NULLs: UNIQUE allows multiple NULLs. Use UNIQUE NULLS NOT DISTINCT (...) (PG15+) to restrict to one NULL.
  • FK indexes: PostgreSQL does not auto-index FK columns. Add them.
  • No silent coercions: length/precision overflows error out (no truncation). Inserting 999 into NUMERIC(2,0) fails, unlike databases that silently truncate or round.
  • Sequences/identity have gaps (normal; don't "fix"). Rollbacks, crashes, and concurrent transactions leave gaps (1, 2, 5, 6...).
  • Heap storage: no clustered PK by default; CLUSTER is a one-off reorganization, not maintained on later inserts.
  • MVCC: updates/deletes leave dead tuples; vacuum handles them—design to avoid hot wide-row churn.

Data Types

  • IDs: BIGINT GENERATED ALWAYS AS IDENTITY; UUID for distributed or opaque IDs, generated with uuidv7() (PG18+) or gen_random_uuid().
  • Numbers: BIGINT unless storage is critical; DOUBLE PRECISION over REAL; NUMERIC(p,s) for money and exact decimals.
  • Strings: 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.
  • Time: TIMESTAMPTZ, DATE, INTERVAL. now() is transaction start; clock_timestamp() is wall clock.
  • Booleans: BOOLEAN NOT NULL unless tri-state is required.
  • Enums: CREATE TYPE ... AS ENUM only for small, stable sets; evolving business values get TEXT + CHECK or a lookup table.
  • JSONB over JSON, indexed with GIN, for optional/semi-structured attributes only.
  • Arrays, ranges, network, geometric, full-text, domain, composite, and vector types, plus TOAST storage and collation control: see references/details.md.
Types to avoid
AvoidUse instead
timestamp (without time zone)timestamptz
char(n), varchar(n)text (+ CHECK on length if needed)
moneynumeric
timetztimestamptz
timestamptz(0) or any precisiontimestamptz
serialgenerated always as identity
Show full SKILL.md (363 more words)Show less

Constraints

  • PK: implicit UNIQUE + NOT NULL; creates a B-tree index.
  • FK: specify ON DELETE/UPDATE (CASCADE, RESTRICT, SET NULL, SET DEFAULT). Index the referencing column. Use DEFERRABLE INITIALLY DEFERRED for circular dependencies checked at commit.
  • UNIQUE: creates a B-tree index; allows multiple NULLs unless NULLS NOT DISTINCT (PG15+). Prefer NULLS NOT DISTINCT unless duplicate NULLs are wanted.
  • CHECK: row-local; NULL passes (three-valued logic). Combine with NOT NULL: price NUMERIC NOT NULL CHECK (price > 0).
  • EXCLUDE: prevents overlaps with operators, e.g. EXCLUDE USING gist (room_id WITH =, booking_period WITH &&) stops double-booking. Needs a GiST-capable type.

Indexing

  • B-tree: default for equality/range (=, <, >, BETWEEN, ORDER BY).
  • Composite: leftmost-prefix rule (WHERE a = ? AND b > ? uses (a,b); WHERE b = ? does not). Most selective columns first.
  • Covering: CREATE INDEX ON tbl (id) INCLUDE (name, email) for index-only scans.
  • Partial: hot subsets, CREATE INDEX ON tbl (user_id) WHERE status = 'active'.
  • Expression: CREATE INDEX ON tbl (LOWER(email)); the query must use the same expression.
  • GIN: JSONB containment/existence, arrays, full-text search. GiST: ranges, geometry, exclusion constraints.
  • BRIN: large, naturally ordered data (time-series) at minimal storage cost; effective when disk order correlates with the indexed column.

Partitioning

  • Use for large tables (>100M rows) whose queries consistently filter on the partition key, or where maintenance (pruning, bulk replacement) follows a key.
  • RANGE for time-series (PARTITION BY RANGE (created_at); TimescaleDB automates it with retention and compression), LIST for discrete values, HASH for even distribution without a natural key.
  • Constraint exclusion: the planner prunes partitions through their CHECK constraints; declarative partitioning (PG10+) creates them for you.
  • Prefer declarative partitioning or hypertables. Do NOT use table inheritance.
  • Limitations: no global UNIQUE constraints—include the partition key in PK/UNIQUE. FKs from partitioned tables need PG11+, FKs referencing a partitioned table need PG12+; on older versions, use triggers.

Examples

sql
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 INDEX ON users (created_at);
sql
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 NUMERIC(10,2) NOT NULL CHECK (total > 0),
  created_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX ON orders (user_id);
CREATE INDEX ON orders (created_at);
sql
-- 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);

Going deeper

references/details.md holds the material this file only names:

  • The full data-type catalog: TOAST storage, collations, arrays, ranges, network, geometric, text search, domains, composites, vectors.
  • Table types (TEMPORARY, UNLOGGED) and row-level security.
  • Constraint and index notes, and partitioning DDL for RANGE, LIST, and HASH.
  • Workload patterns: update-heavy, insert-heavy, upsert design, safe schema evolution.
  • Generated columns and extensions (pg_trgm, citext, timescaledb, postgis, pgvector, and more).
  • JSONB indexing strategies, including jsonb_path_ops and extracted B-tree columns.

© wshobson, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in plugins/database-design/skills/postgresql-table-design of wshobson/agents.

  • SKILL.md
  • references/details.md

Open the folder on GitHubat commit 46891e7

Compare with similar skills

Postgresql Table Design next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Postgresql Table Design compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Postgresql Table Design this skillwshobson/agents40k—~2kAutomated safety check: PassMIT
Backend Test WorkerCorrectRoadH/OpenTickly306—~1.3kAutomated safety check: PassAGPL-3.0
Ef Core Migrationsjihadkhawaja/Egroo178—~673Automated safety check: PassApache-2.0
Add Oliphaunt Extensionf0rr0/oliphaunt105—~1.4kAutomated safety check: PassMIT
Diagnose Cloud SessionFreakStudioCN/mpy-hardware-extension132—~809Automated safety check: NotesCustom licence
DB AdminEliasOulkadi/shokunin114—~2kAutomated safety check: NotesMIT

Similar skills

  • Backend Test Worker

    CorrectRoadH/OpenTickly

    Build and verify real-Postgres Go tests and thin transport smoke for tracking behavior.

    306 GitHub stars~1.3k tokensUpdated 5 days ago
    DatabasesAuto-check passed
  • Ef Core Migrations

    jihadkhawaja/Egroo

    Handle EF Core schema changes in Egroo. An agent skill from jihadkhawaja/Egroo.

    178 GitHub stars~673 tokensUpdated 6 mo ago
    DatabasesAuto-check passed
  • Add, update, or remove an Oliphaunt PostgreSQL contrib or external extension, including source pins, build recipes, target support, SDK metadata, release products, carrier identities, and package…

    105 GitHub stars~1.4k tokensUpdated today
    DatabasesAuto-check passed
  • Diagnose Cloud Session

    FreakStudioCN/mpy-hardware-extension

    用户报告 Blockless 扩展在云端实测时出问题(卡死/灰屏/跳步/构建失败),但本地复现不了、日志不在本地文件里时,用这个从云端托管数据库拉真实 session 定位症状与根因 / Use when a user reports an in-product Blockless bug from live cloud-backend testing and the real session…

    132 GitHub stars~809 tokensUpdated 9 days ago
    DatabasesAuto-check: notes
  • DB Admin

    EliasOulkadi/shokunin

    PostgreSQL database administration — backup/restore (pgdump, PITR, WAL archiving), health monitoring (connections, bloat, cache hit ratio, dead tuples), connection pooling (PgBouncer), replication…

    114 GitHub stars~2k tokensUpdated 3 days ago
    DatabasesAuto-check: notes
  • Postgresql Table Design

    ynulihao/AgentSkillOS

    Design a PostgreSQL-specific schema. An agent skill from ynulihao/AgentSkillOS.

    617 GitHub starsUsed in 15 repos~4k tokens
    DatabasesAuto-check passed

More from wshobson/agents

All 142 skills in this repo
  • Billing Automation

    wshobson/agents

    Covers building subscription billing: billing cycles, subscription states, invoice generation, proration, tax handling and dunning for failed payments.

    40k GitHub starsUsed in 14 repos~473 tokens
    Auto-check passed
  • Cuts cloud spend across AWS, Azure, GCP and OCI with cost tagging, rightsizing, commitment and spot pricing models, and architecture changes.

    40k GitHub starsUsed in 14 repos~1.7k tokens
    Auto-check passed
  • Profiles slow Python code with cProfile and memory profilers, then applies targeted fixes for CPU, memory, I/O and query bottlenecks.

    40k GitHub starsUsed in 13 repos~814 tokens
    Auto-check passed
  • Portfolio Risk Metrics

    wshobson/agents

    Covers portfolio risk measurement with VaR, CVaR, Sharpe, Sortino and drawdown, plus guidance on limits, stress tests and tail risk.

    40k GitHub starsUsed in 13 repos~502 tokens
    Auto-check passed
  • Writes unit tests for shell scripts with Bats: error-condition tests, fixtures and mocks, cross-shell checks, parallel runs, helper files and CI integration.

    40k GitHub starsUsed in 12 repos~1.3k tokens
    Auto-check passed
  • Plans memory headroom, works through out-of-memory failures and watches temperature and power during long ML training jobs on NVIDIA DGX Spark.

    40k GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed

Works with

Categories

Questions about Postgresql Table Design

What does Postgresql Table Design do?

A skill your agent uses when designing or reviewing a PostgreSQL-specific schema. Postgresql Table Design is an agent skill from wshobson/agents. Use this skill when designing or reviewing a PostgreSQL-specific schema.

When should I use Postgresql Table Design?

Postgresql Table Design fits situations like: reviewing a PostgreSQL-specific schema.

How do I install Postgresql Table Design in Claude Code?

Run `npx skills add wshobson/agents --skill postgresql-table-design -a claude-code`. Or copy the skill folder (plugins/database-design/skills/postgresql-table-design in wshobson/agents) into .claude/skills/postgresql-table-design in your project. Claude Code loads it when a task matches its description.

How do I install Postgresql Table Design in Codex?

Run `npx skills add wshobson/agents --skill postgresql-table-design -a codex`. Or copy the skill folder (plugins/database-design/skills/postgresql-table-design in wshobson/agents) into .agents/skills/postgresql-table-design in your project. Codex loads it when a task matches its description.

Can I use Postgresql Table Design in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add wshobson/agents --skill postgresql-table-design -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/postgresql-table-design, .gemini/skills/postgresql-table-design, .github/skills/postgresql-table-design and .opencode/skills/postgresql-table-design in your project.

What does Postgresql Table Design need to run?

SKILL.md names no scripts, command-line tools or credentials: Postgresql Table Design is instructions for the agent only.

Does Postgresql Table Design access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Postgresql Table Design safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Postgresql Table Design use?

Postgresql Table Design is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Postgresql Table Design use?

About 2k tokens (SKILL.md is roughly 7.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3k tokens, read only when the agent opens those files.

What are the alternatives to Postgresql Table Design?

Skills that share tags, products or a category with Postgresql Table Design: Backend Test Worker (CorrectRoadH/OpenTickly, 306 stars), Ef Core Migrations (jihadkhawaja/Egroo, 178 stars), Add Oliphaunt Extension (f0rr0/oliphaunt, 105 stars) and Diagnose Cloud Session (FreakStudioCN/mpy-hardware-extension, 132 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Postgresql Table Design?

wshobson (a GitHub user) maintains it in wshobson/agents, which has 40,287 GitHub stars. The repository holds 142 skills in this directory. The repository was last updated on October 5, 2026.

Source: wshobson/agents on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.