create-table

根据公司的 MySQL 数据库设计规范生成 MySQL CREATE TABLE DDL 语句。

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "create-table":https://skillpi.com/zh/skills/deepskill-9315af3622107e0f664798aaf9c0219f0b4b4dfd4d8546333dd54d3a59deaabf。安装前核对上游来源和版本:https://skillhub.cn/skills/user_a52900dd/create-table。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

skillhub.cn

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

根据公司的 MySQL 数据库设计规范生成 MySQL CREATE TABLE DDL 语句。

0 下载

介绍来源: third_party · user_a52900dd · 1.0.0 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
输入和输出
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
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='触达子对象类型配置表';

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值88/100

亮点

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

亮点

  • 触发词覆盖完整:create table / generate DDL / define table structure
  • 边界清晰,不易与其他 Skill 重叠
结构规范95/100

亮点

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

亮点

  • 覆盖 MySQL 建表关键约束:字符集/引擎/主键/索引数量等
  • 类型选择建议合理,避免 ENUM/SET 等易错用法
证据可验 (前四项均值)91/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

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

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。