create-table

Generate MySQL CREATE TABLE DDL statements following the company's MySQL database design specifications.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "create-table" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-9315af3622107e0f664798aaf9c0219f0b4b4dfd4d8546333dd54d3a59deaabf. Verify the upstream source and version against https://skillhub.cn/skills/user_a52900dd/create-table before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Generate MySQL CREATE TABLE DDL statements following the company's MySQL database design specifications.

0 Downloads

Introduction source: third_party · user_a52900dd · 1.0.0 Reference

SkillPi interpretation

Tasks
Generate MySQL CREATE TABLE DDL statements following the company's MySQL Database Design Specifications.
Audience
When the user asks to create a table, generate a DDL, or define a table structure.
Inputs and outputs
Output only the DDL statement followed by a brief explanation of design choices. Use this template:
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: create-table
description: Generate MySQL CREATE TABLE DDL statements following the company's MySQL Database Design Specifications.

When to use

When the user asks to create a table, generate a DDL, or define a table structure.

Rules (all mandatory unless marked as suggestion)

Naming

  • Table and column names must be within 32 characters.
  • Table names: only letters, digits, and underscores, all lowercase.
  • Table names must be module-prefixed (e.g., sz_ for 师资系统, qd_ for 渠道系统). Ask for the module prefix if not provided.

Table-level

  • Must explicitly specify CHARSET=utf8mb4.
  • Must explicitly specify ENGINE=InnoDB (default unless otherwise specified).
  • Must have COMMENT on the table.

Primary Key

  • Must have id as primary key, type int UNSIGNED NOT NULL AUTO_INCREMENT, with comment '主键ID'.
  • Primary key name must start with pk_.
  • Primary key values must never be updated (enforce in application logic).
  • Business identifiers (e.g., user_id, order_id) must NOT be the primary key; use indexes or unique indexes instead.

Columns

  • All columns must be NOT NULL with appropriate DEFAULT values.
  • All columns must have COMMENT.
  • Use utf8mb4 charset for all string columns.

Type Selection

  • Auto-increment column: use int.
  • Status/type fields with few distinct values: use tinyint or smallint.
  • Do NOT use ENUM or SET; use tinyint or smallint instead.
  • Text data: prefer varchar over char. Max ~2000 characters for varchar.
  • Time fields: prefer datetime. timestamp range is limited (1970-2038). Alternatively, use int with unix_timestamp()/from_unixtime().

Audit Fields (for core tables like user, money-related)

  • Must have created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP.
  • Must have updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP.

Indexes

  • Primary key: id int auto_increment (enforced above).
  • Primary key names start with pk_, unique keys with uniq_, ordinary indexes with idx_. All lowercase.
  • Index type must be BTREE (default for InnoDB).
  • Maximum 8 indexes per table.
  • Prefer composite indexes with highest cardinality column first.
  • No redundant indexes (e.g., if KEY(a,b) exists, KEY(a) is redundant).

Soft Delete

  • Recommend adding is_deleted tinyint UNSIGNED NOT NULL DEFAULT 0 for tables that need soft delete.

Audit Columns (recommended for all tables)

  • created_by int UNSIGNED NOT NULL DEFAULT 0
  • updated_by int UNSIGNED NOT NULL DEFAULT 0

Output Format

Output only the DDL statement followed by a brief explanation of design choices. Use this template:

CREATE TABLE `table_name` (
    `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    -- other columns...
    `is_deleted` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否被软删除',
    `created_by` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建人',
    `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updated_by` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新人',
    `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`id`),
    -- indexes...
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='table comment';

Reference Example

CREATE TABLE `qd_trigger_sub_object_type_conf` (
    `id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
    `sub_object_type` int NOT NULL DEFAULT 0 COMMENT '触达对象类型',
    `sub_object_type_name` varchar(32) NOT NULL DEFAULT '' COMMENT '触达对象类型名',
    `skills` text  COMMENT '触达对象执行技能',
    `attachment` varchar(255) NOT NULL DEFAULT '{}' COMMENT '附加参数值',
    `config_label` varchar(32) NOT NULL DEFAULT '' COMMENT '页面label配置',
    `variable_id` int  not null default 0         comment '变量id',
    `is_deleted` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否被软删除',
    `created_by` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建人',
    `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    `updated_by` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新人',
    `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
    PRIMARY KEY (`id`),
    KEY `idx_sub_object_type` (`sub_object_type`),
    UNIQUE KEY `uniq_sub_object_type` (`sub_object_type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='触达子对象类型配置表';

Current listing version

1.0.0

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value88/100

Highlights

  • 面向开发者的高频刚需工具,解决企业 DDL 规范一致性问题
  • 显著提升数据库设计效率,降低规范落地成本
Trigger Precision92/100

Highlights

  • 触发词覆盖完整:create table / generate DDL / define table structure
  • 边界清晰,不易与其他 Skill 重叠
Structure and Standards95/100

Highlights

  • 结构清晰完整:分模块详述命名/表级/主键/字段/类型/审计/索引等规范
  • 提供完整输出模板和参考示例,便于直接执行
Execution Reliability90/100

Highlights

  • 覆盖 MySQL 建表关键约束:字符集/引擎/主键/索引数量等
  • 类型选择建议合理,避免 ENUM/SET 等易错用法
Evidence Verifiability (mean of the first four)91/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.