agentleFS
hiroppyhiroppy/mf-dashboard/.agents/skills/drizzle-erd/SKILL.md

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

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
  1. Distinctive:

    Add "nullable" comment if no .notNull()

    line 116

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Find schema files - Locate Drizzle table definitions (usually schema.ts or tables.ts)
  2. Parse tables - Extract table names, columns, types, and constraints
  3. Identify relations - Find .references() calls and relations definitions
  4. 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

SymbolMeaning
||Exactly one
o|Zero or one
}oZero or many
}|One or many

Type Mapping

DrizzleMermaid
text()string
integer()int
real()float
blob()blob
boolean modeboolean

Output Template

erDiagram
    %% Master Tables

    %% Transaction Tables

    %% Snapshot Tables

    %% Relations

Example

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 ===

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.