database-designer
БесплатноБез исполняемых скриптовНе проверенComprehensive database design tool creating complete schemas with tables, fields, indexes, and ER diagrams. Use when users request database design for any…
от shining319★ 22 звезды на GitHubОб этом скилле
Database Designer
Design complete, production-ready database schemas based on user requirements. Generate comprehensive documentation, SQL scripts, and visual ER diagram files compatible with DrawDB.
Core Design Principles
Before starting any design, always read references/design-principles.md to understand:
- No physical foreign keys (logical relationships only)
- Realistic field sizes based on actual usage
- Minimal, strategic index design
- Mandatory comments on all tables and fields
- Default system fields (id, timestamps, soft delete)
- snake_case naming conventions
Workflow
Step 1: Understand Requirements
Gather information about the database design:
- Database type: MySQL 8.0 (default), PostgreSQL, SQL Server, etc.
- Business domain: E-commerce, blog, CRM, ERP, etc.
- Core entities: What are the main tables needed?
- Key features: What functionality should the database support?
- Special requirements: Any specific constraints or preferences?
If the user provides minimal information, intelligently infer missing details based on common business scenarios and best practices documented in references/design-examples.md.
Key inference scenarios:
- User says "design a user table" → Infer: username, password, email, phone, status
- User says "e-commerce system" → Infer: user, product, order, order_detail tables
- User says "blog system" → Infer: user, article, comment, tag, article_tag tables
Step 2: Load Reference Documentation
Based on the design requirements, load appropriate references:
- Always load:
references/design-principles.mdfor core design rules - For format generation:
references/drawdb-formats.mdfor JSON/DBML specifications - For examples:
references/design-examples.mdfor similar system designs
Step 3: Design Database Schema
Create complete table structures following these guidelines:
Table Design Checklist
For each table:
✅ Add default system fields (unless user specifies otherwise):
idBIGINT AUTO_INCREMENT PRIMARY KEYcreated_atDATETIME DEFAULT CURRENT_TIMESTAMPupdated_atDATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMPis_deletedTINYINT(1) DEFAULT 0
✅ Design business fields with realistic sizes:
- username: VARCHAR(50)
- email: VARCHAR(100)
- phone: VARCHAR(20)
- title: VARCHAR(200)
- description: TEXT
- See
references/design-principles.mdfor complete size standards
✅ Add appropriate constraints:
- NOT NULL for required fields
- DEFAULT values for optional fields
- UNIQUE for fields requiring uniqueness (but not as foreign keys)
✅ Add COMMENT to every table and field (in Chinese)
✅ Do NOT create physical FOREIGN KEY constraints
Index Design Strategy
For each table, analyze and create indexes for:
- WHERE clause fields: Fields frequently used in filtering
- JOIN fields: All
xxx_idforeign key fields - ORDER BY / GROUP BY fields: Sorting and grouping fields
- Unique constraints: email, phone, order_no, etc. → UNIQUE indexes
Index naming conventions:
- Ordinary index:
idx_field_nameoridx_field1_field2 - Unique index:
uk_field_name
Index limits:
- Maximum 5 indexes per table (unless user requests more)
- Only create indexes that directly support business queries
Relationship Design
Identify logical relationships between tables:
One-to-Many (1:N): Most common
- Example: user (1) → order (N)
- Implementation: Add
user_idin order table - DrawDB: many-to-one relationship
One-to-One (1:1): For table splitting
- Example: user (1) → user_profile (1)
- Implementation: Add
user_id UNIQUEin user_profile table - DrawDB: one-to-one relationship
Many-to-Many (N:N): Requires junction table
- Example: article (N) ↔ tag (N)
- Implementation: Create article_tag junction table with article_id + tag_id
- DrawDB: Two many-to-one relationships
Step 4: Generate Outputs
Create all required output files:
4.1 Comprehensive Design Document (Markdown)
Create a single, well-structured Markdown file containing:
Structure:
# [Project Name] 数据库设计文档
## 1. 数据库概览
- 数据库类型
- 字符集
- 核心表数量
- 主要功能模块
## 2. 表结构设计
### 2.1 [Table Name]
**表名**: table_name
**说明**: Table description
**字段列表**:
| 字段名 | 类型 | 允许空 | 默认值 | 说明 |
|--------|------|--------|--------|------|
| id | BIGINT | NO | | Primary key |
| ... | ... | ... | ... | ... |
**索引列表**:
| 索引名 | 类型 | 字段 |
|--------|------|------|
| uk_email | UNIQUE | email |
| idx_username | INDEX | username |
### 2.2 [Next Table]
...
## 3. 表关系说明
- table1 → table2 (1:N): Description
- table3 ↔ table4 (N:N): Description via junction table
## 4. 索引策略说明
Explain the rationale behind index design decisions
4.2 SQL Script
Create executable SQL script with:
-- Database: project_name
-- Generated: YYYY-MM-DD
-- Drop tables if exists (in reverse dependency order)
DROP TABLE IF
Установить database-designer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл database-designer?
Comprehensive database design tool creating complete schemas with tables, fields, indexes, and ER diagrams. Use when users request database design for any system. Generates Markdown docs, SQL scripts, and DrawDB-compatible JSON/DBML files. Supports MySQL, PostgreSQL, SQL Server. Triggers: database design, schema, ER diagram, SQL, data model. | 全面的数据库设计工具,创建完整的数据库架构。触发词:数据库设计、数据库架构、ER图、SQL、数据模型、表设计。
Как установить скилл database-designer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл database-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