agentleFS
khuynh22khuynh22/agent-dev-team/skills/data-modeling/SKILL.md

data-modeling

Skill9 starsChanged 2 months agoMITView on GitHub

Designs the warehouse tables analysts read: grain declared before any column, staging and mart layers kept apart, one home per metric definition, slowly changing dimensions that keep their history, a uniqueness test on every key, and reconciliation against a total somebody already believes. Use when building or refactoring a dbt or SQL transformation, when a join fans out, or when one metric is computed three different ways.

16 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use containerization, observability and 2 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • mmondoraSkill

    containerization

    Docker best practices for cloud-native applications. Multi-stage builds, distroless images, security scanning, non-root users, Cloud Run orchestration. Use when writing Dockerfiles, configuring container builds, or deploying to Cloud Run/GKE.

    Also in 3 projects that use this

  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 6 projects that use this

  • ElasticSkill

    accessibility

    Accessibility guidance for Kibana. Use this skill when working with or reviewing EUI components, resolving a11y-related (@elastic/eui) ESLint issues, and ensuring proper use of ARIA attributes, focus management, keyboard interactions, and accessible naming conventions.

    Also in 5 projects that use this

  • Microsoft AzureSkill

    git-workflow

    Squad branching model: dev-first workflow with insiders preview channel

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 5

    Distinctive

    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:

    Document the columns that will be misread: Not all of them: the ones whose name promises something the definition does not deliver.

    line 52
  2. Distinctive:

    Write the numerator, the denominator, the time grain, the time zone, and what is excluded: internal accounts, bots, refunds, test records.

    line 60
  3. Distinctive:

    If two teams need different definitions, they need two names.

    line 64
  4. Distinctive:

    Every join key has a referential integrity test.

    line 86
  5. Distinctive:

    No metric defined here exists elsewhere under a different definition.

    line 88

“Common” is measured: kept by at least 6 in 10 of the 15 edited versions of this file we could read. “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

Data Modeling

A model is a claim about shape: one row per this, keyed by that, meaning exactly this. Most modelling bugs are a grain nobody wrote down, discovered later as a number that is quietly double what it should be.

Standing reference: references/data-quality-checklist.md.

Process

  1. Declare the grain in the first line of the model. "One row per subscription per billing period." Every column decision follows from it, and the uniqueness test that guards it comes free once it is written.
  2. Search for the metric before defining it. Grep the transformation project, then the dashboards. If "active user" already exists, use it or replace it. Forking it produces two numbers that both cite the warehouse and disagree in a meeting.
  3. Keep the layers honest.
    • Staging: rename, cast, deduplicate. One staging model per source table. No joins, no business logic, because logic here leaks into every consumer that follows.
    • Intermediate: the joins and the reshaping, where fan-out is possible and therefore tested.
    • Mart: what people query, named in their language, documented.
  4. Choose the history behaviour deliberately. Type 1 overwrites, and silently rewrites every historical report that reads the dimension by date. Type 2 keeps a row per version with valid-from and valid-to. Pick one, write which, and be able to say why.
  5. Test the key before anything else. Uniqueness and not-null on the declared grain. Then referential integrity on every join key, accepted values on every enum, and a not-null on the columns people filter by.
  6. Check fan-out at every join. Row count before and after, with the expected relationship stated. A join that silently multiplies rows is the most common way a correct-looking model doubles revenue.
  7. Reconcile against something already believed. The source table total, the previous dashboard, the billing system. Quote both numbers. An unreconciled model is a hypothesis with a schedule.
  8. Document the columns that will be misread. Not all of them: the ones whose name promises something the definition does not deliver.

Metric definitions

One definition, one place, and it includes the denominator and the exclusions. A metric definition is a contract with everyone who quotes the number, so:

  • Write the numerator, the denominator, the time grain, the time zone, and what is excluded: internal accounts, bots, refunds, test records.
  • Changing a published definition is a breaking change. Version it, announce it, and give the old number a name rather than silently rewriting history.
  • If two teams need different definitions, they need two names. Never one name and a footnote.

Output

## Model: <name>

- **Grain:** one row per <X>
- **Key:** <cols> — uniqueness test result quoted
- **Layer:** staging | intermediate | mart · depends on <models>
- **Metrics defined:** <name> = <numerator> / <denominator>, excluding <list>
- **History:** type 1 | type 2 on <cols>, valid-from/valid-to <cols>
- **Fan-out check:** <n> rows in, <n> rows out, expected <relationship>
- **Reconciled against:** <source> — <both totals>
- **Tests:** <list>, output quoted

Verification

  • The uniqueness test on the declared grain ran and passed; quote it.
  • Row count and one summed measure reconcile with the source; both numbers quoted.
  • Every join key has a referential integrity test.
  • The whole project builds, not only the changed model.
  • No metric defined here exists elsewhere under a different definition. Say where you looked.

Red flags

ThoughtReality
"The grain is obvious"Then it costs one line to write, and it prevents the duplicate nobody catches.
"I will add my own version of the metric"Two dashboards now disagree and both cite the warehouse.
"The join looked right in the preview"Twenty rows preview fine and fan out at scale. Test the key.
"It matches roughly"Roughly means it does not match. Find the difference first.
"I will just overwrite the dimension"Every historical report that reads it by date has now changed.
"Logic in the dashboard ships faster"And is invisible to everyone who queries the model instead.
"Tests slow the build"Less than explaining a wrong number to whoever acted on it.

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.