Orchestrate all six o11y-analysis-tools PromQL/Alertmanager CLIs together as one workflow for a repo of Prometheus/Alertmanager rules — decide which tools are hermetic and CI-safe (promql-fmt, label-check, autogen-promql-tests, and e2e-alertmanager-test when given a skeleton Alertmanager config) versus interactive-only and judgment-assisted (alert-hysteresis, stale-alerts-analyzer), and in what order to run them end to end. Use this as the entry point whenever a user asks to format, validate, test, preview, tune, or clean up PromQL/Alertmanager rules in this repo — load it before reaching for an individual tool's skill so the right tool and the right mode (interactive vs. CI) get picked. Named after and dedicated to the late Cody Smith.
Ships in promql-cody. 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.
None: SKILL.md is the whole skill.
In memoriam. This skill is named after and dedicated to the late Cody Smith
PromQL-Cody is the unified Agent Skill for o11y-analysis-tools: it
teaches an agent how to use all six PromQL/Alertmanager CLIs in this repo
together — which are safe to run unattended, which need a human in the
loop, and what order they belong in. Load the per-tool skill
(skills/<tool>/SKILL.md) for the exact flags and output format of
whichever tool this points you at; this skill is the map, not the detail.
| Skill | Purpose | Hermetic? | Best run | External dependency |
|---|---|---|---|---|
promql-fmt | Format/validate PromQL multiline style + best-practice lint | Yes | Interactive and CI | none |
label-check | Enforce required labels on expressions/alerts | Yes | Interactive and CI | none |
autogen-promql-tests | Generate promtool-style unit test skeletons | Yes | Interactive, to bootstrap coverage | none |
e2e-alertmanager-test | Render alert notifications (email/Slack/JSON) end-to-end — a "print preview" for alerts | Yes*, with a skeleton config (see its skill) | CI, producing a diffable artifact; also useful interactively | an ephemeral Alertmanager + a Prometheus unit-test file |
alert-hysteresis | Recommend for: duration tuning from real firing history | No | Interactive, as needed | live Prometheus with historical ALERTS data |
stale-alerts-analyzer | Flag alerts that rarely/never fire — "dead code analysis" for alerts | No | Interactive, periodic cleanup | live Prometheus with historical ALERTS data |
* Only when its ephemeral Alertmanager is loaded with a skeleton config that overrides receiver connection details. Pointed at a real/unmodified Alertmanager config, it can dispatch real notifications and is not hermetic.
1. Hermetic static analyzers — promql-fmt, label-check,
autogen-promql-tests. These are pure functions over the rule files on
disk: same input, same output, every time. They need no network access and
no running Prometheus. This makes them safe to run unattended and to wire
into CI as required, blocking checks on every commit or pull request.
2. Historical-data tools — alert-hysteresis, stale-alerts-analyzer.
Both query a live Prometheus's ALERTS metric over --timeframe/
--timehorizon to reason about real firing behavior. Their output is
only as trustworthy as Prometheus's retention window (an alert can look
"stale" simply because the lookback exceeds retention). They are not
reproducible in CI — there's no fixture that substitutes for months of
real production firing patterns — so treat them as interactive,
judgment-assisted tools you run during an alert-quality review, not as a
merge-blocking gate.
e2e-alertmanager-test needs a live Alertmanager to POST alerts to, but
that instance can be a short-lived container, and — unlike the two tools
above — its output doesn't depend on irreproducible production history.
Point that ephemeral Alertmanager at a skeleton config that preserves
the team's real route:/inhibit_rules: but overrides every receiver's
connection details (SMTP smarthost, Slack/webhook URLs) with local no-op
values, and the whole run becomes fully hermetic: real routing logic is
still exercised, but no notification ever leaves the runner. That's what
makes it safe to run in CI — its payoff there is a generated
notification-preview artifact that reviewers can diff release over
release, the way a snapshot test diffs UI screenshots. See the
e2e-alertmanager-test skill
for how to build that skeleton config.
*.yml.promql-fmt --check (or --fix) — formatting gate.label-check --labels=job,... — required-label gate.autogen-promql-tests --rules=... — interactively, the first time a rule
is added, to scaffold a _test.yml (then hand-fill the TODOs).promtool test rules ./*_test.yml — run the generated unit tests.e2e-alertmanager-test --tests=... --output=full against an ephemeral
Alertmanager loaded with a skeleton config in CI — produces a diffable
notification-preview artifact without sending any real notification.alert-hysteresis and stale-alerts-analyzer interactively against
production Prometheus to tune for: durations and cull dead alerts.Steps 2–3 (and 6, given a disposable Alertmanager) belong in CI. Steps 4 and 7 are deliberately interactive — they either need a human to fill in generated placeholders or a human to interpret a statistical recommendation before touching production alerting.
skills/<tool>/SKILL.md for the tool(s) that match
before invoking anything — it has the exact flags, output format, and
exit-code semantics this skill deliberately omits.promql-fmt, label-check, autogen-promql-tests,
e2e-alertmanager-test with a skeleton config) to CI-safe, automatable
usage. Default the two historical-data tools to interactive use with a
human reviewing the recommendation — never wire them into a
merge-blocking gate.go install/ghcr.io containers), see
INSTALLING.md and AGENTS.md
at the repo root.What SKILL.md sets; muted values are Claude Code's defaults
/promql-cody:promql-codyfrom promql-cody
npx claudepluginhub conallob/o11y-analysis-tools --plugin promql-codyOther plugins' skills for the same job
7 skills in this plugin
/alert-hysteresisQuery a live Prometheus's historical ALERTS series to statistically recommend better 'for:' hold-down durations, reducing spurious short-lived alerts and alert fatigue. Use interactively when an alert is firing too often/too briefly and needs its hysteresis tuned, or when auditing a rules file's for: values against real firing behavior. Requires a live Prometheus with sufficient ALERTS retention — not hermetic, not a CI check./autogen-promql-testsIdentify Prometheus alert/recording rules that have no promtool unit-test coverage, and scaffold true-positive/false-positive/hysteresis test-case skeletons for them. Use when bootstrapping unit tests for new or existing PromQL rules, or auditing test coverage of a rules file. Fully hermetic: reads only local rule/test YAML, no running Prometheus required./e2e-alertmanager-testRender end-to-end previews of what an alert notification will actually look like (plain-text email, HTML email, Slack attachment JSON, raw webhook JSON) by replaying a Prometheus unit-test file's expected alerts through a live Alertmanager. Effectively a "print preview" for alerts. Use to review notification formatting/content before merging alert changes, or in CI against an ephemeral Alertmanager to produce a diffable preview artifact. Requires a reachable Alertmanager API and a promtool-style unit-test file as input. Can be made fully hermetic in CI by pointing the ephemeral Alertmanager at a skeleton config that keeps the team's real routing/grouping/inhibition rules but overrides receiver connection details, so no real notification ever leaves the runner./label-checkEnforce that PromQL expressions (and, optionally, alert definitions) carry a required set of labels — e.g. job, namespace, cluster — to prevent label collisions in multi-tenant Prometheus/Thanos/Cortex/Mimir setups. Use when validating rule YAML for required labels or required alert labels, interactively or as a CI gate. Fully hermetic: no network access or running Prometheus required./promql-fmtFormat and lint PromQL expressions embedded in Prometheus/Thanos/Cortex/Mimir rule YAML files — multiline layout, redundant aggregation-clause removal, aggregation-style consistency, and naming/instrumentation best-practice checks. Use whenever writing, editing, or reviewing alert/recording rule YAML, or as a CI formatting gate on pull requests that touch rule files. Fully hermetic: no network access or running Prometheus required./stale-alerts-analyzerQuery a live Prometheus's historical ALERTS series to find alert rules that haven't fired in a long time — "dead code analysis" for alerting rules, surfacing candidates for deletion or threshold review. Use interactively during alert-quality/on-call hygiene reviews, not as a CI gate. Requires a live Prometheus with sufficient ALERTS retention.