context7
Fetches up-to-date documentation and code examples for libraries, frameworks, SDKs, CLI tools and cloud services, so an AI agent can answer API questions and generate code against current references.
Turns SQL CREATE TABLE statements or DBML into a Chen-model ER diagram, with options to rearrange the layout or show only the skeleton with attributes hidden.
Claude Code
$ npx -y skills add ystemsrx/sql-to-er --agent claude-code
Codex
$ npx skills add ystemsrx/sql-to-er -a codex
Cursor
$ npx skills add ystemsrx/sql-to-er -a cursor
Gemini CLI
$ npx skills add ystemsrx/sql-to-er -a gemini-cli
GitHub Copilot
$ npx skills add ystemsrx/sql-to-er -a github-copilot
OpenCode
$ npx skills add ystemsrx/sql-to-er -a opencode
Windsurf
$ npx skills add ystemsrx/sql-to-er -a windsurf


优雅的在线 SQL / DBML 转 ER 图工具
English · 简体中文
通过一条命令安装 sql2er Agent Skill:
npx skills add ystemsrx/sql-to-ER
一个基于网页的纯前端工具,用于从 SQL CREATE TABLE 语句和 DBML 代码生成 Chen 模型 ER 图。无需登录,无需付费,完全免费开源。
Note 为什么做这个?市面上绝大多数 DBML/SQL 转 ER 图的在线工具都需要登录甚至收费,且样式奇丑无比,体验令人失望。于是直接开源一个免费替代品。
Tip 如果你需要绘制的是逻辑模型(而非 Chen 模型),推荐使用 dbdiagram.io,同样免费。
直接访问在线版本即可使用,无需安装:
或者克隆到本地开发运行:
本项目使用 pnpm 作为包管理器(已通过 packageManager 字段锁定版本,建议先 corepack enable 让其自动安装)。
git clone https://github.com/ystemsrx/sql-to-ER.git
cd sql-to-ER
corepack enable # 一次性,启用 Corepack 自动管理 pnpm 版本
pnpm install
pnpm dev
Warning 请勿直接双击打开
sql2er.html。 本项目使用 Vite + TypeScript,源码中的.ts/.tsx和前端依赖需要 Vite 编译与模块解析。开发时请使用:pnpm dev然后在浏览器访问 Vite 输出的地址,例如
http://localhost:5173/sql2er.html。如果要用静态服务器,请先执行pnpm build,再服务dist/目录。
pnpm dev 打开 sql2er.html(参见上方快速使用,或直接访问在线版)CREATE TABLE 语句或 DBML 代码📘 SQL 示例
CREATE TABLE users (
id INT PRIMARY KEY,
username VARCHAR(255) NOT NULL,
email VARCHAR(255) UNIQUE
);
CREATE TABLE posts (
id INT PRIMARY KEY,
author_id INT,
title VARCHAR(255),
FOREIGN KEY (author_id) REFERENCES users(id)
);
📗 DBML 示例
Table users {
id INT [pk]
username VARCHAR(255) [not null]
email VARCHAR(255) [unique]
}
Table posts {
id INT [pk]
author_id INT
title VARCHAR(255)
}
Ref: posts.author_id > users.id
| 图形 | 含义 | 对应数据库概念 |
|---|---|---|
| 🟦 矩形 | 实体 | 表 |
| 🔶 菱形 | 关系 | 外键 |
| ⚪ 椭圆 | 属性 | 列 |
| 下划线 | 主键标识 | 主键属性 |
Important 本工具为简化使用,在以下方面对标准 Chen 模型做了妥协。如需严格符合学术规范,请参考下方说明手动调整。
Tip 结构较复杂时,直接生成的图可能不够整齐。此时:
- 点击 「智能调整」 自动整理——通常此时已足够整齐,仅需微调。
- 若仍不理想,点击 「快速布局」 再配合「智能调整」通常可得到理想效果。
- 极少数情况下,可先手动将矩形(实体)拖到合适位置(其他元素无需调整),再点击「智能调整」即可。
- 实体 / 关系特别多时,可先点击画布左上角的 「隐藏属性」,先把矩形(实体)和菱形(关系)骨架摆到理想位置,再点一次切换回「显示属性」——属性会自动根据当前矩形的位置围绕其均匀分布,避免一上来就被属性干扰拖动。

每次生成 ER 图时都会自动保存一份快照(含缩略图、节点位置、当前显示设置),整理过的布局不会因为重新生成而丢失。

Tip 想撤回上一次手动调整?面板里的「恢复」是按输入文本归档的版本切换,单步撤销 / 重做请用 Ctrl + Z / Ctrl + Y。
欢迎提交 Issue 和 Pull Request!如果这个项目对你有帮助,请点一个 ⭐ Star 支持一下。
本项目基于 GNU AGPL v3.0 开源。
Fetches up-to-date documentation and code examples for libraries, frameworks, SDKs, CLI tools and cloud services, so an AI agent can answer API questions and generate code against current references.
Gives Claude Code skills and agents for writing React documentation on react.dev, covering MDX components, voice and style rules, blog post structure, and interactive Sandpack code examples.
An agent skill that turns complex terminal output into styled HTML pages you actually want to read. Ask your agent to explain a system architecture, review a diff, or compare requirements against a plan.
A WYSIWYG markdown editor so you can edit markdown files like a Google Doc or Notion page, with a desktop app and web UI for navigation, search, and wiki-style linking. It also ships skills for working in codebase wiki, personal CRM, and knowledge base projects.
Turns SQL CREATE TABLE statements or DBML into a Chen-model ER diagram, with options to rearrange the layout or show only the skeleton with attributes hidden. Install it with the command on its page. It includes sql2er. Its skills do not fire on their own yet. Free and open source.
Is this plugin yours?
Claim it with GitHubSubmit a pluginPromote it