Agent skill

Designing Database Schemas

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Process use when you need to work with database schema design.

MITAuto-check passedDatabases

Install Designing Database Schemas

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill designing-database-schemas -a claude-code

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

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace designing-database-schemas --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/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/designing-database-schemas .claude/skills/designing-database-schemas && 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
designing-database-schemas
GitHub stars
2.8k
Token cost
~2k tokens
SKILL.md length
901 words
Files
4 (incl. scripts, references, assets)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Process use when you need to work with database schema design.

  • Works in 10 steps: Identify all entities (nouns) from the… → Define primary keys for each table.… → Normalize the schema to Third Normal… → …
  • You need to work with database schema design
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 3 more sections
  • With phrases like design schema

What it does

Designing Database Schemas is an agent skill from jeremylongshore/tons-of-skills-marketplace. Process use when you need to work with database schema design. This skill provides schema design and migrations with comprehensive guidance and automation. Trigger with phrases like "design schema", "create migration", or "model database".

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including scripts, reference files and assets (for example `assets/README.md`, `references/README.md` and `scripts/README.md`). Compatibility notes: Designed for Claude Code

It sits in Databases, covering Database schema design. It works with PostgreSQL and MySQL. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • You need to work with database schema design
  • With phrases like design schema
  • Create migration

Example prompts

  • “design schema”
  • “create migration”
  • “model database”
  • “/designing-database-schemas”

Requirements

  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*)

Workflow steps

10 steps, taken from the first numbered list in SKILL.md.

  1. Identify all entities (nouns) from the business requirements. Each entity becomes a table. List every attribute (property) of each entity…
  2. Define primary keys for each table. Prefer BIGSERIAL (PostgreSQL) or BIGINT AUTO_INCREMENT (MySQL) for surrogate keys. Use UUID (via…
  3. Normalize the schema to Third Normal Form (3NF)
  4. Define relationships between tables
  5. Choose appropriate data types with precision
  6. Add standard columns to every table
  7. Define constraints: NOT NULL on required fields, UNIQUE on natural keys and email addresses, CHECK constraints for value validation (CHECK…
  8. Design indexes based on expected query patterns
  9. Apply strategic denormalization where 3NF causes unacceptable query complexity
  10. Generate the complete DDL script with CREATE TABLE statements in dependency order (referenced tables first), followed by indexes…

What it can do on your machine

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

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep
    • Glob
    • Bash(psql:*)
    • Bash(mysql:*)
    • Bash(mongosh:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/, which the agent can run.

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

  • Network

    Links to these hosts (documentation or services it may open):

    • postgresql.org
    • en.wikipedia.org
    • use-the-index-luke.com

    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.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Designing Database Schemas loads about 2k tokens when it runs, and up to ~2k if it reads all its reference files. Until then it costs about 67 tokens; SKILL.md has 901 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~67
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
~2k

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); the scripts in this folder are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 901 words, ~1,990 tokens.

Download SKILL.mdSave it as .claude/skills/designing-database-schemas/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
designing-database-schemas
description
Process use when you need to work with database schema design. This skill provides schema design and migrations with comprehensive guidance and automation. Trigger with phrases like "design schema", "create migration", or "model database".
allowed-tools
Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*)
compatibility
Designed for Claude Code
version
1.24.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
tags
database, migration, designing-database

Database Schema Designer

Overview

Design normalized relational database schemas from business requirements, entity-relationship diagrams, or existing application code. This skill produces PostgreSQL or MySQL DDL with proper data types, constraints, indexes, and relationships following normalization principles (3NF by default) with strategic denormalization where performance requires it.

Prerequisites

  • Business domain requirements or existing application models/classes to derive schema from
  • psql or mysql CLI for testing schema DDL
  • Target database engine and version (determines available data types and features)
  • Expected data volumes and query patterns for sizing and index decisions
  • Multi-tenancy requirements (shared schema, schema-per-tenant, or database-per-tenant)

Instructions

  1. Identify all entities (nouns) from the business requirements. Each entity becomes a table. List every attribute (property) of each entity and classify as required or optional.

  2. Define primary keys for each table. Prefer BIGSERIAL (PostgreSQL) or BIGINT AUTO_INCREMENT (MySQL) for surrogate keys. Use UUID (via gen_random_uuid()) for distributed systems or when IDs are exposed in URLs. Natural keys are acceptable when truly immutable and unique (ISO country codes, IATA airport codes).

  3. Normalize the schema to Third Normal Form (3NF):

    • 1NF: Eliminate repeating groups. Each column holds a single atomic value. No arrays in columns (unless using PostgreSQL array types intentionally).
    • 2NF: Remove partial dependencies. Every non-key column depends on the entire primary key.
    • 3NF: Remove transitive dependencies. Non-key columns depend only on the primary key, not on other non-key columns. Extract lookup tables for values that change independently.
  4. Define relationships between tables:

    • One-to-many: Add a foreign key column on the "many" side referencing the "one" side. Example: orders.customer_id REFERENCES customers(id).
    • Many-to-many: Create a junction table with two foreign keys. Example: product_categories(product_id, category_id) with a composite primary key.
    • One-to-one: Add a foreign key with a UNIQUE constraint, or merge into a single table if entities are always accessed together.
  5. Choose appropriate data types with precision:

    • Money: NUMERIC(12,2) or INTEGER storing cents (never FLOAT/DOUBLE)
    • Timestamps: TIMESTAMPTZ (PostgreSQL) with time zone for events; DATE for calendar dates
    • Status fields: VARCHAR(20) with CHECK constraint, or create an ENUM type
    • Email: CITEXT (PostgreSQL) or VARCHAR(254) with CHECK constraint for format validation
    • JSON: JSONB (PostgreSQL) for flexible schema attributes; avoid for core relational data
  6. Add standard columns to every table:

    • created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
    • updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() (with trigger for auto-update)
    • deleted_at TIMESTAMPTZ for soft delete (add partial index WHERE deleted_at IS NULL)
  7. Define constraints: NOT NULL on required fields, UNIQUE on natural keys and email addresses, CHECK constraints for value validation (CHECK (price >= 0), CHECK (status IN ('active', 'inactive'))), and foreign keys with appropriate ON DELETE behavior (CASCADE, SET NULL, or RESTRICT).

  8. Design indexes based on expected query patterns:

    • Primary key index is automatic
    • Foreign key columns: always index these for JOIN performance
    • Columns in WHERE clauses with high selectivity: B-tree index
    • Full-text search columns: GIN index on tsvector
    • Composite indexes: match the most common multi-column filter patterns, leftmost column first
  9. Apply strategic denormalization where 3NF causes unacceptable query complexity:

    • Materialized views for expensive aggregate queries
    • Denormalized counter columns (with trigger-based updates) for counts displayed on every page load
    • JSON columns for flexible metadata that varies by record type
  10. Generate the complete DDL script with CREATE TABLE statements in dependency order (referenced tables first), followed by indexes, triggers, and any seed data for lookup tables.

Show full SKILL.md (350 more words)Show less

Output

  • Complete DDL script with CREATE TABLE, constraints, indexes, and triggers in executable order
  • Entity-relationship description listing all tables, columns, types, and relationships
  • Index strategy document explaining which indexes support which query patterns
  • Seed data scripts for lookup/reference tables (countries, statuses, categories)
  • Migration file compatible with the project's migration framework

Error Handling

ErrorCauseSolution
Circular foreign key dependencyTables reference each other, preventing creation in any orderUse ALTER TABLE ADD CONSTRAINT after both tables are created; or redesign to eliminate the cycle with a junction table
Over-normalization causing excessive JOINsEvery lookup value in its own table, queries require 8+ JOINsDenormalize low-cardinality, rarely-changing lookup values; use ENUM types for status fields instead of separate tables
NUMERIC precision overflowMonetary values exceed NUMERIC(10,2) maximumIncrease precision to NUMERIC(15,2) or NUMERIC(19,4) for currencies requiring sub-cent precision
Schema too rigid for evolving requirementsFrequent ALTER TABLE needed as business rules changeUse JSONB columns for flexible attributes; implement the EAV (Entity-Attribute-Value) pattern for truly dynamic schemas; plan for schema evolution from the start
Missing index on foreign key columnJOINs on foreign key columns cause sequential scansAlways create indexes on foreign key columns; PostgreSQL does not auto-index foreign keys (unlike MySQL InnoDB)

Examples

E-commerce schema design: Tables: customers, addresses (one-to-many from customers), products, categories (many-to-many via product_categories), orders, order_items (one-to-many from orders), payments. Money stored as NUMERIC(12,2). Soft delete on customers and products. GIN index on products.search_vector for full-text search. Composite index (customer_id, created_at DESC) on orders for order history pages.

Multi-tenant SaaS schema with row-level security: Every table includes tenant_id BIGINT NOT NULL with a foreign key to tenants. Row-level security policies enforce tenant isolation: CREATE POLICY tenant_isolation ON orders USING (tenant_id = current_setting('app.tenant_id')::bigint). Composite indexes start with tenant_id for partition-like query performance.

Event sourcing schema: An events table with (aggregate_id, sequence_number) as composite primary key, event_type VARCHAR(100), payload JSONB, created_at TIMESTAMPTZ. A snapshots table stores materialized state at periodic intervals. Append-only design with no UPDATE or DELETE operations.

Resources

© jeremylongshore, 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 3 other files (scripts, references, assets) in skills/.curated/designing-database-schemas of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • assets/README.md
  • references/README.md
  • scripts/README.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Designing Database Schemas 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.

Designing Database Schemas compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Designing Database Schemas this skilljeremylongshore/tons-of-skills-marketplace2.8k—~2kAutomated safety check: PassMIT
Database DesignMoizIbnYousaf/ai-agent-skills1.1k1 repos~1.2kAutomated safety check: PassMIT
Golang Databaseunxed/f42442 repos~2.9kAutomated safety check: PassMIT
Database Expertcin12211/orca-q224—~2.8kAutomated safety check: PassMIT
DB Migrationhiromaily/go-crypto-wallet128—~652Automated safety check: PassMIT
Expert DatabaseReJeCtAll/ExpertTeam-Codex113—~692Automated safety check: PassMIT

Similar skills

  • Database Design

    MoizIbnYousaf/ai-agent-skills

    Database schema design, optimization, and migration patterns for PostgreSQL, MySQL, and NoSQL databases.

    1.1k GitHub starsUsed in 1 repo~1.2k tokens
    DatabasesAuto-check passed
  • Comprehensive guide for Go database access — parameterized queries, struct scanning, NULLable columns, transactions, isolation levels, SELECT FOR UPDATE, connection pool, batch processing, context…

    244 GitHub starsUsed in 2 repos~2.9k tokens
    DatabasesAuto-check passed
  • Database Expert

    cin12211/orca-q

    Database performance optimization, schema design, query analysis, and connection management across PostgreSQL, MySQL, MongoDB, and SQLite with ORM integration.

    224 GitHub stars~2.8k tokensUpdated 19 days ago
    DatabasesAuto-check passed
  • DB Migration

    hiromaily/go-crypto-wallet

    Database schema and migration workflow. An agent skill from hiromaily/go-crypto-wallet.

    128 GitHub stars~652 tokensUpdated 5 mo ago
    DatabasesAuto-check passed
  • Expert Database

    ReJeCtAll/ExpertTeam-Codex

    数据库优化专家入口。用于 Codex CLI 的 $expert-database 调用. An agent skill from ReJeCtAll/ExpertTeam-Codex.

    113 GitHub stars~692 tokensUpdated 3 mo ago
    DatabasesAuto-check passed
  • SQL Pro

    Jeffallan/claude-skills

    Optimizes SQL queries and designs schemas using CTEs, window functions, covering indexes and EXPLAIN ANALYZE, with notes on dialect differences between major databases.

    12k GitHub stars~1.3k tokensUpdated 7 days ago
    DatabasesAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Designing Database Schemas

What does Designing Database Schemas do?

Process use when you need to work with database schema design. Designing Database Schemas is an agent skill from jeremylongshore/tons-of-skills-marketplace. Process use when you need to work with database schema design.

When should I use Designing Database Schemas?

Designing Database Schemas fits situations like: you need to work with database schema design; with phrases like design schema; create migration.

How do I install Designing Database Schemas in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill designing-database-schemas -a claude-code`. Or copy the skill folder (skills/.curated/designing-database-schemas in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/designing-database-schemas in your project. Claude Code loads it when a task matches its description.

How do I install Designing Database Schemas in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill designing-database-schemas -a codex`. Or copy the skill folder (skills/.curated/designing-database-schemas in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/designing-database-schemas in your project. Codex loads it when a task matches its description.

Can I use Designing Database Schemas 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 jeremylongshore/tons-of-skills-marketplace --skill designing-database-schemas -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/designing-database-schemas, .gemini/skills/designing-database-schemas, .github/skills/designing-database-schemas and .opencode/skills/designing-database-schemas in your project.

What does Designing Database Schemas need to run?

SKILL.md names no scripts, command-line tools or credentials: Designing Database Schemas is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Write, Edit, Grep, Glob, Bash(psql:*), Bash(mysql:*), Bash(mongosh:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Designing Database Schemas access the network?

SKILL.md names 3 domains. As links in the text: postgresql.org, en.wikipedia.org and use-the-index-luke.com. This is read from the text; nothing was executed.

Is Designing Database Schemas 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. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Designing Database Schemas use?

Designing Database Schemas is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Designing Database Schemas use?

About 2k tokens (SKILL.md is roughly 8k 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 17 tokens, read only when the agent opens those files.

What are the alternatives to Designing Database Schemas?

Skills that share tags, products or a category with Designing Database Schemas: Database Design (MoizIbnYousaf/ai-agent-skills, 1.1k stars), Golang Database (unxed/f4, 244 stars), Database Expert (cin12211/orca-q, 224 stars) and DB Migration (hiromaily/go-crypto-wallet, 128 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Designing Database Schemas?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.