.agents/skills/database-schema-designer/README.md
A comprehensive skill for designing production-ready database schemas with built-in best practices for both SQL and NoSQL databases.
The Database Schema Designer skill helps you create robust, scalable database schemas by providing:
Whether you are starting a new project or evolving an existing database, this skill ensures your schema follows industry best practices and avoids common pitfalls.
Use this skill when you need to:
| 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" |
The skill follows a four-phase process:
design a schema for an e-commerce platform with users, products, orders
Output:
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)
);
| Command | Purpose |
|---|---|
design schema for {domain} | Generate a complete schema from scratch |
normalize {table} | Apply normalization rules to fix an existing table |
add indexes for {table} | Generate an index strategy for performance |
migration for {change} | Create reversible migration scripts |
review schema | Audit an existing schema for issues |
Include these details in your request for best results:
No special tools or dependencies required. The skill generates standard SQL or NoSQL schema definitions that work with:
The skill produces:
After designing a schema, verify:
| Anti-Pattern | Problem | Solution |
|---|---|---|
| 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 | Cannot compare/sort properly | Use DATE/TIMESTAMP types |
| Non-reversible migrations | Cannot rollback safely | Always write DOWN migration |
| Term | Definition |
|---|---|
| Normalization | Organizing data to reduce redundancy (1NF to 2NF to 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 |
MIT