Builds analytics engineering layers for metrics, contracts, and BI-ready models. Use when shaping dbt or SQLMesh marts, metric governance, lineage, or data quality.
Code-defined marts, metrics as APIs, contracts on critical interfaces, semantic layers only where they improve reuse or AI/BI consumption, and metadata systems that expose owners, lineage, quality, and governance to both humans and agents.
Primary sources: data/sources.json. Refresh time-sensitive claims against official docs before giving definitive recommendations.
When to Use
Choose or improve an analytics engineering stack (dbt, SQLMesh, Coalesce)
Define marts, grains, dimensions, facts, wide tables, or activity schemas
Design or migrate a semantic layer (dbt Semantic Layer, Lightdash, Cube, warehouse-native)
Add data contracts, metric governance, ownership, catalogs, and lineage
Build data quality checks, freshness monitoring, anomaly detection, and release gates
Prepare BI-ready models for dashboards, notebooks, APIs, or AI/NLQ analytics
Anchors the Open Semantic Interchange (OSI) v1.0 spec (Jan 2026) with Snowflake, Databricks, Salesforce, ThoughtSpot, Atlan, Alation, Denodo
SQLMesh
Contributed to Linux Foundation by Fivetran (announced March 25, 2026, KubeCon EU); Apache 2.0
Fivetran acquired SQLMesh's creator, Tobiko Data, in Sept 2025; founding LF members include Benzinga, CloudKitchens, Harness, Infinite Lambda, Jump AI, Minerva
Verify GA/preview status per adapter before recommending a Fusion cutover — it changes monthly; treat the table above as directional, not a substitute for the Fusion availability page.
Default Workflow
Lock the metric contract first — define KPI names, business logic, grain, owner, and dimensions in assets/metric-dictionary.md
Choose one transformation baseline — standardize on dbt or SQLMesh before debating semantic-layer tooling (references/tool-comparison.md)
Model for consumption — build staging -> intermediate -> marts layers, pick final shape (star, wide, or activity schema) with references/modeling-patterns.md
Add contracts on critical interfaces — enforce schema, ownership, freshness, and quality expectations (references/contracts-catalogs-lineage.md)
Choose semantic serving only where it pays off — use references/semantic-layer-patterns.md to decide between dbt-native, Lightdash, Cube, or warehouse-native
Publish discoverability and governance — catalog assets, lineage, owners, and change notices (references/metric-governance.md and assets/ownership-catalog-worksheet.md)
Decision: Choose Transformation Baseline
What does your team care about most?
Plan-based deployment, environment isolation, backfill control
-> SQLMesh (now Linux Foundation / Apache 2.0)
Broadest ecosystem, contracts, semantic layer, dbt-native CI
-> dbt (Core v2 alpha or dbt platform with Fusion)
Visual metadata-driven development, enterprise onboarding speed
-> Coalesce
Already on dbt and want faster compile + typed SQL
-> Upgrade to dbt Fusion (GA on Snowflake; preview elsewhere)
Decision: Add a Semantic Layer?
Are the same business metrics reimplemented in 3+ places?
NO -> Governed marts only; revisit when the answer flips to YES
YES ->
Most consumers are dbt-native?
YES -> dbt Semantic Layer (MetricFlow) or Lightdash
Need embedded analytics or product-facing APIs?
YES -> Cube
Single warehouse platform?
Snowflake -> Snowflake Semantic Views
Databricks -> Unity Catalog Metric Views
Consumers need a business-friendly metric catalog as much as a query layer?
YES -> Lightdash (or semantic layer + OpenMetadata/DataHub catalog)
Anomaly monitoring shows no new alerts post-deploy
SQLMesh projects (PR/preview checks):
sqlmesh plan --no-prompts dev
sqlmesh test
sqlmesh audit --models state:modified+
Plan diff reviewed before apply
Unit tests pass locally (no warehouse compute consumed)
Audits pass on changed models
Forward-only or backfill scope confirmed before deploy
Operating Principles
Metrics are APIs — stable names, clear owners, versioned changes, explicit deprecation windows; do not change KPI semantics silently.
One model, one grain — a mart must have one unambiguous grain; create a separate model for a different grain instead of mixing.
Contracts on shared interfaces — required for executive marts, handoff tables, and models used by many teams; do not contract every transient staging model.
Semantic layers are optional — add when multiple consumers need governed reuse, NLQ/AI access, or product-grade metric APIs; skip when well-governed marts are enough.
Metadata serves humans and agents — require descriptions, owners, lineage, quality status, and access boundaries on high-value assets.
Common Anti-Patterns
Anti-Pattern
Root Cause
Fix
KPI logic in dashboards or notebooks
No governed mart
Define in mart or semantic model first
Multiple grains in one mart
Dashboard convenience
Create separate models per grain
Contracts on every staging model
Misapplied governance
Contract only shared, high-stakes interfaces
Semantic layer before marts are stable
Premature abstraction
Stabilize marts before defining entities/measures
Same 360 table for every request
No modeling discipline
One model, one grain, one purpose
Allowing AI/NLQ access to undocumented marts
Missing metadata
Require grain, owner, freshness contract before AI access
Known Traps
Slowly changing dimensions leaking into KPI joins and silently changing historical numbers.
Metric refactors that change semantics without a notice, owner sign-off, or deprecation window.
Identity stitching, attribution, and semantic metrics coexisting without explicit precedence rules.
Assuming a semantic layer removes the need for release discipline, data tests, and change communication.
Fan-out duplication: joining a fact to a dimension with a hidden one-to-many relationship (e.g. multiple addresses per customer, multiple attribution touches per order) silently multiplies additive measures. Check row counts before and after every join added to a mart, not just at the end.
Non-additive measures in semantic layers: ratios, distinct counts, and percentiles do not roll up by simple summation across dimensions. A semantic layer that lets consumers slice a pre-computed ratio by a new dimension will produce a plausible but wrong number unless the measure is defined to recompute from its base components at query time.
SCD Type 2 joins without effective-dating: joining a fact table to a dimension's current row (instead of the row valid at the fact's event time) rewrites history every time a dimension attribute changes — a common source of "the numbers changed even though nothing happened this month."
Backfills without idempotency: a backfill or reprocessing job that appends instead of replacing (or lacks a natural dedup key) creates silent double-counting that structural uniqueness tests may not catch if the test only runs on the latest partition.
Timezone/DST drift in freshness SLAs: freshness windows defined in wall-clock local time break twice a year and near midnight UTC boundaries; define freshness thresholds in UTC and treat calendar-day grain as a modeling decision, not an accident of the source system's timestamp.
Simpson's paradox in aggregated KPIs: an org-wide metric can move in the opposite direction of every underlying segment when segment mix shifts; before alerting on a KPI's overall trend, check whether segment-level trends actually agree with it.
Scripts
Script
Purpose
scripts/analytics_linter.py
Validate, lint, and health-score a metric dictionary JSON file
Prefer trust_tier: primary entries in data/sources.json for vendor capabilities, syntax, pricing, limits, and release-sensitive recommendations.
For recommendation questions, refresh against current official docs and recent release notes.
Separate verified facts from judgment calls; label strategic opinions explicitly.
If web access is unavailable, state that the recommendation is partially unverified.
Fact-Checking
Use web search/web fetch to verify current external facts, versions, pricing, deadlines, or platform behavior before final answers.
Prefer primary sources; report source links and dates for volatile information.
Learnings Loop
Before applying this skill on a non-trivial task, read learnings.consolidated.md in this directory (and learnings.md if present).
After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to learnings.md via agents-skills-feedback-loop/scripts/append_learning.py. Do not modify SKILL.md itself.
1---2name: data-analytics-engineering3description: Builds analytics engineering layers for metrics, contracts, and BI-ready models. Use when shaping dbt or SQLMesh marts, metric governance, lineage, or data quality.4---56# Data Analytics Engineering
78Code-defined marts, metrics as APIs, contracts on critical interfaces, semantic layers only where they improve reuse or AI/BI consumption, and metadata systems that expose owners, lineage, quality, and governance to both humans and agents.
910Primary sources: `data/sources.json`. Refresh time-sensitive claims against official docs before giving definitive recommendations.
1112## When to Use
1314- Choose or improve an analytics engineering stack (`dbt`, `SQLMesh`, `Coalesce`)
15- Define marts, grains, dimensions, facts, wide tables, or activity schemas
16- Design or migrate a semantic layer (`dbt Semantic Layer`, `Lightdash`, `Cube`, warehouse-native)
17- Add data contracts, metric governance, ownership, catalogs, and lineage
18- Build data quality checks, freshness monitoring, anomaly detection, and release gates
19- Prepare BI-ready models for dashboards, notebooks, APIs, or AI/NLQ analytics
2021## When NOT to Use
2223- Lakehouse or ingestion architecture -> [data-lake-platform](../data-lake-platform/SKILL.md)
24- Product/event instrumentation, attribution, or identity resolution -> `marketing-product-analytics`
25- OLTP tuning, indexes, locks, or transactional database operations -> [data-sql-optimization](../data-sql-optimization/SKILL.md)
26- Metabase API automation -> [data-metabase](../data-metabase/SKILL.md)
27- ML feature engineering, experiments, or model evaluation -> [ai-ml-data-science](../ai-ml-data-science/SKILL.md)
2829## Triage Checklist
3031Run through these before any recommendation:
3233- [ ] What are the canonical business metrics and who owns each one?
34- [ ] Serving requirements: dashboards, notebooks, APIs, embedded analytics, or AI/NLQ?
35- [ ] Transformation baseline: `dbt`, `SQLMesh`, visual tooling, or warehouse SQL only?
36- [ ] Which datasets are contract-worthy (downstream consumers depend on schema, freshness, semantics)?
37- [ ] Semantic layer needed, or are well-governed marts sufficient today?
38- [ ] Which metadata systems already cover catalog, lineage, ownership, access, and quality?
3940## Stack Status (July 2026)
4142| Tool | Status | Key 2026 Fact |
43|------|--------|---------------|
44| dbt Core | v2.0 in alpha; open source, Apache 2.0, built on Fusion foundations | [Upgrade guide](https://docs.getdbt.com/docs/dbt-versions/core-upgrade/upgrading-to-v2) |
45| dbt Fusion | GA on Snowflake (dbt platform); preview on BigQuery/Redshift; private preview on Databricks; no GA date confirmed yet | New dbt-platform projects default to Fusion; local/CLI Fusion still preview across adapters |
46| dbt + SDF | SDF Labs acquired Jan 2025; Rust SQL compiler is now the Fusion engine | Enables column-level lineage and typed SQL |
47| MetricFlow | Open sourced Apache 2.0 (Oct 2025, v0.209+); latest v0.211 (May 12, 2026) | Anchors the Open Semantic Interchange (OSI) v1.0 spec (Jan 2026) with Snowflake, Databricks, Salesforce, ThoughtSpot, Atlan, Alation, Denodo |
48| SQLMesh | Contributed to Linux Foundation by Fivetran (announced March 25, 2026, KubeCon EU); Apache 2.0 | Fivetran acquired SQLMesh's creator, Tobiko Data, in Sept 2025; founding LF members include Benzinga, CloudKitchens, Harness, Infinite Lambda, Jump AI, Minerva |
4950Verify GA/preview status per adapter before recommending a Fusion cutover — it changes monthly; treat the table above as directional, not a substitute for the [Fusion availability page](https://docs.getdbt.com/docs/fusion/fusion-availability).
5152## Default Workflow
53541. **Lock the metric contract first** — define KPI names, business logic, grain, owner, and dimensions in `assets/metric-dictionary.md`
552. **Choose one transformation baseline** — standardize on `dbt` or `SQLMesh` before debating semantic-layer tooling (`references/tool-comparison.md`)
563. **Model for consumption** — build `staging -> intermediate -> marts` layers, pick final shape (star, wide, or activity schema) with `references/modeling-patterns.md`
574. **Add contracts on critical interfaces** — enforce schema, ownership, freshness, and quality expectations (`references/contracts-catalogs-lineage.md`)
585. **Choose semantic serving only where it pays off** — use `references/semantic-layer-patterns.md` to decide between dbt-native, Lightdash, Cube, or warehouse-native
596. **Add release-safe quality controls** — static tests, freshness, audits, anomaly monitoring (`references/data-quality-testing.md` and `references/release-and-ci-patterns.md`)
607. **Publish discoverability and governance** — catalog assets, lineage, owners, and change notices (`references/metric-governance.md` and `assets/ownership-catalog-worksheet.md`)
6162## Decision: Choose Transformation Baseline
6364```text
65What does your team care about most?
66 Plan-based deployment, environment isolation, backfill control
67 -> SQLMesh (now Linux Foundation / Apache 2.0)
68 Broadest ecosystem, contracts, semantic layer, dbt-native CI
69 -> dbt (Core v2 alpha or dbt platform with Fusion)
70 Visual metadata-driven development, enterprise onboarding speed
71 -> Coalesce
72 Already on dbt and want faster compile + typed SQL
73 -> Upgrade to dbt Fusion (GA on Snowflake; preview elsewhere)
74```
7576## Decision: Add a Semantic Layer?
7778```text
79Are the same business metrics reimplemented in 3+ places?
80 NO -> Governed marts only; revisit when the answer flips to YES
81 YES ->
82 Most consumers are dbt-native?
83 YES -> dbt Semantic Layer (MetricFlow) or Lightdash
84 Need embedded analytics or product-facing APIs?
85 YES -> Cube
86 Single warehouse platform?
87 Snowflake -> Snowflake Semantic Views
88 Databricks -> Unity Catalog Metric Views
89 Consumers need a business-friendly metric catalog as much as a query layer?
90 YES -> Lightdash (or semantic layer + OpenMetadata/DataHub catalog)
91```
9293## Quick Reference
9495| Task | Resource | When to Load |
96|------|----------|-------------|
97| Choose dbt vs SQLMesh vs Coalesce | `references/tool-comparison.md` | New stack selection or migration |
98| Pick star vs wide vs activity schema | `references/modeling-patterns.md` | Designing marts and semantic boundaries |
99| Decide whether to add a semantic layer | `references/semantic-layer-patterns.md` | Metrics reuse, NLQ, API, or BI serving |
100| Add contracts, ownership, lineage, catalog | `references/contracts-catalogs-lineage.md` | Shared marts and governed datasets |
101| Add tests, audits, anomaly checks, CI gates | `references/data-quality-testing.md` | Prevent regressions and stale data |
102| Define metric lifecycle and deprecation | `references/metric-governance.md` | Executive metrics and shared KPI programs |
103| Plan rollout, dual-run, backfills | `references/release-and-ci-patterns.md` | Safe deployment and migration |
104| PII separation, vault pattern, pseudonymisation | `references/pii-vault-and-pseudonymisation.md` | LLM/AI-facing query surfaces or GDPR scope |
105| Draft metric definitions | `assets/metric-dictionary.md` | New KPIs or metric refactors |
106| Draft semantic layer design | `assets/semantic-layer-spec.md` | Serving layer design review |
107| Draft quality coverage | `assets/data-quality-test-plan.md` | Model-by-model test planning |
108| Communicate metric changes | `assets/metric-change-notice.md` | Breaking or non-breaking metric updates |
109| Document owners and catalog fields | `assets/ownership-catalog-worksheet.md` | Governance and discoverability setup |
110| Migrate to a semantic layer | `assets/semantic-layer-migration-checklist.md` | Ad-hoc SQL to governed metrics |
111| Handle data quality incidents | `assets/data-quality-incident-runbook.md` | Failures, stale data, or contract breaks |
112113## CI/CD Quality Gate Checklist
114115**dbt projects (PR checks):**
116117```bash
118dbt deps
119dbt parse
120dbt build --select state:modified+
121```
122123- [ ] No contracted model failures
124- [ ] Freshness checks pass for critical sources
125- [ ] Comparison queries run for executive KPI changes
126- [ ] Schema tests pass on all mart models
127- [ ] Anomaly monitoring shows no new alerts post-deploy
128129**SQLMesh projects (PR/preview checks):**
130131```bash
132sqlmesh plan --no-prompts dev
133sqlmesh test
134sqlmesh audit --models state:modified+
135```
136137- [ ] Plan diff reviewed before `apply`
138- [ ] Unit tests pass locally (no warehouse compute consumed)
139- [ ] Audits pass on changed models
140- [ ] Forward-only or backfill scope confirmed before deploy
141142## Operating Principles
1431441. **Metrics are APIs** — stable names, clear owners, versioned changes, explicit deprecation windows; do not change KPI semantics silently.
1452. **One model, one grain** — a mart must have one unambiguous grain; create a separate model for a different grain instead of mixing.
1463. **Contracts on shared interfaces** — required for executive marts, handoff tables, and models used by many teams; do not contract every transient staging model.
1474. **Semantic layers are optional** — add when multiple consumers need governed reuse, NLQ/AI access, or product-grade metric APIs; skip when well-governed marts are enough.
1485. **Metadata serves humans and agents** — require descriptions, owners, lineage, quality status, and access boundaries on high-value assets.
149150## Common Anti-Patterns
151152| Anti-Pattern | Root Cause | Fix |
153|---|---|---|
154| KPI logic in dashboards or notebooks | No governed mart | Define in mart or semantic model first |
155| Multiple grains in one mart | Dashboard convenience | Create separate models per grain |
156| Contracts on every staging model | Misapplied governance | Contract only shared, high-stakes interfaces |
157| Semantic layer before marts are stable | Premature abstraction | Stabilize marts before defining entities/measures |
158| Same 360 table for every request | No modeling discipline | One model, one grain, one purpose |
159| Allowing AI/NLQ access to undocumented marts | Missing metadata | Require grain, owner, freshness contract before AI access |
160161## Known Traps
162163- Slowly changing dimensions leaking into KPI joins and silently changing historical numbers.
164- Metric refactors that change semantics without a notice, owner sign-off, or deprecation window.
165- Identity stitching, attribution, and semantic metrics coexisting without explicit precedence rules.
166- Assuming a semantic layer removes the need for release discipline, data tests, and change communication.
167- **Fan-out duplication**: joining a fact to a dimension with a hidden one-to-many relationship (e.g. multiple addresses per customer, multiple attribution touches per order) silently multiplies additive measures. Check row counts before and after every join added to a mart, not just at the end.
168- **Non-additive measures in semantic layers**: ratios, distinct counts, and percentiles do not roll up by simple summation across dimensions. A semantic layer that lets consumers slice a pre-computed ratio by a new dimension will produce a plausible but wrong number unless the measure is defined to recompute from its base components at query time.
169- **SCD Type 2 joins without effective-dating**: joining a fact table to a dimension's current row (instead of the row valid at the fact's event time) rewrites history every time a dimension attribute changes — a common source of "the numbers changed even though nothing happened this month."
170- **Backfills without idempotency**: a backfill or reprocessing job that appends instead of replacing (or lacks a natural dedup key) creates silent double-counting that structural uniqueness tests may not catch if the test only runs on the latest partition.
171- **Timezone/DST drift in freshness SLAs**: freshness windows defined in wall-clock local time break twice a year and near midnight UTC boundaries; define freshness thresholds in UTC and treat calendar-day grain as a modeling decision, not an accident of the source system's timestamp.
172- **Simpson's paradox in aggregated KPIs**: an org-wide metric can move in the opposite direction of every underlying segment when segment mix shifts; before alerting on a KPI's overall trend, check whether segment-level trends actually agree with it.
173174## Scripts
175176| Script | Purpose |
177|--------|---------|
178| `scripts/analytics_linter.py` | Validate, lint, and health-score a metric dictionary JSON file |
179180```bash
181# Validate required fields, duplicate names, and undefined data sources
182python scripts/analytics_linter.py validate --input data/valid-metric-dictionary.json
183184# Lint metric quality: missing owners, undocumented dimensions, naming, SLAs
185python scripts/analytics_linter.py lint --input data/valid-metric-dictionary.json
186187# Generate a Markdown metric dictionary health report
188python scripts/analytics_linter.py report \
189 --input data/sample-metric-dictionary.json \
190 --output metric-health-report.md
191```
192193## Data
194195| File | Description |
196|------|-------------|
197| `data/sources.json` | Curated reference sources for this skill |
198| `data/valid-metric-dictionary.json` | Production-valid 15-metric dictionary for smoke tests and quickstart examples |
199| `data/sample-metric-dictionary.json` | Realistic 15-metric dictionary with intentional gaps for linting demos |
200201## Navigation
202203| File | Load When |
204|------|-----------|
205| [references/tool-comparison.md](references/tool-comparison.md) | Choosing or comparing dbt, SQLMesh, Coalesce, or semantic-layer tools |
206| [references/modeling-patterns.md](references/modeling-patterns.md) | Designing mart layers, grain, star/wide/activity schemas |
207| [references/semantic-layer-patterns.md](references/semantic-layer-patterns.md) | Deciding on and implementing a semantic serving layer |
208| [references/contracts-catalogs-lineage.md](references/contracts-catalogs-lineage.md) | Adding data contracts, catalog metadata, and lineage on shared assets |
209| [references/data-quality-testing.md](references/data-quality-testing.md) | Building test suites, freshness checks, and anomaly monitoring |
210| [references/metric-governance.md](references/metric-governance.md) | Governing, versioning, and deprecating shared KPIs |
211| [references/release-and-ci-patterns.md](references/release-and-ci-patterns.md) | CI/CD pipelines, dual-run validation, backfills, safe cutovers |
212| [references/pii-vault-and-pseudonymisation.md](references/pii-vault-and-pseudonymisation.md) | Separating PII from analytical facts for LLM/AI or GDPR-scoped surfaces |
213| [references/causal-inference-applied.md](references/causal-inference-applied.md) | DAG-driven feature selection, DML, observational ATE estimation |
214| [references/information-theory-applied.md](references/information-theory-applied.md) | MI feature selection, KL drift detection, MDL clustering |
215| [references/theory-of-constraints-applied.md](references/theory-of-constraints-applied.md) | Pipeline lag isolation, capacity reallocation, approval-queue debug |
216| [references/network-science-applied.md](references/network-science-applied.md) | Centrality, PageRank, community detection applied to lineage graphs |
217218## Templates
219220- `assets/metric-dictionary.md`
221- `assets/semantic-layer-spec.md`
222- `assets/data-quality-test-plan.md`
223- `assets/metric-change-notice.md`
224- `assets/ownership-catalog-worksheet.md`
225- `assets/semantic-layer-migration-checklist.md`
226- `assets/data-quality-incident-runbook.md`
227228## Related Skills
229230- [data-lake-platform](../data-lake-platform/SKILL.md) — ingestion, table formats, orchestration, data mesh
231- [data-sql-optimization](../data-sql-optimization/SKILL.md) — transactional SQL performance and operational tuning
232- `marketing-product-analytics` — event instrumentation and acquisition measurement
233- [data-metabase](../data-metabase/SKILL.md) — Metabase automation and dashboard scripting
234- [ai-ml-data-science](../ai-ml-data-science/SKILL.md) — experimentation and modeling workflows
235236## Current-Source Policy
237238- Prefer `trust_tier: primary` entries in `data/sources.json` for vendor capabilities, syntax, pricing, limits, and release-sensitive recommendations.
239- For recommendation questions, refresh against current official docs and recent release notes.
240- Separate verified facts from judgment calls; label strategic opinions explicitly.
241- If web access is unavailable, state that the recommendation is partially unverified.
242243## Fact-Checking
244245- Use web search/web fetch to verify current external facts, versions, pricing, deadlines, or platform behavior before final answers.
246- Prefer primary sources; report source links and dates for volatile information.
247248## Learnings Loop
249250Before applying this skill on a non-trivial task, read `learnings.consolidated.md` in this directory (and `learnings.md` if present).
251252After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to `learnings.md` via `agents-skills-feedback-loop/scripts/append_learning.py`. Do not modify `SKILL.md` itself.
Run npx skillmds@latest add gabrielmoreira/data-analytics-engineering in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Builds analytics engineering layers for metrics, contracts, and BI-ready models. Use when shaping dbt or SQLMesh marts, metric governance, lineage, or data quality. It is listed under Data & Analytics on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Capability flags: makes network calls. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
gabrielmoreira (@gabrielmoreira) published this skill. Their other Agent Skills are listed on their SkillMD profile.