agentleFS
kryptophonikkryptophonik/SRE-Skills/skills/sre-datadog/SKILL.md

sre-datadog

Skill4 starsChanged 23 days agoMITView on GitHub

Use when metrics, traces, logs, monitors or SLOs live in Datadog: queries, monitor and SLO review, incidents and events. Read-only MCP or API (read-scoped keys); writes need approval.

  • Reads credentials
  • Sends data out

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Wait for explicit human approval before any prod-changing command, MCP write tool, or external post.

    line 12
  2. Very specific:

    Never echo keys: Use env vars ($DD_API_KEY, $DD_APP_KEY) and env substitution in .mcp.json.

    line 26
  3. Very specific:

    Check X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset headers.

    line 87
  4. Very specific:

    Use short time windows and small page.limit.

    line 88
  5. Very specific:

    Prefer SLO burn-rate alerts on a Datadog SLO over raw threshold monitors (sre-slo-alerting, sre-observability-query-cookbook).

    line 97
  6. Distinctive:

    If neither the Datadog MCP server nor API keys are available, output the queries for the human and stop.

    line 112

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Datadog

Safety gates (REQUIRED)

  1. Read-only diagnosis first.
  2. Propose each change with risk (low/med/high) and reversibility.
  3. Wait for explicit human approval before any prod-changing command, MCP write tool, or external post.
  4. Act only as approved, verify, and stop and escalate if anything gets worse.

Full rules: sre-safety-gates. Read-only MCP setup: sre-safety-gates/references/mcp.md.

Process skills: sre-engineer, sre-diagnostics, sre-slo-alerting, sre-incident-command. More queries: sre-observability-query-cookbook.

Verify in your environment before use: span names, tag keys (env, service), your Datadog site, and MCP write tool names.

Access

  • Site: set DD_SITE (e.g. datadoghq.com, datadoghq.eu, us3.datadoghq.com) to avoid querying the wrong region. API base: https://api.${DD_SITE:-datadoghq.com}.
  • MCP: https://mcp.<site>/v1/mcp (e.g. https://mcp.datadoghq.com/v1/mcp). Not available on FED sites (US1-FED, US2-FED). Default toolset is core; narrow with ?toolsets= and ?omit_tools=; avoid toolsets=all.
  • Auth preference: OAuth > personal/service access token (bearer) > API key + application key.
  • Never echo keys. Use env vars ($DD_API_KEY, $DD_APP_KEY) and env substitution in .mcp.json.

Read-only enforcement (MCP writes are ON by default)

The Standard role includes mcp_write. Enforce read-only by at least one of:

  1. A custom role with only mcp_read for the MCP identity.
  2. Turn off MCP Write Access at the org level.
  3. omit_tools for write tools (e.g. create_datadog_monitor, create_datadog_notebook, edit_datadog_notebook — verify names in your tool list).

Application keys: scope to metrics_read, monitors_read, logs_read_data, apm_read.

Writes that need approval

POST /api/v1/monitor (create/update monitors), downtimes, mute/unmute, SLO create/update, incident create/update, events post, MCP write tools.

Logs and spans search use POST but are read-only.

Query syntax

APM trace metrics are named trace.<SPAN_NAME>.<suffix>; the span name depends on the integration (servlet.request, rack.request, flask.request, http.request, …). Find yours in APM service page.

avg:system.cpu.user{env:<env>} by {host}
sum:trace.<span_name>.errors{env:<env>,service:<svc>}.as_count()
sum:trace.<span_name>.hits{env:<env>,service:<svc>}.as_count()
p95:trace.<span_name>{env:<env>,service:<svc>}
avg:kubernetes.memory.usage{kube_namespace:<ns>} by {pod_name}

p95 requires the distribution trace metric (trace.<span_name>). The legacy trace.<span_name>.duration has no percentiles.

Logs search:

service:<svc> env:<env> status:error
@http.status_code:[500 TO 599] service:<svc>

Read-only API calls

DD_API="https://api.${DD_SITE:-datadoghq.com}"
H=(-H "DD-API-KEY: $DD_API_KEY" -H "DD-APPLICATION-KEY: $DD_APP_KEY")
# Metric query (last hour)
curl -sG "$DD_API/api/v1/query" "${H[@]}" \
  --data-urlencode "from=$(($(date +%s)-3600))" --data-urlencode "to=$(date +%s)" \
  --data-urlencode "query=sum:trace.<span_name>.errors{env:<env>,service:<svc>}.as_count()"
# Monitors currently alerting
curl -sG "$DD_API/api/v1/monitor/search" "${H[@]}" \
  --data-urlencode 'query=status:alert tag:"service:<svc>"'
# Log search (v2, read-only POST)
curl -s -X POST "$DD_API/api/v2/logs/events/search" "${H[@]}" -H "Content-Type: application/json" \
  -d '{"filter":{"query":"service:<svc> status:error","from":"now-15m","to":"now"},"page":{"limit":50}}'
# Span search (v2, read-only POST)
curl -s -X POST "$DD_API/api/v2/spans/events/search" "${H[@]}" -H "Content-Type: application/json" \
  -d '{"data":{"type":"search_request","attributes":{"filter":{"query":"service:<svc> env:<env> status:error @duration:>1s","from":"now-15m","to":"now"},"page":{"limit":25}}}}'

Rate limits and cost

  • Check X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset headers; on 429 back off until reset.
  • Use short time windows and small page.limit; avoid toolsets=all in MCP.

Monitor definition (for review; create only after approval)

Query:  sum(last_5m):sum:trace.http.request.errors{service:<svc>,env:<env>}.as_count() / sum:trace.http.request.hits{service:<svc>,env:<env>}.as_count() > 0.01
Message must include: impact, runbook link, @pagerduty-<service> or @opsgenie-<team> handle

Prefer SLO burn-rate alerts on a Datadog SLO over raw threshold monitors (sre-slo-alerting, sre-observability-query-cookbook).

Bundled scripts and references

Env: DD_API_KEY, DD_APP_KEY (read-scoped), DD_SITE (default datadoghq.com). Keys go to curl on stdin; 429s retry; result sizes are capped.

bash scripts/dd_query.sh 'avg:system.cpu.user{env:<env>} by {host}' 60
bash scripts/dd_logs_search.sh 'service:<svc> env:<env> status:error' 15 50
bash scripts/dd_spans_search.sh 'service:<svc> env:<env> status:error' 15 50
bash scripts/dd_monitors_alerting.sh 'tag:"service:<svc>"' 30
  • references/query-cheatsheet.md · references/api-endpoints.md · references/app-key-scopes.md · references/mcp-read-only.md

If neither the Datadog MCP server nor API keys are available, output the queries for the human and stop.

Output

  • Queries used (with site and time window), results, and any proposed monitor/downtime/SLO change with risk and approval status

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.