thinkhard.SI

Prompt repository Engineering & code

Brief a coding agent to fix a failing CI build

Your continuous integration pipeline is red on a branch or on main, and you want the cause found and fixed without the checks being switched off.

Registry no.
ENG-022
Collection
Engineering & code
Laid out for
Coding agent
Score
10 out of 10
Blanks to fill
6
Added

Engineering & codeCode agent

The prompt

Score 10 of 10, Excellent

Use it when Your continuous integration pipeline is red on a branch or on main, and you want the cause found and fixed without the checks being switched off.

  • {{branch}}
  • {{ci_job}}
  • {{ci_log}}
  • {{recent_changes}}
  • {{local_commands}}
  • {{off_limits}}
Full prompt and why it works
Prompt
Goal: Make the failing CI pipeline on {{branch}} pass again by fixing the cause of the failure, so that the team can merge with checks they trust.

Context:
- CI system and the job that fails: {{ci_job}} (for example .github/workflows/ci.yml, job "test")
- The failing step's log:
"""
{{ci_log}}
"""
- When it started failing, and what changed around then, as far as I know: {{recent_changes}}
- Commands that run the same checks locally: {{local_commands}}

Constraints:
- Reproduce first. Run the failing step locally with the versions CI uses: read the workflow file for the runtime, package manager, tool versions and environment variables. If it passes locally, compare the two environments and report the difference before changing anything.
- Find the cause and explain it in 2 to 3 sentences before editing. Common causes include a dependency that published a new version, a lockfile out of date with the manifest, a tool version that differs between CI and local, a test that depends on time or order, and a missing environment variable or secret.
- Fix the cause in the code, the lockfile or a pinned version. Do not disable, skip or delete the failing check, lower a coverage or lint threshold, add retries, or mark a job as allowed to fail.
- Change the CI configuration only if the cause is in it, and explain the change. Never print, echo or change secrets.
- Do not touch {{off_limits}}.

Done when:
- The step that failed passes locally with the CI versions.
- The full local check passes: {{local_commands}}

Verify: run the commands, read the output and iterate until they pass. Then report in this format: Cause, Fix, Files changed, Commands run with the last 20 lines of their output, and anything I must do in CI myself, such as adding a secret or clearing a cache. If the failure comes from an outside service, such as a package registry outage, or needs access you do not have, stop and tell me instead of working around it.

Variables

{{branch}}
The branch whose pipeline fails, for example main or feature/billing-export.
{{ci_job}}
The CI system and the failing workflow or job, for example "GitHub Actions, ci.yml, job test".
{{ci_log}}
The log of the failing step, in full or from the first error onward.
{{recent_changes}}
What changed around the time it started failing, such as merged pull requests or a new dependency, or "not sure".
{{local_commands}}
The commands that run the same checks locally, for example npm ci && npm test && npm run lint.
{{off_limits}}
Files, folders or settings that must not change, for example the deploy jobs or branch protection rules.

Why it works

  • What to avoid. Skipping the check, lowering thresholds, retries and allowed failures are all ruled out, the usual ways a red build is turned green without being fixed.
  • Background facts. The agent reproduces the failure with the versions the workflow file names, since most failures that happen only in CI come from a difference between CI and the laptop.
  • If unsure. An outage in an outside service, or anything that needs secrets or access, stops the agent with a report instead of a workaround.

How to use it

  1. Press Fill in variables and type your details into each blank. What you type stays in this browser.
  2. Copy the filled prompt into the AI tool you already use, such as ChatGPT, Claude or Gemini, or open it in the Grader or the Prompt Tester here.
  3. Before you rely on it, try it on three or four real examples. The Prompt Tester runs them all at once and shows which ones go wrong.
Use it from code

Get this prompt as JSON from the free REST API, with your own text in the blanks, or let an AI assistant fetch it through the MCP server. No key.

curl -s https://thinkhard.si/api/v1/prompts/coding-agent-fix-failing-ci

With the MCP server added to Claude, ChatGPT, Cursor or VS Code, call get_prompt with {"prompt": "coding-agent-fix-failing-ci"}, or just ask for it by name.