metric-definition
Skill0 starsChanged 6 months agoMITView on GitHub
Writes precise metric specs with grain, owner, source, formula, guardrails, and known caveats. Use when the user mentions metric definition, metric spec, KPI definition, "what is a session", "define X", North Star metric, or needs to disambiguate a metric across teams.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- analyticsengineering/ae-toolkittheir own version, first seen Aug 30, 2026
- RBraga01/builder-producttheir own version, first seen Jun 7, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- analyticsengineering/ae-toolkit★ 2same name
- RBraga01/builder-product★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository14 other files it gives its agents.
- ab-test-analysisSkill
- ab-test-designSkill
- causal-inferenceSkill
- cohort-analysisSkill
- data-quality-auditSkill
- funnel-analysisSkill
- linear-regressionSkill
- logistic-regressionSkill
- modular-sql-ctesSkill
- sql-correctness-reviewSkill
- sql-query-reviewSkill
- stakeholder-readoutSkill
- survival-analysisSkill
- warehouse-query-optimizationSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Use whenever a metric is being created, re-defined, or disputed.
- Very specific: line 139
Two teams need different filters: Don't fork. Add a parameter to the canonical metric (e.g., dau_b2b and dau_b2c both derive from dau_base).
- Distinctive: line 143
Vanity metrics: If the business question is "looks good on a slide," reject.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Metric Definition
When to use this skill
Use whenever a metric is being created, re-defined, or disputed. Triggers:
- "Define our North Star metric"
- "What counts as an active user?"
- "Write a spec for revenue per user"
- "Why is finance's revenue number different from ours?"
- "Document this metric"
Most metric arguments are actually definition arguments. Force the question into a spec.
Required inputs
| Input | Why it matters |
| Metric name | What stakeholders call it |
| Business question | What decision the metric supports |
| Owner | Who is accountable for accuracy |
| Source tables | Where the underlying data lives |
| Grain | Per user / session / day / order |
Workflow
- Force the business question. "Why does this metric exist?" If the user can't answer, the metric shouldn't exist yet.
- Pin down the grain. "Active users per what?" — per day, per week, per month. The same metric name with different grains is three different metrics.
- Define the SQL. Even if the user doesn't ask for it, write the canonical query. Vague definitions become inconsistent dashboards.
- Identify edge cases up front. For each metric, ask:
- What about deleted/banned users?
- Internal/test users?
- Refunded transactions?
- Multiple devices per user?
- Timezone (event time vs reporting time)?
- Define guardrails. A primary metric without guardrails will get gamed. List 1-3 metrics that must not regress when this one moves.
- Pick the canonical visualization. A line chart of weekly values? A cohort table? Specify so dashboards stay consistent.
- Write the spec in the format below.
Output format
# Metric Spec: <Metric Name>
## Identifier
- **Canonical name:** <snake_case_name>
- **Display name:** <Human Readable>
- **Owner:** <name / team>
- **Last updated:** <YYYY-MM-DD>
- **Status:** <draft | active | deprecated>
## Definition
**Business question:** <What decision does this support?>
**Plain English:** <One sentence anyone in the company can understand.>
**Formula:**<pseudo-math or English formula>
```Grain: <per user | per session | per day | per order>
Source
- Primary table:
<warehouse.schema.table> - Event(s):
<event_name> - Refresh cadence: <daily | hourly | streaming>
- Latency: <e.g., T+1 day>
Canonical SQL (Snowflake)
```sql
select
date_trunc('week', event_at) as week,
count(distinct user_id) as <metric_name>
from <table>
where event_name = '<event>'
and is_internal_user = false
and event_at >= '<start>'
group by 1
order by 1;
```
Inclusions / Exclusions
- Includes: <e.g., paid + free users>
- Excludes: <e.g., internal users, bots, soft-deleted accounts, test orgs>
Edge cases
- <e.g., refunded transactions are excluded if refund occurred within reporting period>
- <e.g., multi-device users counted once via user_id>
- <e.g., all timestamps in UTC>
Guardrails
- <guardrail_metric_1>: must not drop >
<threshold> - <guardrail_metric_2>: must not exceed
<threshold>
Known caveats
- <e.g., pre-2026 data uses a different event schema; do not compare>
- <e.g., mobile clients have a 24h sync delay>
Canonical visualization
<e.g., 12-week rolling line chart, weekly snapshots, with prior-year overlay>
Anti-patterns (do NOT do this)
- Do not redefine this metric in dashboards without updating this spec
- Do not aggregate this metric across teams that filter for different segments
- Do not present this metric without its guardrails
Related metrics
<metric>: related but distinct, defined as<how><metric>: composes with this one for<decision>
Change log
- 2026-04-01 — Excluded test_org_ids per data-quality audit
- 2026-01-15 — Initial definition
## Validation checks
- [ ] One canonical SQL query exists and runs
- [ ] Owner is a specific person, not a team alias
- [ ] Grain is unambiguous (no "daily/weekly" or "user/account" hedging)
- [ ] Inclusions and exclusions are explicit
- [ ] At least one guardrail is listed
- [ ] Spec is linked from the dashboards that show this metric
## Edge cases & failure modes
- **Two teams need different filters.** Don't fork. Add a parameter to the canonical metric (e.g., `dau_b2b` and `dau_b2c` both derive from `dau_base`).
- **The metric is calculated differently in different tools.** Pick the canonical query, deprecate the others, migrate dashboards.
- **The metric was wrong yesterday.** Flag in the change log immediately. Backfill if possible. Add a banner in dashboards if not.
- **A new event changes the definition.** This is a v2 metric, not a redefinition. Run both for a transition period.
- **Vanity metrics.** If the business question is "looks good on a slide," reject. Push for a metric tied to a decision.
## Related skills
- `data-quality-audit` — verify source table quality before finalizing
- `modular-sql-ctes` — structure the canonical SQL cleanly
- `stakeholder-readout` — communicate metric definitions to stakeholdersDoes 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
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.

