Logo vun Dimensional Erd

Dimensional Erd

Organisatioun
astrafy
dimensional-erd

Rules for editing dbt models under `models/datamart/01_core/` so the auto-generated ERD (`erd/output.d2` + `.svg`) stays valid. Use this whenever you add, rename, modify, or touch any model (sql or yml) under `models/datamart/01_core/`, or when the user mentions ERD, relationships, group tags, `generate_erd.py`, or a failing `generate-erd` / `dbt-docs-generate` pre-commit hook. The script hard-fails the commit if a 01_core model is missing a group tag or has more than one — so assume this skill applies by default for any 01_core edit, even if the user doesn't mention the ERD.

Iwwersiicht

Editeurastrafy
Repositoryastrafy-agent-tools
Skill-Nummdimensional-erd
Stären
28
Forks
5
Matgeliwwert Fichieren
Nëmmen Instruktiounen
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    Vum astrafy op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Dimensional Erd an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/astrafy/astrafy-agent-tools/tree/main/skills/dimensional-erd
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/astrafy/astrafy-agent-tools.git /tmp/astrafy-agent-tools
mkdir -p .claude/skills
cp -r /tmp/astrafy-agent-tools/skills/dimensional-erd .claude/skills/dimensional-erd
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Dimensional Erd an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Dimensional Erd automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Dimensional Erd net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

ERD rules for models/datamart/01_core/

The repo auto-generates a conceptual ERD from every model under models/datamart/01_core/ via scripts/generate_erd.py, wired into .pre-commit-config.yaml as two hooks: dbt-docs-generate (refreshes target/catalog.json) and generate-erd (runs the script). Outputs: erd/output.d2 and erd/output.svg.

The script reads manifest.json + catalog.json, then discards dbterd's own relationship detection and redraws arrows purely from each model's meta.relationships. It also groups nodes in the diagram by model tag.

Two contracts must hold for every 01_core model. Violations cause pre-commit to fail (sys.exit) or silently regress the ERD.

Rule 1 — Exactly one group tag

scripts/generate_erd.py defines:

python
GROUP_TAGS = [
    "google_workspace", "finance", "human_resources",
    "project_management", "utils", "dimension",
]

Every model in 01_core must have exactly one of these tags. Zero tags or two tags both cause a hard failure listing the offending models.

Put the tag under config.tags (project convention — matches fct_expenditures.yml, dim_projects.yml, etc.). Example:

yaml
models:
  - name: fct_new_thing
    description: ...
    config:
      tags:
        - finance

The tag does double duty: validation + diagram grouping (each tag becomes a visual cluster in the SVG).

Quick local sanity check before committing:

bash
rg -l '^\s*- (finance|human_resources|project_management|utils|dimension|google_workspace)$' models/datamart/01_core | sort -u

Rule 2 — Declare FK arrows in config.meta.relationships

The ERD's arrows come from config.meta.relationships on the source (FK-holding) model. This is separate from dbt's column-level relationships data test — keep both: one draws the diagram, the other enforces referential integrity.

Shorthand (when FK column name is the same on both sides):

yaml
models:
  - name: fct_employee_absences
    config:
      tags:
        - human_resources
      meta:
        relationships:
          - to: dim_employees
            column: employee_email
            type: many-to-one

Explicit (different column names):

yaml
    config:
      tags:
        - project_management
      meta:
        relationships:
          - to: dim_employees
            from_column: owner_email
            to_column: employee_email
            type: many-to-one

Accepted type values: one-to-one, one-to-many, many-to-one (default), many-to-many. Any other value causes the script to exit with an error.

For nullable FKs, add optional: true to the relationship entry. This switches the target-side arrowhead from the "required" crow's-foot variant to the nullable one (cf-one-required → cf-one, cf-many-required → cf-many) so the diagram reflects that the FK can be null.

yaml
config:
  meta:
    relationships:
      - to: dim_deals
        column: deal_sk_id
        type: many-to-one
        optional: true   # project may have no deal

Default is optional: false. Use it alongside (not instead of) dbt's column-level relationships test — the test should also be marked severity: warn or the column not_null dropped when the FK is nullable.

Working references:

  • models/datamart/01_core/human_resources/fct_employee_absences.yml (shorthand)
  • models/datamart/01_core/project_management/dim_projects.yml (multiple targets)

Regenerating the ERD

After changing relationships, tags, or adding/renaming models, regenerate and commit the outputs:

bash
uv run pre-commit run generate-erd --all-files

This also runs dbt-docs-generate via the hook chain. Fallback if you want to run pieces manually:

bash
uv run dbt docs generate -s path:models/datamart/01_core/
uv run python scripts/generate_erd.py

Stage erd/output.d2 and erd/output.svg along with the model changes.

Troubleshooting

Script outputFix
Models with none of the required group tags ...: [...]Add one tag from GROUP_TAGS under config.tags for each listed model.
Models tagged with more than one group tag: ...Remove the extra group tag; keep exactly one. Non-group tags are fine.
warn: ... -> unknown model \X` (skipped)`Target model isn't in 01_core or was renamed. Update to: or remove the entry.
warn: ... missing column(s) (skipped)Relationship entry lacks column or both from_column+to_column.
error: unknown relationship type \X` on ...`type: isn't one of the four accepted cardinalities — fix it.
error: \d2` not found on PATH`Install d2 locally, or re-run with --no-svg if only the .d2 is needed.

Scope

This skill applies only to models/datamart/01_core/.

Heefeg gestallte Froen

Wat mécht de KI-Skill Dimensional Erd?

Rules for editing dbt models under `models/datamart/01_core/` so the auto-generated ERD (`erd/output.d2` + `.svg`) stays valid. Use this whenever you add, rename, modify, or touch any model (sql or yml) under `models/datamart/01_core/`, or when the user mentions ERD, relationships, group tags, `generate_erd.py`, or a failing `generate-erd` / `dbt-docs-generate` pre-commit hook. The script hard-fails the commit if a 01_core model is missing a group tag or has more than one — so assume this skill applies by default for any 01_core edit, even if the user doesn't mention the ERD.

Firwat Dimensional Erd op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Dimensional Erd besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Dimensional Erd an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/astrafy/astrafy-agent-tools/tree/main/skills/dimensional-erd an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Dimensional Erd benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Dimensional Erd benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Dimensional Erd domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Dimensional Erd gratis?

De Skill gëtt vum astrafy op GitHub publizéiert. Kuckt am Repository no de Lizenzbedéngungen. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇