database-schema-designer

davila7/claude-code-templates · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/davila7/claude-code-templates --skill database-schema-designer
0 commentsdiscussion
summary

Design production-ready database schemas with best practices built-in.

skill.md

Database Schema Designer

Design production-ready database schemas with best practices built-in.


Quick Start

Just describe your data model:

design a schema for an e-commerce platform with users, products, orders

You'll get a complete SQL schema like:

CREATE TABLE users (
  id BIGINT AUTO_INCREMENT PRIMARY KEY,
  email VARCHAR(255) UNIQUE NOT NULL,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE orders (
  id BIGINT AUTO_INCREMENT PRIMARY KEY,
  user_id BIGINT NOT NULL REFERENCES users(id),
  total DECIMAL(10,2) NOT NULL,
  INDEX idx_orders_user (user_id)
);

What to include in your request:

  • Entities (users, products, orders)
  • Key relationships (users have orders, orders have items)
  • Scale hints (high-traffic, millions of records)
  • Database preference (SQL/NoSQL) - defaults to SQL if not specified

Triggers

Trigger Example
design schema "design a schema for user authentication"
database design "database design for multi-tenant SaaS"
create tables "create tables for a blog system"
schema for "schema for inventory management"
model data "model data for real-time analytics"
I need a database "I need a database for tracking orders"
design NoSQL "design NoSQL schema for product catalog"

Key Terms

Term Definition
Normalization Organizing data to reduce redundancy (1NF → 2NF → 3NF)
3NF Third Normal Form - no transitive dependencies between columns
OLTP Online Transaction Processing - write-heavy, needs normalization
OLAP Online Analytical Processing - read-heavy, benefits from denormalization
Foreign Key (FK) Column that references another table's primary key
Index Data structure that speeds up queries (at cost of slower writes)
Access Pattern How your app reads/writes data (queries, joins, filters)
Denormalization Intentionally duplicating data to speed up reads

Quick Reference

Task Approach Key Consideration
New schema Normalize to 3NF first Domain modeling over UI
SQL vs NoSQL Access patterns decide Read/write ratio matters
Primary keys INT or UUID UUID for distributed systems
Foreign keys Always constrain ON DELETE strategy critical
Indexes FKs + WHERE columns Column order matters
Migrations Always reversible Backward compatible first

Process Overview

Your Data Requirements
    |
    v
+-----------------------------------------------------+
| Phase 1: ANALYSIS                                   |
| * Identify entities and relationships               |
| * Determine access patterns (read vs write heavy)   |
| * Choose SQL or NoSQL based on requirements         |
+-----------------------------------------------------+
    |
    v
+-----------------------------------------------------+
| Phase 2: DESIGN                                     |
| * Normalize to 3NF (SQL) or embed/reference (NoSQL) |
| * Define primary keys and foreign keys              |
| * Choose appropriate data types                     |
| * Add constraints (UNIQUE, CHECK, NOT NULL)         |
+-----------------------------------------------------+
    |
    v
+-----------------------------------------------------+
| Phase 3: OPTIMIZE                                   |
| * Plan indexing strategy                            |
| * Consider denormalization for read-heavy queries   |
| * Add timestamps (created_at, updated_at)           |
+-----------------------------------------------------+
    |
    v
+-----------------------------------------------------+
| Phase 4: MIGRATE                                    |
| * Generate migration scripts (up + down)            |
| * Ensure backward compatibility                     |
| * Plan zero-downtime deployment                     |
+-----------------------------------------------------+
    |
    v
Production-Ready Schema

Commands

Command When to Use Action
design schema for {domain} Starting fresh Full schema generation
normalize {table} Fixing existing table Apply normalization rules
add indexes for {table} Performance issues Generate index strategy
migration for {change} Schema evolution Create reversible migration
review schema Code review Audit existing schema

Workflow: Start with design schema → iterate with normalize → optimize with add indexes → evolve with migration


Core Principles

Principle WHY Implementation
Model the Domain UI changes, domain doesn't Entity names reflect business concepts
Data Integrity First Corruption is costly to fix Constraints at database level
Optimize for Access Pattern Can't optimize for both OLTP: normalized, OLAP: denormalized
Plan for Scale Retrofitting is painful Index strategy + partitioning plan

Anti-Patterns

Avoid Why Instead
VARCHAR(255) everywhere Wastes storage, hides intent Size appropriately per field
FLOAT for money Rounding errors DECIMAL(10,2)
Missing FK constraints Orphaned data Always define foreign keys
No indexes on FKs Slow JOINs Index every foreign key
Storing dates as strings Can't compare/sort DATE, TIMESTAMP types
SELECT * in queries Fetches unnecessary data Explicit column lists
Non-reversible migrations Can't rollback Always write DOWN migration
Adding NOT NULL without default Breaks existing rows Add nullable, backfill, then constrain

Verification Checklist

After designing a schema:

  • Every table has a primary key
  • All relationships have foreign key constraints
  • ON DELETE strategy defined for each FK
  • Indexes exist on all foreign keys
  • Indexes exist on frequently queried columns
  • Appropriate data types (DECIMAL for money, etc.)
  • NOT NULL on required fields
  • UNIQUE constraints where needed
  • CHECK constraints for validation
  • created_at and updated_at timestamps
  • Migration scripts are reversible
  • Tested on staging with production data

Normal Forms

Form Rule Violation Example
1NF Atomic values, no repeating groups product_ids = '1,2,3'
2NF 1NF + no partial dependencies customer_name in order_items
3NF 2NF + no transitive dependencies country derived from postal_code

1st Normal Form (1NF)

-- BAD: Multiple values in column
CREATE TABLE orders (
  id INT PRIMARY KEY,
  product_ids VARCHAR(255)  -- '101,102,103'
);

-- GOOD: Separate table for items
CREATE TABLE orders (
  id INT PRIMARY KEY,
  customer_id INT
);

CREATE TABLE order_items (
  id INT PRIMARY KEY,
  order_id INT REFERENCES orders(id),
  product_id INT
);

2nd Normal Form (2NF)

-- BAD: customer_name depends only on customer_id
CREATE TABLE order_items (
  order_id INT,
  product_id INT,
  customer_name VARCHAR(100),  -- Partial dependency!
  PRIMARY KEY (order_id, product_id)
);

-- GOOD: Customer data in separate table
CREATE TABLE customers (
  id INT PRIMARY KEY,
  name VARCHAR(100)
);

3rd Normal Form (3NF)

-- BAD: country depends on postal_code
CREATE TABLE customers (
  id INT PRIMARY KEY,
  postal_code VARCHAR(10),
  country VARCHAR(50)  -- Transitive dependency!
);

-- GOOD: Separate postal_codes table
CREATE TABLE postal_codes (
  code VARCHAR(10) PRIMARY KEY,
  country VARCHAR(50)
);

When to Denormalize

Scenario Denormalization Strategy
Read-heavy reporting Pre-calculated aggregates
Expensive JOINs Cached derived columns
Analytics dashboards Materialized views
-- Denormalized for performance
CREATE TABLE orders (
  id INT PRIMARY KEY,
  customer_id INT,
  total_amount DECIMAL(10,2),  -- Calculated
  item_count INT               -- Calculated
);

String Types

Type Use Case Example
CHAR(n) Fixed length State codes, ISO dates
VARCHAR(n) Variable length Names, emails
TEXT Long content Articles, descriptions
-- Good sizing
email VARCHAR(255)
phone VARCHAR(20)
country_code CHAR(2)

Numeric Types

Type Range Use Case
TINYINT -128 to 127 Age, status codes
SMALLINT -32K to 32K Quantities
INT -2.1B to 2.1B IDs, counts
BIGINT Very large Large IDs, timestamps
DECIMAL(p,s) Exact precision Money
FLOAT/DOUBLE Approximate Scientific data
-- ALWAYS use DECIMAL for money
price DECIMAL(10, 2)  -- $99,999,999.99

-- NEVER use FLOAT for money
price FLOAT  -- Rounding errors!

Date/Time Types

DATE 
how to use database-schema-designer

How to use database-schema-designer on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add database-schema-designer
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/davila7/claude-code-templates --skill database-schema-designer

The skills CLI fetches database-schema-designer from GitHub repository davila7/claude-code-templates and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/database-schema-designer

Reload or restart Cursor to activate database-schema-designer. Access the skill through slash commands (e.g., /database-schema-designer) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

Task Automation & Efficiency

Automate repetitive workflows and reduce manual effort

Example

Generate reports, summarize documents, draft communications

Save 3-5 hours per week on routine tasks

Knowledge Enhancement

Learn new skills, understand complex topics, get expert guidance

Example

Explain concepts, provide examples, suggest learning resources

Accelerate learning and skill development by 2x

Quality Improvement

Enhance output quality through reviews, suggestions, and refinements

Example

Review drafts, suggest improvements, catch errors

Improve work quality by 30-40% with less effort

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill support
  • Clear understanding of task or problem to solve
  • Willingness to iterate and refine outputs

Time Estimate

15-45 minutes depending on use case complexity

Installation Steps

  1. 1.Install skill using provided installation command
  2. 2.Test with simple use case relevant to your work
  3. 3.Evaluate output quality and relevance
  4. 4.Iterate on prompts to improve results
  5. 5.Integrate into regular workflow if valuable

Common Pitfalls

  • Expecting perfect results without iteration
  • Not providing enough context in prompts
  • Using skill for tasks outside its intended scope
  • Accepting outputs without review and validation

Best Practices

✓ Do

  • +Start with clear, specific prompts
  • +Provide relevant context and constraints
  • +Review and refine all outputs before using
  • +Iterate to improve output quality
  • +Document successful prompt patterns

✗ Don't

  • Don't use without understanding skill limitations
  • Don't skip validation of outputs
  • Don't share sensitive information in prompts
  • Don't expect skill to replace human judgment

💡 Pro Tips

  • Be specific about desired format and style
  • Ask for multiple options to choose from
  • Request explanations to understand reasoning
  • Combine AI efficiency with human expertise

When to Use This

✓ Use When

Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.

✗ Avoid When

Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.

Learning Path

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.537 reviews
  • Omar Kim· Dec 28, 2024

    database-schema-designer is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Hiroshi Nasser· Dec 16, 2024

    Solid pick for teams standardizing on skills: database-schema-designer is focused, and the summary matches what you get after install.

  • Dhruvi Jain· Dec 4, 2024

    Registry listing for database-schema-designer matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Noah Kim· Dec 4, 2024

    Useful defaults in database-schema-designer — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Oshnikdeep· Nov 23, 2024

    Solid pick for teams standardizing on skills: database-schema-designer is focused, and the summary matches what you get after install.

  • Mia Abebe· Nov 23, 2024

    I recommend database-schema-designer for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Mia Iyer· Nov 19, 2024

    Keeps context tight: database-schema-designer is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Lucas White· Nov 7, 2024

    Registry listing for database-schema-designer matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Hiroshi Tandon· Oct 26, 2024

    Useful defaults in database-schema-designer — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Ganesh Mohane· Oct 14, 2024

    I recommend database-schema-designer for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

showing 1-10 of 37

1 / 4