/harness:create-metricfrom Harness DevOps
Guides through creating a Harness FME metric: decides what to measure, suggests candidates from code, resolves traffic/event type IDs, drafts payload, and creates. Use when asked to define a new metric or get suggestions.
Ships in Harness DevOps. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Create an FME metric definition, with guidance on what makes a good metric and what to measure. Resolves traffic types and events against real data and asks the user to select an owner instead of guessing IDs. Owner existence is validated by the API on creation/readback; the declared tools do not provide an owner-directory lookup. Design guidance lives in metric-design.md. Related: /manage-experiments attaches metrics; /instrument-metric adds tracking calls.
For every phase marked Stop condition, see stop-conditions.md before improvising.
Works through the Harness MCP server or the Harness CLI; names are from tool-map.md.
| Operation | MCP | CLI |
|---|---|---|
| List metrics | harness_list · fme_metric · filters: { name?, traffic_type_id?, limit } · compact: false | harness list metric --name <substring> --traffic-type-id <id> --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 |
| Create metric | harness_create · fme_metric · body: { name, trafficType, format, aggregation, isPositive, baseEventTypes, owners, description?, filterEventType?, triggerEventType?, cap?, tags? } | harness create metric <name> -f metric.json --json (file holds the full confirmed payload, including owners and any nested filterEventType/triggerEventType/cap objects — same fields as the MCP body) |
| Get metric | harness_get · fme_metric · params: { metric_id } | harness get metric <id> --json |
| Delete metric | harness_delete · fme_metric · params: { metric_id } | harness delete metric <id> |
See scope-establishment.md. Confirm organization and project before any list or get operation — this is the Harness org/project, independent of the local application repo's name or git remote; never infer scope from the repo you're reading code in. If /choose-metric already ran and found no suitable metric, reuse its context (hypothesis, traffic type).
What decision does the metric support (experiment primary / guardrail / supporting, or rollout monitoring)? What should change in which direction? Reuse /choose-metric context if it ran. If the user doesn't know what to measure or asks for suggestions, run Suggest metrics from code, show the coverage table, and let them pick one metric per pass. Pick the shape by asking the plain questions from Intent to configuration ("how many times?", "did they at least once?", "how much / how long?"), not by asking for aggregation names.
List metrics with full definitions, narrowed by name substring and traffic type if known — you need aggregation and baseEventTypes to judge duplicates. Read naming and tag conventions from this list. The backend returns 409 for a duplicate name or duplicate definition (same attribute combination under a different name). Catching this early saves a round trip. Check for auto-created - Split Agents metrics before creating a latency or error metric. If something close exists, confirm a new metric is actually needed rather than reusing/updating the existing one.
Stop condition if the request is vague (e.g. "track checkouts" with no aggregation specified) — see Ambiguous metric intent.
trafficTypeList traffic types and use the traffic type name (immutable after creation, like name itself). Don't ask the user for an ID — resolve it from this list.
baseEventTypes[].eventTypeIdList event types narrowed by traffic type and event name if the user named one. The event name filter is a case-insensitive substring match; the traffic type filter accepts an ID or exact name, not a substring. Check pagination before treating a list as complete; use Get event type for an agreed exact name and verify the returned trafficTypes includes the intended type. Note: RUM/integration events may flow with no track() in code.
Stop condition if the event isn't in this list, or if several events match and none is an exact match for what the user said — a substring search on a word like purchase routinely returns a dozen variants, so present the real ones and ask instead of picking the shortest or cleanest-looking name. Don't invent an ID and don't silently substitute the closest-looking real event; see Missing or ambiguous event. If instrumentation is needed, settle the aggregation/value contract and applicable property filters below before handing off. Pass scope, environment, exact event name, traffic type, units, value source and required properties; resume here with that same contract plus code-test and delivery evidence, not just a success claim.
Start from the matching row in the intent table. Key details:
aggregation: COUNT, TOTAL, AVERAGE, RATE — see intent table for which fits.spread: not part of create body — every new metric is PER. Don't include it.format: NUMBER, DOLLAR, PERCENTAGE, SECONDS, MILLISECONDS, BYTES. RATE+PER coerces to PERCENTAGE.isPositive: true if increase is good. Drives significance-direction interpretation.baseEventTypes[].propertyForValue: for TOTAL/AVERAGE, the value can come from a named property on the event instead of the numeric track() value argument — set this when the user says the value lives in a property (e.g. order_total) rather than being passed positionally.This is the event contract (trafficType, aggregation, value units, value-vs-propertyForValue, and any required properties) that /instrument-metric must match exactly — if the event isn't instrumented yet, settle this contract now so the tracking call isn't written against a guess.
name: must match ^[A-Za-z][-_A-Za-z0-9]*$, max 100 chars, immutable. No spaces — if the user gives a human title, derive a valid name and confirm. Follow observed naming convention from Phase 3.description: what is counted, where event fires, which direction is good.owners: required; {type: "USER", email} or {type: "GROUP", identifier} (group's id field, not display name).Stop condition if no owner was specified, or one turns out to be invalid — see Missing or invalid owner. Don't claim the owner was directory-verified without an actual lookup.
filterEventType — {eventTypeId, filterAggregation, propertyFilters}, resolved the same way as Phase 5. Two uses, selected by filterAggregation:
"RATE" — HAS_DONE filter: only count units that did this event."COUNT" with aggregation: COUNT — ratio metric ("ratio of two events per unit"): baseEventTypes is the numerator, filterEventType the denominator.triggerEventType — {eventTypeId}, resolved the same way as Phase 5. Before/trigger relationship (HAS_DONE_BEFORE): only count units that did this event before the base event. Use this when the user asks for "only count users who did X before Y", "prior to", or "as a trigger" — don't substitute a plain filterEventType (HAS_DONE, no ordering), since it drops the ordering constraint.Stop condition if the request is ambiguous between a plain "has done" filter and a before/trigger relationship — see Filter versus ordered trigger.
cap — outlier capping; 7 sub-fields (baseEventCountCap, baseEventSumCap, baseEventValueCap, filterEventCountCap, filterEventSumCap, filterEventValueCap, metricValueCap, all default 0 = no cap) plus granularity (MINUTES|HOURS|DAYS|WEEKS, default DAYS) — the time window each cap value is evaluated over. Only the cap field matching the metric's aggregation has any effect — don't set others; ask which cap the user wants if they mention capping without specifying.tags — send each entry as {name: "..."}.Present the full payload before calling anything:
name: <name>
trafficType: <name>
format: <FORMAT>
aggregation: <AGGREGATION>
isPositive: <true|false>
baseEventTypes: [{ eventTypeId: <resolved id>, propertyForValue: null, propertyFilters: [] }]
owners: [{ type: "USER", email: <email> }]
description: <optional>
# + filterEventType / triggerEventType / cap / tags if applicable
Replace the template's property fields with the confirmed value property and filters when used; otherwise include propertyForValue: null and propertyFilters: [] explicitly on each base event for CLI/MCP parity. Write the full approved body as JSON/YAML for CLI -f, or pass it as MCP body; don't combine a file with --set/--add expecting a merge.
Quality check (outside the payload, not part of the body sent to the API): [warnings from good-metric checklist that fail — e.g. no cap on revenue, direction unclear, event not flowing]
STOP HERE. Do not call Create yet. Wait for the user to explicitly confirm the draft.
Create metric with the confirmed payload. See write-safety.md for the confirmation protocol.
On a 409, go back to Phase 9 — every single time, not just the first attempt — and name the specific conflicting metric before drafting a revision. Full protocol: retry-and-troubleshooting.md.
Get metric using the literal id string from the create response (don't retype it). Read back every field against the confirmed Phase 9 draft, not just format/aggregation: name, trafficType, every event reference (baseEventTypes, and filterEventType/triggerEventType if set — including their propertyForValue/propertyFilters/filterAggregation), aggregation/format/isPositive (direction), owners, cap, tags. Account for documented defaults/normalization (such as omitted cap fields becoming zero). Report any substantive mismatch; don't silently update the metric to fix it. If format was coerced (Phase 6), tell the user. If the response includes a UI link, share that exact link — never construct or guess one. Never report a create as successful without this get succeeding.
Creating the metric does not attach it to anything. If this was for an experiment, tell the user the metric ID and that attaching it (via the experiment's keyMetrics / supportingMetrics) is a separate step — /manage-experiments handles attachment; /choose-metric covers which list it belongs in.
Average Page Load Time - Split Agents metric first; reuse if present.aggregation: RATE, draft, confirm, create.purchase_completed; aggregation: TOTAL, format: DOLLAR.See retry-and-troubleshooting.md for: 409s, 400s, anti-patterns table, owner validation, name pattern failures.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub harness/harness-ai --plugin harness73 skills in this plugin
/ai-operationsConfigure Harness AI-powered operations (AIDA) via MCP. Set up predictive failure analysis with ML models for memory leaks, disk exhaustion, connection pool saturation, and latency degradation. Configure intelligent alert correlation and noise reduction to reduce alert volume. Use when asked to set up predictive failure analysis, configure AI-powered alerting, reduce alert noise, or enable ML-based anomaly detection. Do NOT use for pipeline debugging (use debug-pipeline instead) or SLO management (use manage-slos instead). Trigger phrases: AIDA, predictive failure, alert correlation, noise reduction, anomaly detection, AI ops, predictive analysis, alert fatigue, ML alerting, intelligent alerting./analyze-costsAnalyze cloud costs, find optimization opportunities, and track anomalies using Harness CCM via MCP. Use when user says "cloud costs", "analyze costs", "cost optimization", "reduce spending", "cost report", or asks about cloud bills./approve-exemptApprove pending Harness STO security exemptions (waivers) at their current scope or elevate them to Project, Org, or Account scope. Users say "approve" for both in-scope approval and higher-scope elevation — do not require the word "promote". Supports approving one exemption or a mixed list where each row has a different approval scope. Default workflow lists pending exemptions in chat (paginated preview) so the user picks by row number — no copying from the Harness UI. Use when a user wants to approve, sign off on, or clear pending exemptions, waive approvals, org-wide approval, or account-wide approval. Trigger phrases: approve exempt, approve exemption, approve waiver, sign off exemption, clear pending exemption, approve for org, approve for account, org-wide approval, account-wide approval, pending exemptions./audit-reportGenerate audit reports and compliance trails using Harness audit trail data via MCP v2 tools. Track user actions, resource changes, authentication events, and access patterns across accounts, organizations, and projects. Use when asked to audit activity, generate compliance reports, investigate security incidents, review user actions, check change logs, or produce SOC2/GDPR/HIPAA audit evidence. Trigger phrases: audit report, audit trail, compliance audit, user activity log, change log, access audit, security investigation, who changed what, audit events./chaos-code-risk-scanScan a source code repository for resilience risks that a Harness chaos experiment can prove (outbound calls without timeouts, retries without backoff, missing graceful shutdown, health checks that mask dependency state, unbounded queues and pools, local state), map each one to a generic SourceCode risk rule, and report them to Harness as a CodeRepository risk scan. Use when the user asks to scan a repo or service code for resilience or chaos risks, or wants code findings they can verify with chaos experiments. Do not use for manifest or pipeline risk scans (those run in Harness), to create or run chaos experiments (use chaos-experiment), or for security or code quality review. Trigger phrases: scan this repo for resilience risks, chaos code scan, find chaos-provable risks, code risk scan, resilience review of this service./chaos-dr-testUse when working with Chaos Engineering steps inside a Harness pipeline. Covers ChaosFault, ChaosProbe, ChaosAction steps (DRTest stages), the Chaos step (DRTest stages), and DRTest stage/pipeline structure. Use when the user asks to add, modify, or create chaos steps, fault injection, probes, or disaster recovery test pipelines. Do not use for standalone Chaos Experiment create or edit; use chaos-experiment for those. Trigger phrases: DR test, DRTest pipeline, disaster recovery test, chaos step, ChaosFault step, ChaosProbe step, ChaosAction step.Other plugins' skills for the same job