# To dbml

> To dbml is an open-source agent skill for databases. Turns ORM models, SQL, a live database or an idea into a validated DBML schema. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/ccomkhj/skills/tree/main/to-dbml
- **Repository:** https://github.com/ccomkhj/skills
- **GitHub stars:** 10
- **License:** MIT
- **Skill name:** to-dbml
- **Collection:** https://github.com/ccomkhj/skills
- **Categories:** [databases](https://ai-powered.com/categories/databases), [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

This skill keeps a DBML entity model of a system as a regenerated snapshot rather than a hand-maintained file. It reads from the first available source in a set order: a live database, SQL DDL or migrations, then ORM model code. For an early-stage idea, it runs a short interview to settle entities, keys, and relationships before drafting.

Each run passes the draft through a gate script that runs the official DBML parser and a set of project conventions, then writes the file. Previous versions are archived with timestamps so changes can be compared over time. A logical variant drops audit and tenancy columns and collapses pure join tables, and a migration mode can describe a change between two schema states.

The skill expects Node.js 18 or newer, and it installs @dbml/core into a cache folder on first run. A read-only dbdiagram.io link can be generated for the output, and the skill can push the diagram to a dbdiagram account when asked.

## When your agent uses it

> Turn ORM models, SQL, a live database, or an idea into a validated, versioned DBML entity model that opens on dbdiagram.io in one click.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Runs JavaScript scripts](https://github.com/ccomkhj/skills/tree/HEAD/to-dbml)
- [No network calls found in its scripts](https://github.com/ccomkhj/skills/tree/HEAD/to-dbml)
- [License: MIT](https://github.com/ccomkhj/skills/tree/HEAD/to-dbml)

## Features

- **Parser-validated output:** Each draft is checked by the official DBML parser and project conventions before it is saved.
- **Versioned snapshots:** The previous file is archived with a timestamp whenever the schema changes.
- **Multiple source readers:** Models can be built from a live database, SQL DDL, migrations, or ORM model code.
- **Logical view:** An optional mode strips audit columns and indexes and collapses join tables for a simpler diagram.
- **Migration diff mode:** Describes the change between two schema states and flags breaking removals.
- **Shareable diagram link:** Generates a read-only dbdiagram.io link and copies the DBML for pasting.

## Good for

- Generate a DBML diagram of my PostgreSQL database
- Convert my ORM models into a DBML schema file
- Show what changes between my branch's schema and main
- Design an entity model for a marketplace idea before coding
- Produce a simplified logical schema diagram without audit columns

## Install

### Claude Code

Copy the skill folder to `~/.claude/skills/to-dbml` to use it in all your projects:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccomkhj/skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/to-dbml &&
cp -R "$tmp/to-dbml" ~/.claude/skills/to-dbml &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/to-dbml` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/to-dbml` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccomkhj/skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/to-dbml &&
cp -R "$tmp/to-dbml" ~/.agents/skills/to-dbml &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/to-dbml` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/to-dbml` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccomkhj/skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/to-dbml &&
cp -R "$tmp/to-dbml" ~/.cursor/skills/to-dbml &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/to-dbml` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/ccomkhj/skills.git --path to-dbml
```

Or copy the folder to `~/.gemini/skills/to-dbml` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/to-dbml`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ccomkhj/skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/to-dbml &&
cp -R "$tmp/to-dbml" ~/.copilot/skills/to-dbml &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/to-dbml` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/ccomkhj/skills.git
```

Then copy `skills/to-dbml` into your agent's skills folder as `to-dbml`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does the skill need to run?

It needs Node.js 18 or newer, and Node 22.14 or newer enables the dbdiagram render check. The first gate run installs @dbml/core into a cache folder.

### Where is the generated file saved?

By default it writes docs/db/schema.dbml, or the existing DBML file's location if the repo already has one. Earlier versions are moved into a versions folder beside it.

### Will my database credentials end up in the file?

No. Hosts, DSNs, users, and passwords are kept out of every file, and row values are not written into the output.

### Is the shared diagram link private?

The link is read-only and needs no account, but the DBML travels inside the link, so anyone holding it can read the schema. Free-plan pushes to dbdiagram are public.

### How do I install To dbml in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/to-dbml to use it in all your projects, or to .claude/skills/to-dbml in one project.

### Does To dbml run scripts?

Yes. It runs JavaScript scripts. No network calls were found in its scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use To dbml?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to To dbml?

The closest alternatives to To dbml are Data archaeology, Db change management, Db migration agent, Miro code explain on board and Database migrations.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Data archaeology](https://ai-powered.com/skills/data-archaeology): Data archaeology is an open-source agent skill for databases.
- [Db change management](https://ai-powered.com/skills/db-change-management): Db change management is an open-source agent skill for databases.
- [Db migration agent](https://ai-powered.com/skills/db-migration-agent): Db migration agent is an open-source agent skill for databases.
- [Miro code explain on board](https://ai-powered.com/skills/miro-code-explain-on-board): Miro code explain on board is an open-source agent skill for developer tools.
- [Database migrations](https://ai-powered.com/skills/database-migrations-nabwinsaud): Database migrations is an open-source agent skill for databases.
- [Domain modeling](https://ai-powered.com/skills/domain-modeling-xd4o): Domain modeling is an open-source agent skill for developer tools.
- [SQL queries](https://ai-powered.com/skills/sql-queries): SQL queries is an open-source agent skill for databases.
- [Crud](https://ai-powered.com/skills/crud): Crud is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/to-dbml
