Promql cody
Various static analysis and testing tools for managing PromQL compatible monitoring stacks
npx -y skills add conallob/o11y-analysis-tools --skill promql-codyAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
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.
The file declares its own license as BSD-3-Clause. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
6.8 KB, as published. Nobody here has run it
PromQL-Cody
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.
The six tools at a glance
| 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.
Two families of tools
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.
Suggested workflow
- Author or edit alert/recording rules in
*.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 theTODOs).promtool test rules ./*_test.yml— run the generated unit tests.e2e-alertmanager-test --tests=... --output=fullagainst an ephemeral Alertmanager loaded with a skeleton config in CI — produces a diffable notification-preview artifact without sending any real notification.- Periodically (e.g. quarterly, or when on-call flags alert fatigue), run
alert-hysteresisandstale-alerts-analyzerinteractively against production Prometheus to tunefor: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.
Agent workflow
- When a user's request touches PromQL/Alertmanager rules in this repo, start here rather than guessing which of the six tools applies — match their intent (format? validate labels? bootstrap tests? preview a notification? investigate a noisy alert? find dead alerts?) against the table above.
- Load the specific
skills/<tool>/SKILL.mdfor the tool(s) that match before invoking anything — it has the exact flags, output format, and exit-code semantics this skill deliberately omits. - Default hermetic tools (
promql-fmt,label-check,autogen-promql-tests,e2e-alertmanager-testwith 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. - For install/setup instructions (this skill, the six tool skills, or the
binaries themselves via Homebrew/
go install/ghcr.iocontainers), seeINSTALLING.mdandAGENTS.mdat the repo root.