choose-metric
Recommend primary/guardrail metrics for an experiment or rollout, judged against a good-metric checklist. Checks existing metrics and event health, surfaces auto-created guardrails. Doesn't create or attach metrics — see create-metric / instrument-metric / manage-experiments. Trigger phrases: choose/pick a metric, primary metric, guardrail metric, what to monitor.
Harness · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add harness/harness-skills --skill choose-metric技能说明
name: choose-metric description: >- Recommend primary/guardrail metrics for an experiment or rollout, judged against a good-metric checklist. Checks existing metrics and event health, surfaces auto-created guardrails. Doesn't create or attach metrics — see create-metric / instrument-metric / manage-experiments. Trigger phrases: choose/pick a metric, primary metric, guardrail metric, what to monitor. metadata: author: Harness version: 1.3.2 mcp-server: harness-mcp summary: Recommend primary/guardrail metrics for an experiment or rollout, judged against a good-metric checklist license: Apache-2.0 compatibility: Requires the Harness MCP server or the Harness CLI
Choose Metric
Recommend metrics for an FME experiment or feature-flag rollout: which is primary, which are guardrails/supporting, and which existing candidates are healthy enough to trust, judged against what makes a good metric. Related: /manage-experiments attaches metrics to experiments; /create-metric creates new metrics; /instrument-metric adds tracking calls.
Tools
Works through the Harness MCP server or the Harness CLI; names are from tool-map.md.
| Operation | MCP | CLI |
|---|---|---|
| Get flag | harness_get · fme_feature_flag · params: { feature_flag_name } | harness get feature_flag <name> --json |
| Get experiment | harness_get · fme_experiment · params: { experiment_id } | harness get experiment <id> --json |
| List metrics | harness_list · fme_metric · filters: { traffic_type_id?, name?, limit } · compact: false | harness list metric --traffic-type-id <id> --name <substring> --json |
| List traffic types | harness_list · fme_traffic_type · compact: false | harness list traffic_type --json |
| List event types | harness_list · fme_event_type · filters: { traffic_type?, name? } · compact: false | harness list event_type --traffic-type <name or id> --name <substring> --json |
| Get event type | harness_get · fme_event_type · params: { event_type_id } | harness get event_type <event-name> --json |
Instructions
Phase 1: Establish scope
See scope-establishment.md. Confirm organization and project before any list or get operation.
Phase 2: Identify the context
Ask (if not already stated): is this for an experiment (A/B test) or a feature-flag rollout being monitored for safety? The recommendation logic differs (Phase 5).
For an experiment, get the hypothesis before recommending anything: "if this succeeds, [what] will increase/decrease?" The primary metric must directly measure that hypothesis, not just be topically related.
Stop condition: if it's an experiment and the user hasn't stated a hypothesis, ask for one before recommending a primary metric. Don't infer it from the flag name.
Phase 3: Check what's already attached (experiment context only)
If the experiment exists, Get experiment to read keyMetrics / supportingMetrics so you don't propose duplicates. Workspace-wide GUARDRAIL / ALERT metrics are added automatically and don't appear in these lists. If the experiment doesn't exist yet, skip this check and proceed on the hypothesis alone.
Phase 4: Resolve the traffic type
To narrow the metric list, get the flag's traffic type: Get flag returns trafficType with id and name. If you don't have the flag name, List traffic types and ask which one applies — a metric on a different traffic type won't collect data for the experiment or rollout.
Phase 5: Inventory candidate metrics
List metrics with full definitions, narrowed by the traffic type from Phase 4 and a name substring if the hypothesis gives an obvious keyword. Request ~30 rows unless the hypothesis points to a specific name. A total exceeding returned rows proves more pages remain, but equality does not prove completeness: MCP can fall back to page length when the API total is absent. Set an explicit filters.limit/filters.offset and follow pagination for metrics, traffic types and event inventories. Say "no suitable metric in the examined subset," not "no suitable metric exists"; finish pagination (or ask to narrow a costly inventory) before making a project-wide absence claim.
Read name, description, aggregation, spread, format, isPositive, baseEventTypes[].eventTypeId for each. Judge candidates against What makes a good metric, not health alone.
Phase 6: Health-check each candidate
Metric creation doesn't validate any event reference, so a metric can look complete while its event is a typo, was renamed, or has gone idle. For each candidate you're about to recommend, Get event type for every event reference it uses — baseEventTypes, and filterEventType/triggerEventType if set, not just the base event, since a stale filter or trigger event silently changes which units get counted even if the base event is healthy. The response has only id and trafficTypes — check the returned trafficTypes includes the candidate's traffic type. Event types are listed only if an event arrived in the last 30 days, project-wide across all environments — this isn't a "currently flowing" guarantee for any one environment. An exact-get 404 means no matching event is visible in this scope/window — check scope and spelling, then whether a previously working flow has simply been idle. It does not prove the event was never instrumented. Absence from a filtered or partial list is inconclusive. Ask whether the flow has run recently before concluding the metric needs re-instrumentation or modifying any code; if confirmed idle rather than brok