Postgres Schema Design
Opinionated PostgreSQL table design reference covering data types, constraints, indexing, and gotchas for schema work.
- CCM score
- 63 of 100
- skills.sh installs
- 252
- GitHub stars
- 34.3K
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers core schema rules, PostgreSQL-specific gotchas, data type selection, table types, row-level security, and constraint design
- Lists preferred and forbidden types, such as
TIMESTAMPTZoverTIMESTAMP,TEXToverCHAR(n)andVARCHAR(n), and identity columns overSERIAL - Flags pitfalls like unindexed foreign keys,
UNIQUEallowing multiple NULLs, and sequence gaps that are expected rather than bugs - Designed for developers writing or reviewing PostgreSQL DDL where type choice, normalization, and indexing decisions need to be checked
Install
$ npx -y skills add davila7/claude-code-templates --skill postgres-schema-design -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/davila7/claude-code-templates
- Category
- Databases
- First seen
- Jun 3, 2026
Questions
What is the postgres-schema-design skill for?
postgres-schema-design is a PostgreSQL table design reference covering data types, indexing, constraints, performance patterns and advanced features. It guides an agent when it designs or reviews Postgres tables, so the schema follows its rules for keys, NULL handling and type choices.
How do I install postgres-schema-design?
Run npx -y skills add davila7/claude-code-templates --skill postgres-schema-design -y in a project to install it. After that, postgres-schema-design gives the agent its Postgres table design rules for that project.
Which data types does postgres-schema-design recommend?
postgres-schema-design prefers BIGINT GENERATED ALWAYS AS IDENTITY for keys, TIMESTAMPTZ for event times, NUMERIC for money and TEXT for strings. It also tells the agent to avoid types such as timestamp without time zone, varchar(n), money and serial.
Does postgres-schema-design need an API key or a database connection?
postgres-schema-design is a reference document that the agent reads while it works, so its own page lists no keys or accounts. The agent still needs a PostgreSQL database of its own to run the schemas it writes.
More from davila7/claude-code-templates
All 398- Reactome Database252
- Scvi Tools250
- Core Components249
- Obsidian Clipper Template Creator247
- PDF Processing247
- Dask246
- Denario246
- Ensembl Database246
- Graphql245
- Iterate Pr245
- Playwright E2e Builder245
- Red Team Tools And Methodology244
- Adaptyv242
- Medchem241
- Personal Tool Builder241
- Zarr Python239
- Pylabrobot238
- Qutip237
- Torchdrug237
- Deployment Procedures236
- Gcp Cloud Run235
- Qiskit235
- Shodan Reconnaissance And Pentesting235
- Cloud Penetration Testing234
Similar to Postgres Schema Design
More Databasespostgresql-table-designwshobson/agents29.8K installsRules-driven PostgreSQL schema guidance covering types, constraints, indexing, partitioning, and gotchas, with a deeper reference file.
design-postgres-tablestimescale/pg-aiguide704 installsOpinionated PostgreSQL table-design reference covering data types, constraints, indexing, JSONB, and partitioning.
postgresql-best-practicesmindrally/skills1.6K installsReference guide of PostgreSQL practices for schema design, indexing, query tuning, and administration.
postgres-best-practicesneondatabase/postgres-skills2.3K installsComprehensive Postgres guidance covering schema design, indexing, query tuning, and replication for PostgreSQL 14 through 18.