A community-driven registry for Claude, Cursor, Windsurf, Cline & more. Not affiliated with Anthropic.
Are you the author? Sign in to claim
An example pipeline that uses dynamic pipelines and Claude Code to automatically diagnose and fix broken PR builds.
This example demonstrates a self-healing pipeline built with Buildkite dynamic pipelines and Claude Code. When a PR build fails, adding a label triggers an AI agent that automatically diagnoses the failure and submits a fix.
👉 See this example in action: buildkite/self-healing-pipeline-example
buildkite-fix label to a GitHub PR that has a failing buildbuildkite-agent pipeline uploadgh CLI)The core of the handler is short — read the webhook payload from build metadata, evaluate whether to act, and generate a step with the Buildkite SDK:
// 1. Read the webhook payload that Buildkite stored as build metadata
const payload = JSON.parse(
execSync("buildkite-agent meta-data get buildkite:webhook").toString(),
);
// 2. Evaluate the condition — right event, right label?
if (payload.action !== "labeled" || payload.label.name !== process.env.TRIGGER_ON_LABEL) {
process.exit(0);
}
// 3. Generate a step with the Buildkite SDK and pipe it into `pipeline upload`
const pipeline = new Pipeline();
pipeline.addStep({ label: ":robot_face: Fix the build", command: "scripts/claude.sh" });
execSync("buildkite-agent pipeline upload", { input: pipeline.toYAML() });
The real handler also calls the Buildkite API between steps 2 and 3 to confirm there's an actual failing build on the PR's head commit — see scripts/handler.ts.
The key Buildkite features at play:
buildkite-agent pipeline upload — adding steps to a running build based on runtime conditionsbuildkite-agent meta-data — reading webhook payloads stored as build metadata@buildkite/buildkite-sdk — programmatically generating pipeline YAML in TypeScriptThis pipeline doesn't have a fixed set of steps. Whether anything happens at all depends on the webhook payload and the state of the builds at that moment. That's the core idea behind dynamic pipelines — your pipeline logic runs at build time and decides what to do based on real conditions, not static YAML.
The self-healing use case takes this further: the pipeline not only decides whether to act, it decides what to do by handing the problem to an AI agent. This is one pattern for building agentic CI/CD workflows on Buildkite.
To run this yourself, you'll need:
pull_request events with the labeled action to BuildkiteGITHUB_TOKEN and BUILDKITE_API_TOKENbuildkite-fix label to a PR with a failing build and watch it goOriginally built by Grant Colegate and Christian Nunciato as a demo for AWS re:Invent.
See LICENSE (MIT)
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots
MCP server integration for DaVinci Resolve Studio
A Jetbrains IDE IntelliJ plugin aimed to provide coding agents the ability to leverage intelliJ's indexing of the codeba