drizzle-erd
Skill426 starsChanged 39 days agoMITView on GitHub
Use when needing to visualize database schema, generate ERD diagrams from Drizzle ORM schemas, or understand table relationships
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- crawler-scraperSkill
- db-schema-changeSkill
- ui-componentSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 116
Add "nullable" comment if no .notNull()
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Drizzle ERD Generator
Generate Mermaid ERD diagrams from Drizzle ORM schema files.
When to Use
- Database schema visualization needed
- Understanding table relationships
- Documentation for DB structure
- PR review of schema changes
Process
- Find schema files - Locate Drizzle table definitions (usually
schema.tsortables.ts) - Parse tables - Extract table names, columns, types, and constraints
- Identify relations - Find
.references()calls and relations definitions - Generate Mermaid - Output ERD in Mermaid syntax
Mermaid ERD Syntax
erDiagram
TABLE_NAME {
type column_name PK "Primary Key"
type column_name FK "Foreign Key"
type column_name UK "Unique"
type column_name "nullable"
}
TABLE_A ||--o{ TABLE_B : "has many"
TABLE_A ||--|| TABLE_C : "has one"
TABLE_A }o--|| TABLE_D : "belongs to"Relationship Notation
| Symbol | Meaning |
|| | Exactly one |
o| | Zero or one |
}o | Zero or many |
}| | One or many |
Type Mapping
| Drizzle | Mermaid |
text() | string |
integer() | int |
real() | float |
blob() | blob |
boolean mode | boolean |
Output Template
erDiagram
%% Master Tables
%% Transaction Tables
%% Snapshot Tables
%% RelationsExample
From Drizzle:
export const users = sqliteTable("users", {
id: integer("id").primaryKey(),
name: text("name").notNull(),
email: text("email").unique(),
});
export const posts = sqliteTable("posts", {
id: integer("id").primaryKey(),
userId: integer("user_id").references(() => users.id),
title: text("title").notNull(),
});To Mermaid:
erDiagram
users {
int id PK
string name
string email UK
}
posts {
int id PK
int user_id FK
string title
}
users ||--o{ posts : "has many"Quick Reference
Column Markers
PK- primaryKey()FK- .references()UK- .unique()- Add "nullable" comment if no .notNull()
Grouping
Group related tables with Mermaid comments:
%% === Master Tables ===
%% === Transaction Tables ===Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

