Command Palette

Search for a command to run...

Back to skills
skill № 64412

Map Data

Entity-relationship diagram from committed schema declarations (no database connection; Prisma models over Entity Framework fluent mappings over SQL migration…

FreeRuns bundled scripts
melodic-softwareby melodic-software★ 34 GitHub stars

Install Map Data in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

About this skill

Map data

Repository context

The current repository is both the consumer, whose convention home declares where artifacts land, and the default subject, whose tracked files declare the schema.

Collect with an individual Bash call, one command per call: the project root, git rev-parse --show-toplevel. Treat a failure (not a repository, git unavailable) as an unknown value and carry on; ${CLAUDE_PROJECT_DIR} is the resolver's --root either way.

Purpose

Answer "what are the entities and how do they relate" from declarations in the tree. Every entity and every cardinality traces to a named file. The scripts collect and render. Do not draw a box the script did not emit, and do not invent a cardinality the script did not record.

This is not a C4 diagram: an entity-relationship diagram is not one of the C4 views (the record is under Gotchas).

Resolve home and dialect

Read ${CLAUDE_PLUGIN_ROOT}/reference/config.md first. This skill writes into architecture_dir. It does not read landscape_dialect and adds no dialect key: the diagram dialect is diagram_dialect.data from the authoring-formats topic doc.

Run bash "${CLAUDE_PLUGIN_ROOT}/lib/resolve-convention-home.sh" --root "${CLAUDE_PROJECT_DIR}" and resolve architecture_dir per ${CLAUDE_PLUGIN_ROOT}/reference/config.md "Where the config lives" and "Resolution order, per key"; never parse the root instruction file yourself.

Resolve diagram_dialect.data by restating this ladder, then running the resolver rather than parsing the topic doc yourself. The ladder is a resolution order, not a task list:

1. Anchor at the repository root: `${CLAUDE_PROJECT_DIR}` when set, otherwise
   `git rev-parse --show-toplevel`. Never a CWD-relative read.
2. Resolve the convention home `<home>` with the bundled resolver above. Never hand-parse the root
   file.
3. The printed home is repo-relative: join it to the root, then pass
   `<root>/<home>/authoring-formats/README.md` to the resolver.
4. Layer order is one layer deep: an explicit `--dialect` argument, then the team convention doc,
   then the documented default `mermaid`. There is no personal override.
5. Default: `diagram_dialect.data` is `mermaid`. Allowed values are `mermaid` and `dbml`.
6. Degrade soft, and say so. No pointer, no doc, no key, or an unrecognized value each resolve to
   `mermaid`. The resolver names the cause on stderr. Do not hard-fail and do not ask the operator
   to create the surface mid-task.
7. Report provenance: the key, the value, and the layer (`argument`, `team convention doc <path>`,
   or `default`).
bash "${CLAUDE_PLUGIN_ROOT}/lib/resolve-diagram-dialect.sh" --kind data \
  --formats "<root>/<home>/authoring-formats/README.md"

Omit --formats when no convention home resolved. Stdout is mermaid or dbml. An explicit --dialect on the invocation wins and the resolver is not required.

This skill never writes the consumer's root instruction file or its topic doc.

Build the record

"${CLAUDE_SKILL_DIR}/scripts/collect-data.sh" \
  --repo "<subject-repo>" --out "<architecture_dir>/data-model.json" \
  --generated-on "<YYYY-MM-DD|unknown>"

Pass --generated-on from git -C <root> log -1 --format=%cs, or unknown when that fails. Pass --live only when the invocation asked for a live connection: the script opens none, writes a refusal, and does not read the schema.

The record is schema_version 1, one object per line. status is drawn or refused; a refusal names reason and writes no relationships. Shipped tiers, first present wins the diagram:

  • model / prisma. *.prisma model blocks.
  • orm / ef-fluent. A stated subset of one-to-many and one-to-one chains. The chain starts at Entity<T>() or, in a file that declares exactly one class X : IEntityTypeConfiguration<T> (also among several base types), at the Configure builder parameter. HasOne/HasMany take a generic argument or, for one-to-many, a lambda navigation (HasMany(e => e.Posts).WithOne(e => e.Blog), HasOne(e => e.Blog).WithMany(e => e.Posts)); the navigation's target comes from the property declared on the configured entity's class in the scanned .cs files (ICollection, List, IList, IEnumerable or HashSet of one identifier for a collection, T or T? for a reference). HasForeignKey and HasPrincipalKey take one string literal or one single-member lambda. Requiredness is an explicit IsRequired(), IsRequired(true) or IsRequired(false); with none, it is the foreign-key property's declared type on the dependent class: T?, Nullable<T> and string? are optional, and int, uint, long, ulong, short, ushort, byte, sbyte, Guid, DateTime and DateTimeOffset are required.
  • migration / sql-migration. *.sql under a migrations directory at any depth, including one at the repository root, replayed in path order. The readable statements are CREATE TABLE
Full SKILL.md on GitHub

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

  • evals/evals.json
  • scripts/collect-data.sh
  • scripts/collect-data.test.sh
  • scripts/render-data.sh

FAQ

What does the Map Data skill do?

Entity-relationship diagram from committed schema declarations (no database connection; Prisma models over Entity Framework fluent mappings over SQL migration statements, reports disagreements). Use for 'map data', 'ERD', 'entity relationship', schema diagram, cardinality, or which tables relate. Not for deployment, runtime state, or data volume.

How do I install the Map Data skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the Map Data skill run scripts?

Yes, this skill bundles executable scripts. Review the source before installing.

Related skills

Compare Map Data with