Design Postgres Tables
Opinionated PostgreSQL table-design reference covering data types, constraints, indexing, JSONB, and partitioning.
- CCM score
- 62 of 100
- skills.sh installs
- 685
- GitHub stars
- 1.9K
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers data type selection (IDs, numerics, text, time, arrays, ranges, JSONB), constraints, index strategies, and table types
- Lists PostgreSQL gotchas such as unindexed foreign keys, NULL handling in UNIQUE, silent overflow behavior, and MVCC churn
- Includes a "do not use" list that steers away from
timestamp,char(n),serial,money, and built-in geometric types - Designed for schema design and normalization work on reference, OLTP, and update-heavy tables
Install
$ npx -y skills add timescale/pg-aiguide --skill design-postgres-tables -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
PostgreSQL Table Design
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; useUUIDonly 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. Premature denormalization creates maintenance burden.
- Add NOT NULL everywhere it’s 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 integer values, DOUBLE PRECISION for floats (or
NUMERICfor exact decimal arithmetic).
PostgreSQL “Gotchas”
Details
- Repository
- github.com/timescale/pg-aiguide
- Category
- Databases
- License
- Apache-2.0
- First seen
- Jun 3, 2026
Questions
What does the design-postgres-tables skill do?
design-postgres-tables is a reference skill for general PostgreSQL table design, covering data types, indexing strategies, constraints, JSONB patterns, partitioning, and row-level security. It guides an agent when creating new tables or modifying existing ones, and when choosing types, constraints or indexes for PostgreSQL.
How do I install the design-postgres-tables skill?
Run npx -y skills add timescale/pg-aiguide --skill design-postgres-tables -y in your project to install it. Once installed, design-postgres-tables lets the agent apply PostgreSQL table design rules when you create or change schemas.
Which category is design-postgres-tables in, and what sets it apart?
design-postgres-tables sits in the Databases category on Claude Marketplaces, alongside supabase-postgres-best-practices and several Prisma skills. Its own scope is general table design, with rules such as preferring BIGINT identity columns, TIMESTAMPTZ for event time, and indexing foreign key columns manually.
Who is design-postgres-tables for?
design-postgres-tables is for developers who design PostgreSQL tables, schemas or data models, including user tables, order tables, reference tables and JSONB schemas. It also suits teams designing update-heavy, upsert-heavy or OLTP-style tables.
More from timescale/pg-aiguide
All 8Similar to Design Postgres Tables
More Databasespostgresql-table-designwshobson/agents29.5K installsRules-driven PostgreSQL schema guidance covering types, constraints, indexing, partitioning, and gotchas, with a deeper reference file.
postgres-schema-designdavila7/claude-code-templates251 installsOpinionated PostgreSQL table design reference covering data types, constraints, indexing, and gotchas for schema work.
postgresql-best-practicesmindrally/skills1.6K installsReference guide of PostgreSQL practices for schema design, indexing, query tuning, and administration.
postgrestimescale/pg-aiguide1.5K installsComprehensive PostgreSQL skill covering table design, extensions, search, TimescaleDB, and safe migrations through specialized references.
design-postgis-tablestimescale/pg-aiguide396 installsReference guide for designing PostGIS spatial tables, covering geometry types, SRIDs, and spatial indexing for location-based applications.
postgres-patternsaffaan-m/ecc15.2K installsPostgreSQL reference covering index selection, data types, RLS policies, and slow-query diagnosis in one quick-reference sheet.