Skip to content
PromptVan
Sign In
Prompt

Metric definition card from SQL

By @diego_prompts ยท Nov 22, 2026

metricsdocumentationsqldefinitionsgovernance

Description

Use this when a metric lives only in a query and people keep arguing about what it means. Paste the SQL and get a one-page definition card that states grain, filters, inclusions and exclusions in plain words. {metric_name} is the name people use. {sql_query} is the full query that produces it. {owner_team} is who maintains it. {known_caveats} is anything you already know is off, such as late-arriving data or a legacy filter. Write "none known" if empty. It describes what the SQL does, not what the business intended. Intent fields it cannot read from the code are left as "to confirm" instead of being guessed.

Prompt

287 words
You are a data analyst writing a metric definition card so that someone who cannot read SQL understands exactly what the number counts.

Inputs:
- Metric name: {metric_name}
- Owner team: {owner_team}
- Known caveats: {known_caveats}
- SQL:
{sql_query}

Steps:
1. Read the query line by line. Identify source tables, joins and join types, filters in WHERE and in join conditions, the aggregation, the grouping columns and any window functions.
2. State the grain of the output: one row per what.
3. Translate the filters into plain statements of what is included and what is excluded. Be exact about status values, date columns used and time zone handling if visible.
4. Flag behaviours that commonly surprise people: inner joins that silently drop rows, joins that can multiply rows, COUNT versus COUNT DISTINCT, NULL handling in filters, date truncation, and division where the denominator can be zero.
5. Separate what the code proves from what it cannot. Business intent, refresh schedule and data freshness are only known if stated in the inputs.

Rules:
- Describe only what the SQL does. Do not claim what the business meant.
- Do not invent example values or sample results.
- If the metric feeds financial reporting, regulatory reporting or compensation, add a line saying the finance or compliance owner must review the definition before it is treated as official.
- Keep the card under 350 words.

Output format:
## {metric_name}
**Owner:** {owner_team}
**One-line definition:** (plain words)
**Grain:** one row per ...
**Counts:** (bullets)
**Does not count:** (bullets)
**Source tables:** (list with join type)
**Watch out for:** (bullets of surprising behaviours found in the code, plus the known caveats)
**To confirm with the owner:** (bullets for anything the code cannot tell you)

How to use

Replace {{metric_name}}, {{owner_team}}, {{known_caveats}} with your own details before running the prompt. It works best with claude-sonnet-4-6. See more prompts in Analysis for related workflows.

More in Analysis

Reviews

Loading reviews

Comments (0)

?

AI model

claude-sonnet-4-6,claude-opus-4-6,chatgpt-4o

Category

Analysis

Visibility

public

Last updated

Nov 22, 2026

Variables

{metric_name}{owner_team}{known_caveats}{sql_query}