# Detect Metrics

> Detect and list all metric functions in the yardstick package. Use when a user asks to find, list, or identify all metrics in the package.

- Skill: `tidymodels/detect-metrics` (Agent Skill)
- Install (CLI): `npx skillmds@latest add tidymodels/detect-metrics`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tidymodels/detect-metrics/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tidymodels (https://skillmd.com/u/tidymodels)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tidymodels/detect-metrics

---


# Detect metrics

## Detection commands

Find all metric definitions (recommended):

```bash
grep -E ".* <- new_.*_metric\(" R/*.R
```

Find available metric constructors:

```bash
grep -E "^new_.*_metric <- function" R/*.R
```

Check exported metrics:

```bash
grep "^export(" NAMESPACE | sed 's/export(//' | sed 's/)//'
```

## Metric structure

Each metric has:

1. Generic function calling `UseMethod()`
2. Constructor wrap: `metric_name <- new_*_metric(metric_name, direction = "minimize"|"maximize"|"zero")`
3. Data frame method using `*_metric_summarizer()`
4. Vector implementation: `metric_name_vec()`

## Key files

- `R/aaa-new.R` - Metric constructor definitions
- `R/fair-aaa.R` - Groupwise metric constructor
- `R/template.R` - Metric summarizer functions

