Claude Skill MartBrowse skillsQuick linesLearn by videoTerminal guideWhat is a Skill?
Back to list

PostgreSQL Table Design Guide

A reference skill that enforces PostgreSQL best practices for schema, data types, indexes, constraints, and partitioning.

Dev & CodingIntermediate1,814104AI score 9/10Last updated: Jun 26, 2026

What it does

  • Enforces data type rules when creating or altering tables: TEXT over VARCHAR(n), TIMESTAMPTZ over TIMESTAMP, NUMERIC for money, BIGINT GENERATED ALWAYS AS IDENTITY instead of serial.
  • Guides index strategy (B-tree, GIN, GiST, BRIN, partial, expression, covering) and constraints (PK, FK with explicit index, UNIQUE NULLS NOT DISTINCT, CHECK, EXCLUDE).
  • Flags PostgreSQL-specific gotchas: FK columns are not auto-indexed, sequence gaps are normal, MVCC dead tuples, identifier lowercasing, heap (non-clustered) storage.
  • Covers workload-specific design (update-heavy, insert-heavy, upsert), declarative partitioning, safe schema evolution/DDL, JSONB indexing patterns, and useful extensions (pg_trgm, pgvector, PostGIS, TimescaleDB).

Who it's for

  • Backend and data engineers working on PostgreSQL schemas and migrations
  • Teams standardizing schema reviews or ORM migration output
  • Anyone designing time-series/log tables that need partitioning and index tuning

Examples

  1. "Design users and orders tables" → DDL with IDENTITY PK, status CHECK constraint, and explicit FK indexes.
  2. "My JSONB query is slow" → advice on GIN jsonb_path_ops vs. a generated column with a B-tree index.
  3. "How should I shard a 100M-row log table?" → RANGE partitioning by time, BRIN index, retention strategy.

· · · Install guide · · ·

Try it now, no install

Paste this into Claude to use the skill without installing anything.

Read the instructions in this file and follow them to help me:
https://raw.githubusercontent.com/timescale/pg-aiguide/HEAD/skills/design-postgres-tables/SKILL.md

What I want: (describe your task here)

If Claude can't open the link, open it yourself and paste the contents instead.

If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.

Install in the Claude app (no terminal)
  1. Download the ZIP with the button below.
  2. In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
  3. Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Download ZIP
Install in Claude Code

Let Claude do it — paste this into Claude Code

Install the skill I found on Claude Skill Mart.
Copy the skills/design-postgres-tables folder from the GitHub repo timescale/pg-aiguide into my ~/.claude/skills/design-postgres-tables/.
When it's done, tell me in one line what this skill can do.

Install with a command instead

git clone https://github.com/timescale/pg-aiguide.git /tmp/pg-aiguide && mkdir -p ~/.claude/skills && cp -r /tmp/pg-aiguide/skills/design-postgres-tables ~/.claude/skills/

This is a third-party skill. Check the source repository before installing.

  1. Open a terminal.
  2. Create the skills directory: mkdir -p ~/.claude/skills
  3. Clone the repo: git clone https://github.com/timescale/pg-aiguide.git /tmp/pg-aiguide
  4. Copy just this skill: cp -r /tmp/pg-aiguide/skills/design-postgres-tables ~/.claude/skills/
  5. Restart Claude Code and ask something like "design PostgreSQL tables for an orders system" to trigger it.
  6. (Optional) For project-only use, copy the folder into .claude/skills/ inside your repository instead.
View source on GitHubLicense: Apache-2.0