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.
Об этом скилле
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() → See what already exists
whodb_columns(table="related_table") → Understand existing structure
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
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)
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)
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
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
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
- Always define PRIMARY KEY - Every table needs one
- Use foreign keys - Enforce referential integrity
- Add NOT NULL - Unless the column is truly optional
- Create indexes - On foreign keys and frequently queried columns
- Use appropriate types - Don't store numbers as strings
- Add timestamps -
created_atandupdated_atare almost always useful - Name consistently -
user_idnotuserIdorUserID - Avoid reserved words - Don't name columns
order,user,group
Migration Safety
When modifying existing tables:
-- Safe: Adding n
Установить schema-designer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл 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.
Как установить скилл schema-designer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл schema-designer запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic