Логотип Dimensional Erd

Dimensional Erd

Организация
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.

Обзор

Издательastrafy
Репозиторийastrafy-agent-tools
Название навыкаdimensional-erd
Звёзды
28
Форки
5
Файлы в комплекте
Только инструкции
Ссылки
  • Инструкции в формате Markdown

    Модель загружает файл SKILL.md по мере необходимости, поэтому токены расходуются только при подходящем запросе.

  • Работает с любой большой языковой моделью

    Навыки ИИ — это обычный Markdown, а не код для конкретного поставщика, поэтому они работают с GPT, Claude, Gemini, Grok и локальными моделями.

  • Всё необходимое — в инструкциях

    Всё необходимое для модели содержится в инструкциях — никаких дополнительных файлов для синхронизации.

  • Открытый исходный код

    Издатель навыка на GitHub — astrafy. Перед установкой изучите исходные материалы.

Установка

Установите навык ИИ Dimensional Erd в TypingMind, чтобы использовать его с любой LLM, или добавьте его в другой агент, который умеет читать SKILL.md.

1

Установка в TypingMind

TypingMind устанавливает навык прямо из его папки на GitHub: читает SKILL.md, собирает файлы ресурсов и сохраняет результат локально.

  1. Откройте приложение и перейдите в раздел «Плагины → Навыки».
  2. Выберите «Установить из GitHub».
  3. Вставьте указанную ниже ссылку на папку навыка и подтвердите установку.
    https://github.com/astrafy/astrafy-agent-tools/tree/main/skills/dimensional-erd
  4. Включите навык в каждом чате, где хотите его использовать.
Плагины → Навыки → Добавить навык → По ссылке GitHub, затем вставьте ссылку на папку и нажмите «Продолжить».
2

Установка в другом агенте

Любой агент с поддержкой формата Agent Skills может использовать этот навык — скопируйте папку в каталог навыков этого агента.

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
После копирования перезапустите Claude Code, чтобы загрузить новый навык.

Использование в TypingMind

Включите навык Dimensional Erd в любом чате TypingMind, и дальше модель всё сделает сама. Его название и описание хранятся в системном промпте, а при появлении подходящего запроса модель сама загружает полные инструкции. Вам не нужно вызывать навык вручную, и до фактического использования он не расходует токены.

Модель сама загружает навык Dimensional Erd, как только появляется подходящий для него запрос.

Работает с любой моделью ИИ

Навыки ИИ — это обычные инструкции в Markdown, а не код для конкретного поставщика, поэтому навык Dimensional Erd не привязан к модели, для которой он был создан. Установите его один раз в TypingMind и используйте с GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama или локальной моделью, которую запускаете самостоятельно, — со своими ключами API.

  • Загружается только при необходимости

    Системный промпт содержит только название и описание. Инструкции загружаются при первом подходящем запросе, поэтому неиспользуемый навык не расходует токены.

  • Меняйте модели прямо в чате

    Навык состоит из инструкций, а не кода, поэтому смена модели не нарушает его работу: новая модель читает тот же файл SKILL.md.

Инструкции навыка

Это содержимое файла SKILL.md, которое загружает модель. Прочитайте его перед установкой: навык — это инструкции, которым будет следовать ваша модель.

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/.

Часто задаваемые вопросы

Что делает навык ИИ 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.

Зачем использовать Dimensional Erd в TypingMind?

Потому что вы устанавливаете навык один раз и используете его с любой моделью. Dimensional Erd — это обычный текст в формате Markdown, а не код для конкретного поставщика, поэтому один и тот же навык работает с GPT-5, Claude, Gemini, Grok или локальной моделью. Вы можете менять модель прямо во время чата, и навык продолжит работать. TypingMind использует ваши собственные ключи API, поэтому вы платите поставщикам напрямую, а не оформляете подписку с оплатой за каждое место. Ваши навыки и чаты остаются в вашем собственном хранилище.

Как установить Dimensional Erd в TypingMind?

В TypingMind откройте «Плагины → Навыки → Установить из GitHub» и вставьте https://github.com/astrafy/astrafy-agent-tools/tree/main/skills/dimensional-erd. TypingMind прочитает файл SKILL.md и установит навык, который можно включать отдельно для каждого чата.

Какие модели ИИ могут использовать Dimensional Erd?

Любая модель, которую вы подключите в TypingMind. Навыки ИИ — это обычные инструкции в формате Markdown, а не код для конкретного поставщика, поэтому GPT, Claude, Gemini, Grok и локальные модели могут загружать этот навык, когда запрос ему соответствует.

Со сколькими моделями ИИ можно использовать Dimensional Erd?

С любым количеством. В TypingMind вы можете использовать Dimensional Erd с любой моделью, которая поддерживает навыки, в том числе с GPT, Claude, Gemini, Grok, DeepSeek, Mistral и Llama. Для этого вы используете собственные ключи API.

Бесплатен ли навык ИИ Dimensional Erd?

Навык опубликован на GitHub. Издатель — astrafy. Условия лицензии можно найти в репозитории. Вы платите только своему поставщику ИИ за использованные токены.

Что такое навыки ИИ?

Навык ИИ — это набор инструкций, которыми модель ИИ может пользоваться каждый раз, когда ей нужно выполнить конкретную задачу. Он соответствует открытому формату Agent Skills: файл SKILL.md с названием и описанием, а также любые скрипты, шаблоны или справочные файлы, которые могут понадобиться модели. Модель читает инструкции, только когда ваш запрос соответствует навыку, поэтому установленный навык ничего не стоит, пока не используется.

Чем навыки ИИ отличаются от плагинов и серверов MCP?

Плагин или сервер MCP даёт модели новые инструменты, которые она может вызывать: при вызове где-то выполняется код и возвращает результат. Навык ИИ, напротив, даёт модели знания и описывает порядок действий: как подойти к задаче, какие шаги выполнить и каким должен быть хороший результат. Навыки — это обычный текст в формате Markdown, поэтому им не нужны сервер, ключ API или среда выполнения, и они работают с любой моделью.

Все

Создайте своё рабочее пространство с ИИ прямо сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇