/agent-skills:dd-github-costs-onboardingfrom agent-skills
Guides connecting a GitHub enterprise or organization bill (Actions, Packages, Copilot, storage) to Datadog Cloud Cost Management via the GitHub Costs integration. Handles token creation, duplicate prevention, and one-shot registration.
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
Use scripts/setup.py relative to this file. It owns target discovery, the
browser handoff, hidden token entry in a separate terminal, the GitHub token
check, Pup OAuth validation, duplicate prevention, one-shot registration, and
secret redaction. Do not reproduce its API reads or writes.
The integration (github-costs) brings the GitHub bill of one enterprise or
one organization (Actions, Packages, Copilot, storage, and other metered
products) into Datadog Cloud Cost Management (CCM). Each Datadog GitHub Costs
account ("account" below) holds one GitHub personal access token (PAT) and the
enterprise slug or organization login it reads.
Out of scope: Copilot usage or seat metrics (use dd-github-copilot-onboarding),
and code in stack traces or PR comments through the GitHub App (use
dd-github-onboarding).
Datadog 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.
Check these before step 1; when a required one fails, stop with its fix:
pup, installed and authenticated. The setup script performs every
Datadog request through pup api, which owns authentication, OAuth refresh,
site, and Datadog org selection. Run pup auth status and note the site for
step 4. If pup is missing, 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. Do not ask
the user to create or store Datadog API or application keys.
pup at v2 or later. The setup script uses v2-only CLI flags (such as
--no-envelope); Pup 1.x fails with an opaque pup_request_failed. Check
pup --version: a major version of 2 or later is required. If it is older,
ask before upgrading. When the environment allows it, upgrade with the
official installer or npm as above. Some workspaces block piping a remote
script to a shell (curl | sh), and /usr/local/bin may not be
user-writable; there, install from the release archive in a fresh empty
directory instead (replace 2.4.3 and the platform suffix with the latest
release):
VERSION=2.4.3
curl -fsSLO "https://github.com/DataDog/pup/releases/download/v${VERSION}/pup_${VERSION}_Linux_x86_64.tar.gz" &&
curl -fsSLO "https://github.com/DataDog/pup/releases/download/v${VERSION}/pup_${VERSION}_checksums.txt" &&
grep "pup_${VERSION}_Linux_x86_64.tar.gz$" "pup_${VERSION}_checksums.txt" | sha256sum -c - &&
tar -xzf "pup_${VERSION}_Linux_x86_64.tar.gz" &&
sudo install -m 0755 ./pup /usr/local/bin/pup &&
pup auth login
python3 on PATH (command -v python3) to run the setup script.
The GitHub CLI (gh), optional, signed in (gh auth status), to list the
enterprises and organizations the user can connect. Without it the user
types the enterprise slug or organization login (the script's
gh_unavailable exit). To install it, see https://cli.github.com.
A graphical desktop session or a tmux session (macOS, Linux with X11 or Wayland, or Windows; or the agent session inside tmux, which also works on headless hosts): the token prompt opens in a new terminal window — a new tmux window when the session runs inside tmux. Over SSH with no desktop session and no tmux, in a container, or on a headless host outside tmux, stop and point the user to the GitHub Costs integration tile in Datadog.
Enterprise: an Enterprise Administrator creates a classic PAT with the
manage_billing:enterprise and read:org scopes. Fine-grained tokens cannot
read enterprise billing, so the script refuses them.
Organization: an organization owner creates a fine-grained PAT whose resource owner is the organization, with Organization permissions → Administration: Read-only. If the organization requires approval for fine-grained tokens, an owner must approve it before it works. A classic PAT from an owner also works.
GitHub enhanced billing platform: both enterprises and organizations must be on it, or the integration cannot read their costs (see the GitHub Costs integration docs). If the target is not, stop.
GitHub shows the token only once.
Costs appear in Datadog only if the Datadog org uses Cloud Cost Management.
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 ?
Ask with one interactive question whether they want to connect a GitHub Enterprise (enterprise-wide billing) or a single Organization. Warn that connecting an enterprise and one of its organizations counts that organization's costs twice; pick one level.
List what the signed-in GitHub CLI user can connect (read-only, needs no Datadog credentials or token):
python3 <SKILL_DIR>/scripts/setup.py --list-targets
{"status": "ok", "gh_login": "octocat", "organizations": ["acme"], "enterprises": null,
"enterprises_note": "Listing enterprises needs the gh read:enterprise scope: gh auth refresh -h github.com -s read:enterprise"}
organizations lists the organizations the gh_login user owns.enterprises lists the enterprises they administer or manage billing for. It
is null when gh lacks the read:enterprise scope; enterprises_note then
names the fix. If the user chose Enterprise, ask whether to run
gh auth refresh -h github.com -s read:enterprise (it opens a browser) and
rerun --list-targets, or let them type the enterprise slug instead.gh_unavailable → gh is missing or not signed in; ask for the enterprise
slug or organization login directly.Offer the matching list as choices with the host's interactive question tool
(the user can also type a slug or login). Confirm the gh_login is the GitHub account
they mean: the token must come from an owner or administrator of the target.
Never guess the target.
In one question form, gather values not already supplied:
github-<target>.key:value tags to add to these costs, such as
team:platform; no spaces or commas.Before opening anything, tell the user what they will need to do: create a GitHub personal access token on the page that opens (it is pre-filled with the name, the permissions above, and, for organizations, the resource owner), and paste it into a separate terminal window that the script opens. For an organization the page presets a 365-day expiration; an enterprise's classic token page defaults to 30 days. The terminal recommends No expiration (or, for a classic token, at least 365 days) so costs keep flowing. Explain the token requirements from Phase 0.
Then use the interactive question tool once for approval:
Title: Approve GitHub Costs integration setup
Question: ask this, with each step on its own line:
May I run the interactive setup? It will:
- Open GitHub's token page, pre-filled for .
- Ask you to paste the token into a hidden prompt in a new terminal.
- Check with GitHub that the token can read 's billing.
- Register the named Datadog GitHub Costs account.
The token is never visible to the agent, and will not be printed, passed as a command argument, stored in a file, or returned in output.
Approve option: Approve and open the secure token prompt
Cancel option: Cancel without making changes
After approval, run:
python3 <SKILL_DIR>/scripts/setup.py --account-name "<ACCOUNT_NAME>" --scope <enterprise|organization> --target "<TARGET>"
For example, an organization on the EU site with one tag:
DD_SITE=datadoghq.eu python3 <SKILL_DIR>/scripts/setup.py --account-name "github-acme" --scope organization --target "acme" --tag team:platform
Append --tag <key:value> once per tag. On Windows, use python instead of
python3. Pup uses its default session, and picks the Datadog site from
DD_SITE (default datadoghq.com): if the user's Pup session is on another
site, run the command with DD_SITE set to it (e.g. datadoghq.eu); if they
use a named Pup session (pup auth login --org <name>), also set the DD_ORG
environment variable to that session's name. Set them the way the shell expects: a
NAME=value prefix on POSIX shells, $env:NAME="value"; in PowerShell, or
set "NAME=value" && in cmd.exe. Do not detach the process or redirect its
input. Tell the user to switch to the new terminal when it appears — a
tmux window named github-costs-token when the session runs inside
tmux.
Run the command with the longest command timeout your tool allows (at least 10 minutes). The user may take up to 5 minutes to enter the token, and Datadog requests have no client-side timeout. Killing the command during registration leaves the outcome unknown.
The script always opens a new graphical terminal for token entry, because the agent's own TTY may not be visible to the user; if it cannot, it fails instead of prompting in place. Never ask the user to paste the token into chat, and never pass it through a command argument, environment variable, shell pipe, redirected input, or file.
Before asking for a token, the script validates Pup, returns an existing account with the same name instead of creating one, and refuses a target that is already connected. It checks the token with GitHub's billing API before writing anything, sends one POST, and reconciles a failed POST by listing accounts instead of retrying. The token stays in memory and is redacted from all output.
Report the script's status and warnings without exposing credentials. Errors
print {"status": "error", "error": {"reason": ..., "message": ...}}; a
trimmed complete result looks like:
{"status": "complete", "account": {"name": "github-acme", "target": "acme"},
"cost_tag": "organization_name:acme",
"links": {"costs": "https://app.datadoghq.eu/cost/summarize/overview?provider_id=GitHub%20Costs"}}
complete → continue with
Getting the Most Out of Your Integration.already_configured → an account with that name exists (account.target
says what it reads); nothing changed. Offer a different name if they meant a
new target.pup_cli_outdated → the installed Pup is older than v2 and cannot run this
setup. Ask before upgrading it (see the Pup version preflight above), then rerun
once the upgrade is done.target_already_connected → that enterprise or organization is already
connected under details.account.name; nothing was written. Do not add it
again: a second account would count those costs twice.duplicate_datadog_accounts → several accounts share that name. Do not
create another; ask the user which one to keep, and stop.account_name_taken → while the token was being entered, another account
with that account name appeared for a different target. If the POST was
rejected, nothing was connected for the requested target; rerun with a
different name. If it reports the POST succeeded, inspect the account list
before rerunning.classic_token_required → an enterprise needs a classic token; the user
pasted a fine-grained one. Rerun and create a classic token on the page that
opens.invalid_github_token or github_token_rejected → nothing was
written. Ask the user to create a fresh token and rerun.github_access_denied → GitHub refused the token for that target; relay
the script's message. Usually the token lacks the permissions above, was
created by someone who is not an owner/administrator, has the wrong resource
owner, is awaiting organization approval, or the target slug or login is wrong.github_check_failed → GitHub could not be reached, rate-limited the
check, or answered with a temporary error; nothing was written. Rerun shortly (and make sure the network
allows api.github.com).terminal_launch_failed or terminal_launch_unsupported → no
graphical terminal could be opened (headless, SSH, or container); nothing was
written. Ask the user to rerun from a desktop session, or to connect it from
the GitHub Costs integration tile.terminal_helper_not_connected, credential_entry_timeout, or
credential_entry_cancelled → nothing was written. Ask whether to rerun.datadog_create_failed → Datadog rejected the request; nothing was
written. Relay details.pup_error. A 403 usually means the user lacks the
Integrations Manage (manage_integrations) permission.ambiguous_datadog_post → do not rerun, because the write may still land.
Inspect the account list (read-only): report the account as created only if
both its name and its settings.enterprise_name match the requested name and
GitHub enterprise or organization. A details.same_name_account reads a
different target, so it does not count. Otherwise keep the outcome ambiguous
and send the user to the GitHub Costs integration tile to check the account.datadog_account_not_visible → Datadog accepted the account but it is not
listed yet. Do not rerun; check the account list again later.pup auth refresh; if that fails, run
pup auth login with the reported missing scopes.message and reason, and rerun once
the cause is fixed. When the status says the write may have landed (as
above), check the account list first.After complete, give a short, enthusiastic headline that starts with 🎉, such
as "🎉 GitHub Costs is connected for !", then tell the user:
links.costs) under the
GitHub Costs provider, typically within about 24 hours; GitHub's billing
data is daily, so there is nothing to check sooner.cost_tag the script returned
(enterprise_name:<slug> or organization_name:<login>), plus any tags they
added.Only describe what the script confirmed.
What SKILL.md sets; muted values are Claude Code's defaults
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