/buildkite:investigating-buildsfrom buildkite
Investigates existing Buildkite CI runs: diagnoses failures, flaky tests, pass/fail rates, pulls logs, and reproduces builds locally. Uses bktide and MCP tools.
Ships in buildkite. 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.
Check status, investigate failures, and reproduce them locally for Buildkite builds that already exist.
Always use Buildkite-native tools. Don't fall back to gh pr view/gh pr checks or the GitHub API: GitHub shows only a summary and loses annotations, logs, and the broken-vs-failed distinction. If one Buildkite tool fails, move to the next tier below rather than abandoning Buildkite.
npx bktide@latest snapshot <buildkite-url> (use this first). Parses any build or step URL, downloads build metadata, annotations, and logs for failed steps into files you can grep and re-read without more API calls. bktide snapshot --help for options, bktide prime for LLM-oriented usage.
./tmp/bktide/snapshots/<org>/<pipeline>/<build>/
├── manifest.json # Step index with states and exit codes
├── build.json # Full build metadata
├── annotations.json # Build annotations
└── steps/<NN-step-name>/{log.txt,step.json}
Other bktide commands for quick queries: pipelines <org>, builds <org>/<pipeline>, build <org>/<pipeline>#<build>, annotations <org>/<pipeline>#<build>, and the one write capability, build create / build rebuild (see below).
MCP tools (fallback, and the only way to unblock a build): buildkite:get_build, list_builds, list_annotations, get_pipeline, list_pipelines, wait_for_build, get_logs, get_logs_info, list_artifacts, unblock_job. Start with detail_level: "summary" and filter with job_state: "failed".
Full capability matrix: references/tool-capabilities.md. The tool preference order can be overridden in ~/.config/pickled-claude-plugins/buildkite.yml; a PreToolUse hook enforces it by intercepting bk CLI commands that overlap with bktide.
npx bktide@latest builds <org>/<pipeline> --branch <branch> --count 1 --format json
The newest build is .builds[0] (number, state, url). Without --branch it lists every branch. Snapshot its url.
Snapshot the URL, then:
Filter to root failures. Most builds have 1-3 root failures and dozens-to-hundreds of dependent BROKEN steps. Counting BROKEN/RUNNING steps as failures sends you down rabbit holes investigating noise.
First, see the state distribution:
jq -r '.steps[].state' ./tmp/bktide/snapshots/<org>/<pipeline>/<build>/manifest.json | sort | uniq -c | sort -rn
Only these are real failures:
FINISHED (or FAILED) AND non-zero exit_statusThese are NOT failures — do not count or investigate them:
Find actual root failures:
jq -r '.steps[] | select((.state == "FINISHED" or .state == "FAILED") and .exit_status != null and .exit_status != 0) | "\(.id): \(.label) (exit \(.exit_status))"' ./tmp/bktide/snapshots/<org>/<pipeline>/<build>/manifest.json
Example: A summary reads "466 steps: 43 passed, 397 failed, 361 running" — filtering reveals 1 actual failure (e.g. codeownership validation) and 396 BROKEN dependents. Fix the root and everything else passes.
Then read the failing step's steps/<step-id>/log.txt (or grep -r "Error\|Failed\|Exception" across steps/), and check annotations.json: large projects summarize test failures there, small ones usually have none. See references/buildkite-states.md and references/annotation-patterns.md.
mcp__MCPProxy__call_tool('buildkite:get_build', {
org_slug: '<org>',
pipeline_slug: '<pipeline>',
build_number: '<build-number>',
detail_level: 'detailed',
job_state: 'failed',
});
Match the job by label and take its uuid, then:
mcp__MCPProxy__call_tool('buildkite:get_logs', {
org_slug: '<org>',
pipeline_slug: '<pipeline>',
build_number: '<build-number>',
job_id: '<job-uuid>',
});
Common Issues:
sid=019a5f...). Job UUIDs come from get_build API responses.state field first.Right after git push the branch's newest build can still be the previous one, and builds JSON has no commit, so confirm the build is for HEAD with build --format json (.commit) before watching. --no-cache keeps each poll fresh. Run the whole block in the background:
sha=$(git rev-parse HEAD); build=
for _ in $(seq 20); do # about 5 minutes for the build to appear
n=$(npx bktide@latest builds <org>/<pipeline> --branch <branch> --count 1 --format json --no-cache | jq -r '.builds[0].number // empty')
if [ -n "$n" ] && [ "$(npx bktide@latest build "<org>/<pipeline>#$n" --format json --no-cache | jq -r .commit)" = "$sha" ]; then build=$n; break; fi
sleep 15
done
if [ -n "$build" ]; then npx bktide@latest build "<org>/<pipeline>#$build" --watch; else echo "no build for $sha" >&2; (exit 2); fi
Exit 0 means passed, 1 means anything else (failed, canceled, or --timeout <minutes> reached, default 30; the timeout prints Timeout reached), 2 means no build for HEAD appeared. MCP buildkite:wait_for_build (timeout: 1800, poll_interval: 30) also works where a Buildkite MCP server is connected. Don't poll in the foreground.
A blocked build waits on a manual step. Find the job with state: "blocked" in get_build (detail_level: "detailed"), check its label for what approval it needs, and unblock only if appropriate:
mcp__MCPProxy__call_tool('buildkite:unblock_job', {
org_slug: '<org>',
pipeline_slug: '<pipeline>',
build_number: '<build-number>',
job_id: '<job-id>',
fields: {}, // Optional form fields if the block step has inputs
});
:docker: Running /bin/sh -e -c '<command>' in service <service>; with shell trace on, look for + lines.env: blocks in .buildkite/pipeline.yml (or the buildkite-builder DSL), and Buildkite defaults like CI=true (references/buildkite-environment-variables.md).docker-compose run [-e CI=true ...] <service> <command>. Drop CI-only flags (--parallel 4 to 1, --format buildkite to progress) and skip buildkite-agent artifact download.env | sort, inspect artifacts (buildkite:list_artifacts, JUnit XML, coverage), or fix from logs and artifacts alone. Plugins for artifacts, notifications, or caching don't block local reproduction.Some events that feel like they should start a new build don't. GitHub's "ready for review" event, for example, does not trigger a new Buildkite build — only pushes do. If you need a build for the current state without a new commit, don't push an empty commit as a workaround; trigger one directly:
# Start a new build (auto-detects org/pipeline/commit/branch from the current git checkout)
npx bktide@latest build create
# Watch it through to completion
npx bktide@latest build create --watch
# Re-run an existing build with its original commit/branch/message
npx bktide@latest build rebuild <org>/<pipeline>/<build-number>
npx bktide@latest build rebuild <buildkite-build-url>
Flags (--commit, --branch, --message, --env) override git auto-detection; run bktide build create --help for the full list. This is the one write operation bktide supports — it's the direct replacement for bk build create/bk build retry, which the buildkite tool-preference hook blocks in favor of this command.
--helpevals/README.md (opens in a new tab)evals/eval_set.json (opens in a new tab)references/annotation-patterns.md (opens in a new tab)references/buildkite-environment-variables.md (opens in a new tab)references/buildkite-states.md (opens in a new tab)references/tool-capabilities.md (opens in a new tab)references/troubleshooting.md (opens in a new tab)references/url-parsing.md (opens in a new tab)scripts/find-commit-builds.js (opens in a new tab)scripts/get-build-logs.js (opens in a new tab)scripts/parse-buildkite-url.js (opens in a new tab)scripts/wait-for-build.js (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
2 skills in this plugin
npx claudepluginhub technicalpickles/pickled-claude-plugins --plugin buildkiteOther plugins' skills for the same job