/agent-skills:dd-slack-integrationfrom agent-skills
Connects a commercial Slack workspace to Datadog and adds a channel for receiving alerts and notifications. Handles OAuth, account discovery, and channel setup via the Datadog API.
Ships in agent-skills. 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; scripts run unread.
Estimated time: < 5 minutes
Connect Slack to Datadog in three user-driven moves: the workspace type they confirm, the OAuth grant on that Slack workspace, then the channel they pick, added through the Datadog API. Once a channel is connected, the user can talk to Datadog directly in Slack by mentioning @Datadog, and Datadog notifications can target that channel. This flow handles commercial Slack workspaces (slack.com) only.
The workspace choice, the OAuth grant and the channel choice are all the user's — this skill
never authorizes on their behalf, never picks a channel for them, and never writes
credentials. All Datadog API calls go through pup api, which authenticates with the
user's own session (a 403 means a missing permission; see Important Notes). Nothing
here waits on the user to report back: the connect is detected by a background poll.
scripts/slack_setup.py owns site resolution, authorize-URL minting, account discovery,
and the API calls — do not reproduce that logic yourself. In the commands below, replace
<skill> with this skill's directory. The API reference is
https://docs.datadoghq.com/api/latest/slack-integration/. Its exit codes: 0 success,
1 an error to report (pup missing or unauthenticated, a 403, bad input), 2 an
expected "not there yet" (no account, wait timed out, channel not listed), 3 no
browser.
Account = the name Datadog gives one connected Slack workspace (e.g. Main_Account);
it is what --account takes. "Account" means only that here.
Copy and tick off:
pup auth status, command -v python3accounts: existing account? → stop / add a channel (go to 7) / new workspaceauthorize --openwait in the background until the account appearsadd-channel → listed: truetest-notification → exit 0audit-logs --openDatadog for Government is not supported. If pup auth status reports a
ddog-gov.com site, stop and tell the user to set up the integration from the
Datadog app instead. The script refuses Government sites too.
pup and the site. This flow drives the Datadog API through pup api, and the site is
derived from the user's pup authentication, so the authorize URL and the API calls hit the
same Datadog environment they are logged into:
pup auth status
authenticated: true → use the reported site; continue.authenticated: false → do not declare the user unauthenticated yet. pup reports the
session for the site in DD_SITE (default datadoghq.com) or the named --org session —
a user logged into another site (e.g. staging datad0g.com) shows as unauthenticated
under the default. Ask which site/org they authenticated for, then re-run with
DD_SITE=<site>. If they authenticated a named (org-keyed) pup session instead, pass
--org <name> to the script's commands — it threads the flag through both pup auth status and the pup api calls. Still false → stop and ask them to run
DD_SITE=<site> pup auth login (it needs a browser). Never guess a site.pup is missing (the script exits 1 with "pup not found") → ask before installing it:
brew tap datadog-labs/pack && brew install datadog-labs/pack/pup (macOS or Linux
with Homebrew),
curl -fsSL https://raw.githubusercontent.com/DataDog/pup/main/install.sh | sh, or
npm install -g @datadog/pup (Windows or anywhere with npm); see
https://github.com/DataDog/pup. Then run pup auth login.pup returns non-JSON → the pup on PATH may not be the Datadog CLI
(e.g. a same-named proto tool shadowing it). Point the script at the real binary with
--pup <path-to-pup>; if the user knows their site, --site <site> bypasses pup for
the authorize URL, but the mint and the API steps still need a working pup api.Python. The flow runs scripts/slack_setup.py, so confirm python3 is on PATH
before starting:
command -v python3 || echo "MISSING python3"
Browser. The OAuth grant needs a browser logged into both Slack and the Datadog app.
If there is no browser (a headless host), Phase 2 drops --open and prints the URL for
the user to open where they are logged in.
Before gathering anything else, ask whether to set up the integration for the
Datadog org the user is currently logged in to. Read the org's name from the
same pup session and site this run uses with pup api /api/v2/current_user
(the name of the orgs entry under included; the site is the one pup auth status reported). Then ask once with the host's native selector:
Do you want to set up this integration for the Datadog org on ?
Three questions come before anything is minted: whether a Slack account already exists, whether the workspace is Slack for Government, and whether it is an Enterprise org that wants audit logs.
Before asking anything about the workspace, find out whether the org already has a Slack
account — the user may not need this flow at all. accounts is a read-only GET:
python3 -I -B <skill>/scripts/slack_setup.py accounts
Pass the same --pup/--site/--org context as the rest of the flow (Phase 0).
Exit 2 / "no Slack account is configured" → nothing is connected yet (a fresh org). Continue to the govcloud question below.
Exit 1 → an error, not a fresh org: report it and fix it (Phase 0, Important Notes) before continuing.
Exit 0 with account name(s) → report exactly what was discovered before asking
anything else. Name every account and how many channels each one has — the plain output
lists both, and --json gives the full accounts/channels lists when the channel list
is truncated. For example:
We discovered you already have these Slack account(s) configured: Main_Account (3 channels).
Then ask a three-way question with the host's native selector:
Would you like to: (1) stop, (2) connect a new channel to this account, or (3) set up a new Slack workspace?
add-channel flow against the discovered account. If discovery found several
accounts, ask which one first — list them and pass the user's pick as --account <name>
— rather than letting add-channel hit its ambiguous-account refusal. Option (2) skips
the govcloud and Enterprise questions; if the user later wants audit logs, ask the
Enterprise questions, then run audit-logs.If the user wants to re-authorize a workspace that accounts already lists, wait
cannot detect it, because the account name does not change. After the consent screen,
ask the user once whether Slack showed success, then confirm with accounts and
add-channel.
Before minting anything, ask the user — with the host's native selector — whether the Slack workspace they want to connect is Slack for Government (govcloud). Never guess: a commercial org can hold a Slack for Government workspace and vice versa.
Ask two questions (host's native selector or free text), and never guess either:
Audit-log streaming is optional, available only for Enterprise Grid/Select orgs, and the audit-logs app is installed by the organization owner — see the public docs: https://docs.datadoghq.com/integrations/slack/?tab=datadogforslack#enterprise-grid-audit-logs.
python3 -I -B <skill>/scripts/slack_setup.py authorize --open
GET https://api.<site>/auth/integration/slack/install/authorize-url
through pup api), and opens it; add --json to capture site, url and authorize_url_host in
the transcript.DD_SITE=<site> prefix, pass --site <site> explicitly rather than
relying on the environment carrying through. If it needed --org <name> (an org-keyed
pup session), pass the same --org <name> to every script command in this phase.--open, print the returned URL, and ask the user to open
it where they are logged into both Slack and the Datadog app.The URL lands the user directly on the Slack workspace consent screen (slack.com), with
the same redirect back to /auth/integration/slack/install/complete. Never complete the
grant on their behalf — but do not wait for them to report back either: start the poll
below as soon as the consent screen is open and let it notice the connect.
Two caveats to hand to the user:
/auth/integration/slack/install/complete, and that callback binds the workspace to
the org from the logged-in session — a browser logged out of Datadog cannot finish the
connect.state is a CSRF nonce that expires after about five minutes. Open
it promptly; if it expires, re-run this step for a fresh URL instead of reusing the old
one.python3 -I -B <skill>/scripts/slack_setup.py wait --interval 10 --timeout 300
Start this as a background process immediately after the consent screen is open
(background it with the host's process manager or a shell &), then continue when it
reports the account. It snapshots the configured accounts on its first call and exits 0
printing the new account name(s) as soon as the connect lands — the poll is the
confirmation, so never ask the user to report back that they clicked Allow, and never
block on a "done". It prints nothing per poll; --json emits site, accounts and
account. Exit 2 means it timed out with no new account: re-check the mint caveats above
(Datadog app session in that browser, URL not expired) and re-run this step. Exit 1 is an
error (permission, auth, pup): report it instead of re-minting. Pass the same
--site/--pup/--org as the rest of the flow; --account <name> waits for one specific
account name and ignores unrelated new accounts.
accounts remains the one-shot check — use it when the connect predates this run, or to
re-check by hand after a timeout:
python3 -I -B <skill>/scripts/slack_setup.py accounts
Main_Account) and configured channels
→ OAuth is done; continue to the channel step below. This is the same account name wait
reported.wait poll rather than asking the user for a status.main.The channel is the user's choice — ask with the host's native selector or free text, and wait for the answer. First get real suggestions from the connected workspace:
python3 -I -B <skill>/scripts/slack_setup.py suggest-channels --json
Offer its suggestions (up to three channels, best first, skipping ones already
connected) as the options, plus an Other response for any channel name. If the user types
part of a name, re-run with --query "<what they typed>" and offer those matches. Pass
--account <name> when several accounts are configured, as for add-channel. If the
command fails or returns no suggestions, ask for the channel name as free text, suggesting
something like #ops, #alerts, or an existing channel their team watches. A missing
leading # is added automatically; the user can name any channel in the connected
workspace. Datadog can post to a private channel only after the user runs
/invite @Datadog in it. Then add it:
python3 -I -B <skill>/scripts/slack_setup.py add-channel '#ops'
--account <name> (the name the poll reported) to choose.{"name": "#ops"} to
https://api.<site>/api/v1/integration/slack/configuration/accounts/<account>/channels
through pup api, then re-lists the channels and reports whether the new one shows up.listed: true → done. Anything else → report the error plainly (the script
surfaces the API's own errors array); do not retry silently or claim success.This verifies the wiring end to end — a Datadog message should appear in the channel within moments:
python3 -I -B <skill>/scripts/slack_setup.py test-notification '#ops'
One configured account is used automatically; several → the command refuses and lists
them, so pass --account <name>. Exit 0 ("test notification sent") means the message was
sent — tell the user to check the channel. If it errors, report the message plainly (a 403 carries the RBAC
guidance from Important Notes); the message arriving in Slack is the real confirmation.
If Phase 1 established an Enterprise Grid/Select org, the user is the organization owner, and they chose to enable audit logs, run this after the channel setup:
python3 -I -B <skill>/scripts/slack_setup.py audit-logs --open
auditlogs:read user scope — and opens it so
the user approves it in Slack. Anything other than a slack.com URL with
auditlogs:read is an error: report it, and do not open it by hand.- Slack account: <account> (new | existing)
- Channel: <#channel> — listed: <true|false>
- Test notification: <sent | failed: <error>>
- Audit logs: <requested, not verified | skipped | not eligible>
- Next: use `@slack-<channel>` in a monitor message
Only when the account, channel and test notification lines are all successes, add a short enthusiastic line, e.g. "🎉 Slack is connected to your Datadog org, and #ops is set up!" After any failure, report the error instead.
The user can now receive Datadog notifications in Slack. In any monitor, use
@slack-<channel-name> in the notification message — for example @slack-ops in a
monitor's Say what's happening text sends that alert directly to the connected #ops
channel. With several Slack accounts, use @slack-<account>-<channel-name>. The same
channel can be targeted from other notifications too, so alerts land
where the team already works.
Once a channel is connected, the user can also talk to Datadog directly in Slack by mentioning @Datadog in that channel — asking questions and running commands without leaving Slack. For more on what the connected channel unlocks, see the Datadog Slack integration docs: https://docs.datadoghq.com/integrations/slack/.
If they want more channels, repeat the channel and add-channel steps above; if they want monitors or notifications wired to the channel, that is the monitors/notifications setup, not this skill.
authorize appends the guidance below to the API's own errors array, so relay that text
rather than inventing a route. When classifying by hand:
403 / Forbidden / manage_integrations — the user's Datadog session
is not allowed to authorize the Slack workspace connect. Tell them they need
Integrations Manage (manage_integrations, "Install, uninstall, and configure
integrations") in their Datadog org: an org admin grants it through RBAC, and it is on
the default Datadog Standard Role. The related Integrations Read (integrations_read) is
view-only and is not sufficient. Reference:
https://docs.datadoghq.com/account_management/rbac/permissions/. Once an admin grants
the permission (re-login if the session was cached), re-run the mint for a fresh URL.401 / not authenticated — the pup token itself is missing or stale; re-authenticate
(pup auth login, see Phase 0 for the site/org session) and re-run the mint.404 where
/auth/integration/slack/install/authorize-url is not deployed on this site) — this
Datadog site does not expose the authorize-url route. Surface the error plainly: this
skill has no fallback route, so report it rather than routing the user elsewhere.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub datadog-labs/agent-skills --plugin agent-skills78 skills in this plugin
/agent-observability-auto-experimentRun an iterative code-improvement hill-climb against real Datadog LLM-Obs data, locally, with Claude Code as the agent. Establishes a baseline eval, makes one focused change, re-scores both splits with the same harness, keeps the change when held-out test improves without overfitting val (labeling within-noise gains tentative), and repeats. This is the skill published as "Autoresearch" in Datadog Agent Observability. Use when the user says "run an auto experiment", "run autoresearch", "hill-climb this code", "iteratively improve X and measure the delta", "optimize this code/agent/pipeline/prompt against my traces", "auto-optimize against LLM-Obs", or wants the local equivalent of the auto_experiments worker. Works from an ml_app, a dataset_id, an annotation_queue_id (a queue of human-labelled interactions), a list of trace_ids, or (by exception) a local dataset file. The corpus and its val/test splits live in Datadog LLM-Obs Datasets, created once per run with a timestamp in their names./agent-observability-build-eval-from-annotationsFit a Datadog LLM-Obs evaluator to human labels. Takes an annotation queue, works out where in the trace the labelled property actually lives, drafts an LLM-judge that predicts the human label, scores that judge against the already-labelled rows with a metric agreed with the user, then hill-climbs it — inspect the errors, make one focused change, re-score, keep it only if it beats the best — for a bounded number of iterations, and finally publishes the winner to Datadog as a DISABLED evaluator (not a Datadog draft — a real evaluator with `enabled: false`). Use when the user says "build an eval from my annotations", "build an evaluator from the annotation queue", "turn my annotations into an evaluator", "learn an evaluator from my labels", "fit a judge to the annotation queue", "auto-label", "auto labelling", "automate this annotation queue", "scale up my human labels", or wants the rest of a queue graded the way the humans graded the first rows. Needs an annotation queue with at least two classes present in the human labels (e.g. one true and one false for a boolean).Other plugins' skills for the same job