# databricks-metric-views

This skill writes governed business metrics as YAML and checks whether a given measure belongs in a metric view at all.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 303 installs · ★ 368
- Author: databricks
- License: LicenseRef-Unknown · policy=link-only · description only; the file stays with the author
- Source: https://github.com/databricks/databricks-agent-skills/tree/HEAD/skills/databricks-metric-views/SKILL.md
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/databricks-metric-views

## What it does

The workflow starts with profiling your schema and ends with a deployable definition. Bundled references cover the YAML spec and its patterns, SQL written against a metric view through `MEASURE()`, and the design rules for feeding metrics to Genie. There is also a decision gate: measures that shift with the user's filter, aggregate a per-entity result, or converge iteratively should become a governed Unity Catalog SQL function instead of a metric view.

Requirements are concrete. You need the Databricks CLI at version 1.0.0 or higher, a SQL warehouse you can use, `SELECT` on the source tables, and `CREATE TABLE` plus `USE SCHEMA` in the target schema. YAML version 1.1 needs Databricks Runtime 17.2+, while `synonyms`, `display_name` and `format` need 17.3+. No CLI, no skill.

Because Declarative Automation Bundles have no native metric-view resource, the skill shows how to commit the full SQL definition and apply it through a bundle-managed SQL job. That keeps the definition in version control while dashboards, Genie and ad-hoc SQL all read the same numbers.

## Requirements
- Works with: Databricks

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add databricks/databricks-agent-skills --skill databricks-metric-views -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/databricks-metric-views/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/databricks-metric-views/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add databricks/databricks-agent-skills --skill databricks-metric-views -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/databricks-metric-views/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add databricks/databricks-agent-skills --skill databricks-metric-views -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/databricks-metric-views/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install databricks/databricks-agent-skills databricks-metric-views
```

2. **Manually: put the files in place**
- File: `.github/skills/databricks-metric-views/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add databricks/databricks-agent-skills --skill databricks-metric-views -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/databricks/databricks-agent-skills --path skills/databricks-metric-views
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/databricks-metric-views/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add databricks/databricks-agent-skills --skill databricks-metric-views -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/databricks/databricks-agent-skills/tree/HEAD/skills/databricks-metric-views/SKILL.md

## When to use it
- write revenue and order-count measures as YAML with separate dimensions
- build a KPI layer shared by dashboards, Genie and SQL queries
- define window measures such as moving averages and year-to-date totals
- decide whether a measure can live in a metric view or needs a SQL function
- keep a metric view definition in git and deploy it via a bundle

## Example prompts
- Write a metric view for revenue and order counts over the `main.sales` schema.
- Check whether conversion rate works as a metric view or needs a governed SQL function.
- Give me a SQL query against the metric view using `MEASURE()`, grouped by month.

## Similar
- [xlsx](https://affpapa.org/en/nevibecode/skills/xlsx.md) — skill · 187223 installs
- [google-agents-cli-observability](https://affpapa.org/en/nevibecode/skills/google-agents-cli-observability.md) — skill · 511300 installs
- [caveman-evidence-review](https://affpapa.org/en/nevibecode/skills/caveman-evidence-review.md) — skill · 104500 installs
- [migration](https://affpapa.org/en/nevibecode/skills/migration.md) — skill · 103900 installs
- [performance-optimization](https://affpapa.org/en/nevibecode/skills/performance-optimization.md) — skill · 65200 installs
- [supabase](https://affpapa.org/en/nevibecode/skills/supabase.md) — skill · 8 installs

From the same set: [databricks/databricks-agent-skills](https://affpapa.org/en/nevibecode/by/databricks/databricks-agent-skills.md) — 18 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
