安全扫描
OpenClaw
安全
high confidence该技能是纯指令式的数据库模式和图表文本生成器,其要求和指令是连贯的,不请求凭证或安装代码。
评估建议
此技能是纯指令式的文本生成器(它生成SQL、迁移模板、ERD文本)。它不安装代码或请求凭证,因此安装它技术风险低。但是:(1) 不要将敏感或生产密钥/PII粘贴到提示中——种子数据生成可能会镜像输入内容;(2) 将生成的SQL/迁移视为草稿:在应用到生产数据库之前进行审查和测试;(3) SKILL.md显示CLI示例,但没有提供二进制文件——代理将生成文本,不会为您运行本地迁移命令。如果您需要一个集成到您环境中的可执行工具,您应该单独验证或提供一个经过审查的实现。...详细分析 ▾
✓ 用途与能力
Name and description (generate schemas, migrations, ERDs) match the SKILL.md content. The skill requests no binaries, env vars, or config paths — which is proportional for an instruction-only generator.
ℹ 指令范围
SKILL.md stays focused on generating schemas, migrations, ERDs, indexes, and seed data from English descriptions. It does include CLI-style usage examples (e.g., `db-schema "..."`) despite there being no install/binary provided — this is a documentation/example artifact rather than an instruction to access system binaries. Also note the seed-data feature could encourage users to paste realistic data into prompts; avoid including private/PII in inputs.
✓ 安装机制
No install spec and no code files are present, so nothing is downloaded or written to disk. This is the lowest-risk model for a skill of this type.
✓ 凭证需求
The skill declares no required environment variables, credentials, or config paths. The instructions do not reference any hidden env vars or credentials — access requests are proportionate to the stated purpose.
✓ 持久化与权限
always:false and default invocation settings are appropriate. The skill does not request persistent system presence or modify other skills/configs.
安全有层次,运行前请审查代码。
运行时依赖
🖥️ OSmacOS · Linux · Windows
版本
latestv1.0.02026/3/10
● 无害
安装命令 点击复制
官方npx clawhub@latest install db-schema-gen
镜像加速npx clawhub@latest install db-schema-gen --registry https://cn.clawhub-mirror.com
技能文档
# DB Schema Describe your data model in English. Get production-ready schema, migrations, and diagrams.
什么 做
Takes a plain English description of your data and generates:- SQL schema (创建 表 statements 带有 constraints)
- Migration files (对于 Prisma, Drizzle, Knex, Alembic, etc.)
- Entity-Relationship diagram (Mermaid 或 ASCII)
- Indexes (auto-detected 从 common 查询 patterns)
- Seed data (realistic sample data 对于 development)
Usage
从 description:
``
db-schema "Users have many posts. Posts have many comments. Users can like posts."
`
带有 options:
`
db-schema "E-commerce with products, orders, customers" --dialect postgres --orm prisma
`
Options:
--dialect — postgres (默认), mysql, sqlite, mongodb
--orm — raw (默认), prisma, drizzle, knex, sqlalchemy, typeorm
--格式 — sql (默认), json, markdown
--diagram — include ERD diagram: mermaid (默认), ascii, 无
--seed — generate seed data (默认: 假)
--seed-计数 — rows per 表 对于 seed data (默认: 10)
Generation Rules
Schema Design:
- Every 表 gets primary 键 —
id (BIGSERIAL 对于 PG, AUTO_INCREMENT 对于 MySQL, INTEGER AUTOINCREMENT 对于 SQLite)
Timestamps 由 默认 — created_at 和 updated_at 在...上 every 表
Foreign keys 带有 proper naming — table_id references 表(id)
在...上 删除 behavior — CASCADE 对于 owned relationships, 设置 空 对于 可选
Proper types — 使用 appropriate types (TEXT 不 VARCHAR(255) 对于 PG, TIMESTAMPTZ 不 时间戳)
Relationship Detection:
| English | Relationship | Implementation |
|---------|-------------|---------------|
| "has many" | One-to-Many | FK on the "many" side |
| "belongs to" | Many-to-One | FK on current table |
| "has one" | One-to-One | FK with UNIQUE constraint |
| "many to many" | Many-to-Many | Junction table |
| "can like/follow/tag" | Many-to-Many | Junction table with metadata |
Auto-Indexing:
| Pattern | Index Type |
|---------|-----------|
| Foreign keys | B-tree index |
| Email, username | UNIQUE index |
| Created/updated dates | B-tree index |
| Status/type/role columns | B-tree index |
| Full-text search fields | GIN index (PG) / FULLTEXT (MySQL) |
| Slug/path columns | UNIQUE index |
| Composite lookups | Composite index |
类型 Mapping:
| Concept | PostgreSQL | MySQL | SQLite |
|---------|-----------|-------|--------|
| ID | BIGSERIAL | BIGINT AUTO_INCREMENT | INTEGER |
| Short text | VARCHAR(N) | VARCHAR(N) | TEXT |
| Long text | TEXT | TEXT | TEXT |
| Money | NUMERIC(12,2) | DECIMAL(12,2) | REAL |
| Boolean | BOOLEAN | TINYINT(1) | INTEGER |
| Timestamp | TIMESTAMPTZ | DATETIME | TEXT |
| JSON | JSONB | JSON | TEXT |
| UUID | UUID | CHAR(36) | TEXT |
| Enum | Custom TYPE | ENUM(...) | TEXT CHECK |
输出 (SQL):
`sql
-- Generated by db-schema
-- Description: E-commerce with products, orders, customers
CREATE TABLE customers (
id BIGSERIAL PRIMARY KEY,
email VARCHAR(255) NOT NULL UNIQUE,
name VARCHAR(255) NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE TABLE products (
id BIGSERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT,
price NUMERIC(12,2) NOT NULL CHECK (price >= 0),
stock INTEGER NOT NULL DEFAULT 0,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE TABLE orders (
id BIGSERIAL PRIMARY KEY,
customer_id BIGINT NOT NULL REFERENCES customers(id) ON DELETE CASCADE,
status VARCHAR(50) NOT NULL DEFAULT 'pending',
total NUMERIC(12,2) NOT NULL DEFAULT 0,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE TABLE order_items (
id BIGSERIAL PRIMARY KEY,
order_id BIGINT NOT NULL REFERENCES orders(id) ON DELETE CASCADE,
product_id BIGINT NOT NULL REFERENCES products(id) ON DELETE RESTRICT,
quantity INTEGER NOT NULL CHECK (quantity > 0),
unit_price NUMERIC(12,2) NOT NULL
);
CREATE INDEX idx_orders_customer_id ON orders(customer_id);
CREATE INDEX idx_orders_status ON orders(status);
CREATE INDEX idx_order_items_order_id ON order_items(order_id);
CREATE INDEX idx_order_items_product_id ON order_items(product_id);
`
ERD 输出 (Mermaid):
`
erDiagram
CUSTOMERS ||--o{ ORDERS : places
ORDERS ||--|{ ORDER_ITEMS : contains
PRODUCTS ||--o{ ORDER_ITEMS : "included in"
``
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制
免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制