Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

postgres-schema-design

Skill by davila7

Provides a PostgreSQL table design reference covering data types, indexing, constraints, partitioning and performance patterns. Built for developers who design or review PostgreSQL schemas.

  • Score 94
  • 34k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

Install postgres-schema-design

Built from the published package, never by AI.

git clone --depth 1 https://github.com/davila7/claude-code-templates /tmp/claude-code-templates && mkdir -p ~/.claude/skills && cp -r /tmp/claude-code-templates/cli-tool/components/skills/database/postgres-schema-design ~/.claude/skills/postgres-schema-design

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install postgres-schema-design in Claude Code

Skills can run scripts on your machine. Some need an API key: check the README.

About

postgres-schema-design is an agent skill that gives a PostgreSQL-specific reference for table design. It sets core rules for primary keys, normalization, NOT NULL and defaults, and indexing. It also lists PostgreSQL gotchas and recommended data types, and names types to avoid, such as timestamp without time zone, char(n), varchar(n), money and serial.

The rest of the skill covers constraints, index types (B-tree, GIN, GiST and BRIN), partitioning, row-level security, and guidance for update-heavy and insert-heavy tables. It also covers upsert design and safe schema evolution. It is aimed at developers and AI assistants that design or review PostgreSQL table schemas.

Written from the project's SKILL.md and checked against it.

What it can do

  • Core table design rulesCovers primary keys, normalization to 3NF, NOT NULL and defaults, and indexing access paths.
  • Data type guidanceRecommends preferred PostgreSQL types and lists types to avoid, such as timestamp and serial.
  • ConstraintsExplains PRIMARY KEY, FOREIGN KEY, UNIQUE with NULLS NOT DISTINCT, CHECK and EXCLUDE constraints.
  • Index selectionDescribes B-tree, composite, covering, partial, expression, GIN, GiST and BRIN indexes.
  • PartitioningExplains RANGE, LIST and HASH partitioning and when partitioning is worth using.
  • Row-level securityShows how to enable row-level security and create row-level access policies.
  • Update-heavy table tuningAdvises on fillfactor, separating hot and cold columns, and HOT updates.
  • Insert-heavy workload adviceSuggests COPY or multi-row INSERT, UNLOGGED staging tables and deferred index creation.
  • Upsert designExplains ON CONFLICT unique index requirements and use of EXCLUDED values.
  • Safe schema evolutionCovers transactional DDL and CREATE INDEX CONCURRENTLY for schema changes.

What you need

  • A PostgreSQL database
  • PostgreSQL 15 or later for NULLS NOT DISTINCT
  • PostgreSQL 18 or later for uuidv7()
  • pgvector for the vector type

Try asking

  • Review this PostgreSQL schema and suggest better data types and constraints.
  • Which index type should I use for a JSONB column and a tags array?
  • Design a PostgreSQL logs table partitioned by created_at with monthly partitions.

Good to know

  • This is reference guidance, not an executable tool.
  • Partitioned tables have no global UNIQUE constraints, and foreign keys from partitioned tables are not supported.
  • Some features depend on PostgreSQL version, such as NULLS NOT DISTINCT (PG15+) and uuidv7() (PG18+).
  • The source ends mid-sentence in the concurrent index creation section.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: cli-tool/components/skills/database/postgres-schema-design/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work

Inside the skill

  • LICENSE.txt11 KB
  • SKILL.md16 KB

Alternatives to postgres-schema-design

All alternatives →
hugging-face-datasetssickn33
94

Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.

AAA Skill 50k
db-repairgarrytan
94

Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.

AAA Skill 34k
alloydb-basicsgoogle
94

Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.

AAA Skill 26k
clickhouse-logs-queriessupabase
94

Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.

AAA Skill 116k
fix-slow-queriespaperclipai
94

Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.

AAA Skill 119k
prisma-8prisma
94

Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.

AAA Skill 48k

Compare with hugging-face-datasets, db-repair or alloydb-basics

postgres-schema-design: common questions

Does this skill recommend TIMESTAMPTZ over TIMESTAMP?

Yes. The source says to avoid timestamp without time zone and to use timestamptz for timestamps.

Does PostgreSQL index foreign key columns automatically?

No. The source says PostgreSQL does not auto-index FK columns, so they must be indexed manually.

When should a PostgreSQL table be partitioned?

The source suggests partitioning very large tables, above 100M rows, where queries filter on the partition key. It also mentions partitioning for periodic data maintenance.

How do I install postgres-schema-design?

Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.

Is postgres-schema-design free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is postgres-schema-design safe to use?

It scores 94 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to postgres-schema-design?

Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.

postgres-schema-design Install

Add to stack

Loading.