claude-init: Skill for Claude Code

.claude/skills/generate-db-diagram/SKILL.md

generate-db-diagram is a skill for Claude Code from Flexonze/claude-init. It costs 11 tokens per session (757 once invoked), scanned A, original, MIT.

A skill that creates a Mermaid class diagram, a text-based diagram format, for the database tables or models related to a feature.

In plain words
What is it for?
Use it to find relevant schema definitions in a codebase and diagram key fields plus one-to-one, one-to-many, or many-to-many relationships.
Why use it?
It makes the important data structures and their relationships easier to understand without showing the whole database.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

This is Flexonze/claude-init's own configuration. It tells Claude Code how to work on claude-init itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-init configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Flexonze/claude-init. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Flexonze/claude-init/main/.claude/skills/generate-db-diagram/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/Flexonze/claude-init

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for generate-db-diagram

README.md
[![agentmods](https://agentmods.dev/badge/skills/flexonze/claude-init/generate-db-diagram.svg)](https://agentmods.dev/skills/flexonze/claude-init/generate-db-diagram)
Your own site
<a href="https://agentmods.dev/skills/flexonze/claude-init/generate-db-diagram"><img src="https://agentmods.dev/badge/skills/flexonze/claude-init/generate-db-diagram.svg" alt="Measured on agentmods" height="20"></a>
Per session 11 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 757 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00011 $0.00757
Opus 5 $0.00005 $0.00378
Sonnet 5 $0.00002 $0.00151
Haiku 4.5 $0.00001 $0.00076

Measured 8d ago against content hash 03a0b8702c8f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

generate-db-diagram scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/generate-db-diagram/SKILL.md · 104 lines

How it starts

The opening of the file, as written. The whole thing — 104 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Generate Database Diagram

Generate a Mermaid class diagram representing the database schema related to: $ARGUMENTS

Instructions

1. Identify Relevant Models/Tables

Search the codebase for models, entities, or schema definitions related to the specified feature.

Guidelines
  • Focus on the core tables/models needed to understand the feature's data structure
  • If a feature has many related models, prioritize the most important ones
  • If uncertain about which models to include, err on the side of including related models
  • Search thoroughly through the codebase to find all relevant schema definitions

2. Generate Mermaid Diagram

Follow these rules:

  • Use Mermaid class diagram syntax
  • Include only models directly related to the feature
  • Show only important fields (exclude: id, created_at, updated_at, timestamps unless critical)
  • Do NOT include field types UNLESS it's a relationship field
  • For relationship fields, show them as:
    • FK to ModelName (foreign key / belongs to)
    • O2O to ModelName (one-to-one)
    • M2M to ModelName (many-to-many)
  • Show relationships between models using Mermaid relationship syntax:
    • Model1 "1" --> "many" Model2 : relationship_name
    • Model1 "1" --> "1" Model2 : relationship_name
    • Model1 "many" --> "many" Model2 : relationship_name
  • Keep it clean and focused on the feature's data structure
Example Output
classDiagram
    class Project {
        name
        description
        status
        owner FK to User
    }

    class Task {
        title
        completed
        project FK to Project
        assignee FK to User
    }

    class User {
        email
        name
    }

    Task "many" --> "1" Project : project
    Task "many" --> "1" User : assignee
    Project "many" --> "1" User : owner

3. Generate the Diagram Image

  • Create a PNG image: .claude/outputs/db-diagram-<feature-name>.png (use kebab-case)
  • Create the .claude/outputs/ directory with a .gitkeep if it doesn't exist
  • No temporary files needed - pipe directly to mermaid-cli

Read the full file on GitHub · 104 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 104 lines · 11 tokens per session scan A 03a0b8702c8f

Subscribe to this mod's changes

generate-db-diagram is a skill published in the GitHub repository Flexonze/claude-init (10 stars, last pushed 5mo ago), licensed MIT. It adds 11 tokens to every session and 757 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

add-sample-data

Use when the user wants to seed Dataverse tables with realistic sample records so a freshly-scaffolded code app shows real-looking data on first launch. Generates contextually appropriate rows from each table's schema and inserts them in dependency order. Mirrors…

microsoft/power-platform-skills · 72 tokens

setup-datamodel

Use when the user wants to design or redesign the Dataverse schema and connector plan for an existing mobile app, or has an ER diagram (image, Mermaid, or text) to apply. Skip when the user is creating a brand-new app — /create-mobile-app handles the data model inline.

microsoft/power-platform-skills · 64 tokens

add-dataverse

Adds Dataverse tables to a Power Apps code app with generated TypeScript models and services. Can also create new Dataverse tables. Use when connecting to Dataverse, adding tables, creating schema, or querying Dataverse data.

microsoft/power-platform-skills · 50 tokens

jpa-patterns

JPA/Hibernate patterns and common pitfalls (N+1, lazy loading, transactions, queries). Use when user has JPA performance issues, LazyInitializationException, or asks about entity relationships and fetching strategies.

decebals/claude-code-java · 47 tokens

ecto-patterns

Ecto patterns — schemas, changesets, queries, migrations, Multi, associations, preloads, upserts. Use when editing Repo calls, Ecto.Query, or schema fields. Skip for Ash.

oliver-kriska/claude-elixir-phoenix · 45 tokens

phoenix-contexts

Phoenix context design — creating/splitting contexts, Scope (1.8+), Ecto.Multi, PubSub, routers, plugs, controllers. Use when editing contexts, routers, or designing boundaries.

oliver-kriska/claude-elixir-phoenix · 46 tokens