Token导航 LogoToken导航TokenDH.com
前端设计只读github未标认证来源可访问许可证需确认审计通过

ent-seed-sql-generatorENT seed SQL 生成器

Agent Skill

用于辅助数据库表结构、查询语句、迁移脚本和数据维护任务。它适合让 Agent 分析 schema、编写 SQL、排查查询问题、整理索引或生成迁移建议。使用时需要明确数据库类型、连接环境和目标表,区分只读分析与写入变更;涉及删除、更新、迁移和批量导入时,应优先 dry-run、备份或事务保护,避免误操作。

总安装

674

周安装

27

GitHub Stars

公开资料未说明

下载量

218
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:ent-seed-sql-generator(ENT seed SQL 生成器)
来源仓库:https://github.com/go-sphere/skills
仓库路径:skills/ent-seed-sql-generator
安装命令:
npx skills add https://github.com/go-sphere/skills --skill ent-seed-sql-generator
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/go-sphere/skills --skill ent-seed-sql-generator

简介

基于 Ent schema 与混合证据生成确定性 ID 的生产级 seed SQL。

  • 确保外键关系有效、数据分布合理,避免运行时约束冲突。
  • 输出单一可执行 SQL 文件,简化测试环境与 demo 数据初始化流程。
  • 生成前需确认方言与策略匹配,防止 PostgreSQL/MySQL 语法差异导致失败。
  • ent-seed-sql-generator 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Ent Seed SQL Generator

Produce one executable seed SQL artifact from Ent schemas and mixed evidence — with deterministic IDs, valid relationships, and realistic production-like data. Confirm the generation plan before writing SQL so that dialect, strategy, and scope mismatches are caught before they waste effort.

Trigger / Non-Trigger

Use this skill when the task is to generate or revise seed SQL from Ent schema context, docs, demo behavior, or prompt requirements.

Do not use this skill for schema migration design, runtime repository/service implementation, or query performance tuning.

Reference Loading Plan

Load only what is needed for the current task:

Checklist

Work through these in order. Create a task for each item.

  1. Collect inputs — prompt, Ent schema files, existing seeds, product docs
  2. Detect dialect and resolve ambiguities — ask one question at a time if unclear
  3. Present generation plan — entities, strategy, row counts; get approval
  4. Build schema map — dependency order, FK graph, enum values
  5. Generate SQL artifact — following output-sql-pattern.md
  6. Run quality gates — orphan FKs, unique violations, missing required fields

Process Flow

digraph ent_seed_sql_generator {
    "Collect inputs" [shape=box];
    "Any ambiguities?" [shape=diamond];
    "Ask clarifying question\n(one at a time)" [shape=box];
    "Present generation plan" [shape=box];
    "Plan approved?" [shape=diamond];
    "Build schema map\n& dependency order" [shape=box];
    "Generate SQL artifact" [shape=box];
    "Quality gates" [shape=box];
    "Deliver artifact" [shape=doublecircle];

    "Collect inputs" -> "Any ambiguities?";
    "Any ambiguities?" -> "Ask clarifying question\n(one at a time)" [label="yes"];
    "Ask clarifying question\n(one at a time)" -> "Any ambiguities?";
    "Any ambiguities?" -> "Present generation plan" [label="no"];
    "Present generation plan" -> "Plan approved?";
    "Plan approved?" -> "Present generation plan" [label="revise"];
    "Plan approved?" -> "Build schema map\n& dependency order" [label="yes"];
    "Build schema map\n& dependency order" -> "Generate SQL artifact";
    "Generate SQL artifact" -> "Quality gates";
    "Quality gates" -> "Deliver artifact";
}

Phase 1: Collect Inputs and Clarify

Gather available inputs in this order:

  1. Current prompt requirements
  2. Ent schemas and migration/DDL files (ent/schema/*.go, ent/migrate/)
  3. Existing seed files and demo code behavior
  4. Product docs and domain notes

Then detect the SQL dialect:

  • Check ent/client.go or config for driver name (mysql, postgres, sqlite)
  • Look at migration files for dialect-specific syntax
  • Check go.mod for dialect imports (ent/dialect/mysql, etc.)

If any of the following are unclear after reading available inputs, ask one question at a time:

  • Dialect: "I couldn't determine the database dialect from the project files. Which are you targeting — MySQL, PostgreSQL, or SQLite?"
  • Strategy: "Should this seed be one-shot (fresh setup only), idempotent (INSERT OR IGNORE / ON CONFLICT DO NOTHING), or upsert (ON CONFLICT DO UPDATE)?"
  • Scope: "Should I seed all entities, or a specific subset? If a subset, which ones?"
  • Row counts: "How many rows per entity? (3-10 is typical for development seeds)"

Do not ask questions that can be answered from the available files. Ask only what genuinely changes the output.

Phase 2: Generation Plan

Before writing SQL, present a compact plan:

Dialect: MySQL Strategy: idempotent Entity order (by dependency): 1. organizations — 3 rows, no dependencies 2. users — 5 rows, FK → organizations 3. projects — 4 rows, FK → organizations + users ID ranges: organizations 2000–2999, users 1000–1999, projects 3000–3999 Assumptions: password fields will use a fixed bcrypt hash for test credentials Does this look right before I start writing?

Scale the plan to the complexity of the task. For a single entity with no FKs, a one-line summary is enough. For multi-tenant systems with many tables, list the full dependency order.

Phase 3: Build Schema Map

After plan approval, read references/model-extraction.md and extract from ent/schema/*.go:

  • Fields: type, Optional, Nillable, Unique, Default, Immutable, Sensitive
  • Enums: all valid values from field.Enum or validate rules
  • Edges: edge.To, edge.From, Required, Unique, Ref — derive FK ownership
  • Indexes: unique constraints and composite indexes

Compute topological dependency order: tables with no FK references first, dependent tables after. Join tables last.

Phase 4: Generate SQL Artifact

Follow references/output-sql-pattern.md. Apply references/id-and-relation-rules.md for ID ranges and FK integrity.

ID Assignment:

  • Integer PKs: use non-overlapping ranges per entity type
  • String PKs: use semantic IDs (usr_admin, org_acme)
  • UUIDs: deterministic from business keys, never random

Data Coherence:

  • Timestamps: created_at <= updated_at, spread across realistic ranges
  • Status progressions: realistic lifecycle (draft → active → archived)
  • Ownership: every owner_id references an existing user row
  • Text content: meaningful strings, not Lorem Ipsum; real email patterns

For credential fields, read references/password-hashing.md.

Dialect-specific patterns:

TypePostgreSQLMySQLSQLite
JSON'{"k":"v"}'::jsonb'{"k":"v"}''{"k":"v"}'
ArrayARRAY['a','b']not nativenot native
BoolTRUE/FALSE1/01/0
Timestamp'2026-01-01 09:00:00''2026-01-01 09:00:00''2026-01-01 09:00:00'

Special cases to handle inline:

  • Soft deletes: set deleted_at to NULL for active records
  • Self-referential (trees): insert root first, children reference valid parent IDs
  • Multi-tenant: seed tenant table first; all dependent tables must carry valid tenant FK
  • Composite unique constraints: verify all column combinations are unique across rows

Phase 5: Quality Gates

Before delivering, verify:

  • No orphan FKs — every referenced ID exists
  • No unique constraint violations — including composite unique indexes
  • No placeholder or TODO values
  • All IDs are deterministic (no random or auto-generated values)
  • Timestamps are internally consistent (created_at <= updated_at)
  • All required fields (Required() in Ent schema) are present in every INSERT
  • No invalid enum values
  • JSON columns contain valid JSON strings

Output Contract

Deliver exactly one SQL artifact (inline or file, per user request) with:

  1. Header comments: source inputs, dialect, strategy, assumptions
  2. Optional cleanup block (only for idempotent/upsert strategies)
  3. INSERT blocks grouped by dependency order, each group preceded by a comment
  4. Optional verification SELECT queries (only when requested)

Guardrails

  • Never invent tables or columns without evidence — mark inferences as comments
  • Never use random IDs — seed IDs must be stable across runs
  • Never break FK dependency order — parents before children, join tables last
  • Never bloat row counts — 3–10 rows per core table is usually sufficient
  • Never expose production credentials — use test-only values
  • Never mix dialects in one file
  • Never omit required fields

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.52%
按下载量换算77

Claude

28%
按下载量换算61

Cursor

20.58%
按下载量换算45

Gemini CLI

10.09%
按下载量换算22

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills