Skip to content
Skills Library
Data & analytics · Planning

schema-designer

/schema-designer

Help design database schemas, create tables, and plan data models. Activates when users ask to create tables, design schemas, or model data relationships.

Repository
whodb ↗
Licence
Apache-2.0
Last repository change
25.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 25.10.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Help design database schemas, create tables, and plan data models. Activates when users ask to create tables, design schemas, or model data relationships.

Original author description

Help design database schemas, create tables, and plan data models. Activates when users ask to create tables, design schemas, or model data relationships.

How it works

  1. When to Use
  2. Workflow
  3. Data Type Guidelines
  4. Common Patterns
  5. Best Practices
  6. Migration Safety
Original SKILL.md headings · 188 lines, 800 words
SKILL.md preview
---
name: schema-designer
description: Help design database schemas, create tables, and plan data models. Activates when users ask to create tables, design schemas, or model data relationships.
---

# Schema Designer

Help users design database schemas, create tables, and model data relationships.

These database-only MCP tools require the database module enabled through `whodb setup`. Keep the MCP command at `whodb mcp serve`. For platform resources, use the WhoDB skill and discover available `whodb_platform_*` tools instead.

## When to Use

Activate when user asks:
- "Create a table for storing orders"
- "Design a schema for a blog"
- "Add a column to track user preferences"
- "How should I model this relationship?"

## Workflow

### 1. Understand Requirements
Ask clarifying questions:
- What data needs to be stored?
- What are the relationships between entities?
- What queries will be common?
- What's the expected data volume?

### 2. Check Existing Schema
```
whodb_tables(include_columns=true) → See all tables and their columns in one call
```

### 3. Design the Schema
Follow database design principles:
- Normalize to reduce redundancy
- Use appropriate data types
- Define primary keys
- Establish foreign key relationships
- Add indexes for common queries

### 4. Generate DDL
Provide CREATE TABLE statements with explanations.

## Data Type Guidelines

### Identifiers
| Use Case | PostgreSQL | MySQL | SQLite |
|----------|------------|-------|--------|
| Auto-increment ID | `SERIAL` / `BIGSERIAL` | `INT AUTO_INCREMENT` | `INTEGER PRIMARY KEY` |
| UUID | `UUID` | `CHAR(36)` | `TEXT` |

### Text
| Use Case | PostgreSQL | MySQL | SQLite |
|----------|------------|-------|--------|
| Short text (<255) | `VARCHAR(n)` | `VARCHAR(n)` | `TEXT` |
| Long text | `TEXT` | `TEXT` | `TEXT` |
| Fixed length | `CHAR(n)` | `CHAR(n)` | `TEXT` |

### Numbers
| Use Case | PostgreSQL | MySQL | SQLite |
|----------|------------|-------|--------|
| Integer | `INTEGER` | `INT` | `INTEGER` |
| Big integer | `BIGINT` | `BIGINT` | `INTEGER` |
| Decimal (money) | `NUMERIC(10,2)` | `DECIMAL(10,2)` | `REAL` |
| Float | `REAL` | `FLOAT` | `REAL` |

### Dates
| Use Case | PostgreSQL | MySQL | SQLite |
|----------|------------|-------|--------|
| Date only | `DATE` | `DATE` | `TEXT` |
| Timestamp | `TIMESTAMP` | `DATETIME` | `TEXT` |
| With timezone | `TIMESTAMPTZ` | `TIMESTAMP` | `TEXT` |

### Boolean
| PostgreSQL | MySQL | SQLite |
|------------|-------|--------|
| `BOOLEAN` | `TINYINT(1)` | `INTEGER` |

## Common Patterns

### Users Table
```sql
CREATE TABLE users (
    id SERIAL PRIMARY KEY,
    email VARCHAR(255) NOT NULL UNIQUE,
    password_hash VARCHAR(255) NOT NULL,
    name VARCHAR(100),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX idx_users_email ON users(email);
```

### One-to-Many (Orders → Order Items)
```sql
CREATE TABLE orders (
    id SERIAL PRIMARY KEY,
    user_id INTEGER NOT NULL REFERENCES users(id),
    status VARCHAR(20) DEFAULT 'pending',
    total NUMERIC(10,2),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE order_items (
    id SERIAL PRIMARY KEY,
    order_id INTEGER NOT NULL REFERENCES orders(id) ON DELETE CASCADE,
    product_id INTEGER NOT NULL REFERENCES products(id),
    quantity INTEGER NOT NULL DEFAULT 1,
    unit_price NUMERIC(10,2) NOT NULL
);

CREATE INDEX idx_order_items_order ON order_items(order_id);
```

### Many-to-Many (Users ↔ Roles)
```sql
CREATE TABLE roles (
    id SERIAL PRIMARY KEY,
    name VARCHAR(50) NOT NULL UNIQUE
);

CREATE TABLE user_roles (
    user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
    role_id INTEGER NOT NULL REFERENCES roles(id) ON DELETE CASCADE,
    PRIMARY KEY (user_id, role_id)
);
```

### Soft Delete Pattern
```sql
CREATE TABLE posts (
    id SERIAL PRIMARY KEY,
    title VARCHAR(255) NOT NULL,
    content TEXT,
    deleted_at TIMESTAMP NULL,  -- NULL = not deleted
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Query active posts
SELECT * FROM posts WHERE deleted_at IS NULL;
```

### Audit Trail Pattern
```sql
CREATE TABLE audit_log (
    id SERIAL PRIMARY KEY,
    table_name VARCHAR(50) NOT NULL,
    record_id INTEGER NOT NULL,
    action VARCHAR(10) NOT NULL,  -- INSERT, UPDATE, DELETE
    old_values JSONB,
    new_values JSONB,
    user_id INTEGER REFERENCES users(id),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX idx_audit_table_record ON audit_log(table_name, record_id);
```

## Best Practices

1. **Always define PRIMARY KEY** - Every table needs one
2. **Use foreign keys** - Enforce referential integrity
3. **Add NOT NULL** - Unless the column is truly optional
4. **Create indexes** - On foreign keys and frequently queried columns
5. **Use appropriate types** - Don't store numbers as strings
6. **Add timestamps** - `created_at` and `updated_at` are almost always useful
7. **Name consistently** - `user_id` not `userId` or `UserID`
8. **Avoid reserved words** - Don't name columns `order`, `user`, `group`

## Migration Safety

When modifying existing tables:

```sql
-- Safe: Adding nullable column
ALTER TABLE users ADD COLUMN phone VARCHAR(20);

-- Safe: Adding column with default
ALTER TABLE users ADD COLUMN active BOOLEAN DEFAULT true;

-- Caution: Adding NOT NULL (requires default or backfill)
ALTER TABLE users ADD COLUMN status VARCHAR(20) NOT NULL DEFAULT 'active';

-- Caution: Dropping column (data loss)
ALTER TABLE users DROP COLUMN old_column;

-- Caution: Changing type (may fail on existing data)
ALTER TABLE users ALTER COLUMN age TYPE INTEGER;
```

Versions

RepositoryScoreLicence
This page · clidey/whodb100Apache-2.0
clidey/whodb100Apache-2.0
armanzeroeight/fastagent-plugins100MIT

Database snapshot: 13.11.2026 · package version ecde9aa6349c (SHA-256 digest of the entire package)

Downloads in the last 30 days: 4 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100database-designer
    Use when the user asks to design database schemas, plan data migrations, optimize queries, choose between SQL and NoSQL, or model data relationships.
  • 100designing-database-schemas
    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".
  • 100designing-database-schemas
    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".
  • 100database-schema-designer
    Use when the user asks to create ERD diagrams, normalize database schemas, design table relationships, or plan schema migrations.
  • 100database-schema-designer
    Design production-ready database schemas for SQL and NoSQL databases. Use when user asks to "design schema", "create tables", "database design", "ERD", "data model", or when starting a project that needs database structure. Triggers on "normalize", "migration plan", "index strategy", "테이블 설계".
  • 100dba-designer
    Database Architect / DBA role skill. Use when you need to design database schemas, performance strategies, security design, or data model reviews. Keywords: database design, schema design, table structure, index design, performance optimisation, data security, data integrity, ER…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.