/idea-to-code:debugging-ci-failuresfrom idea-to-code
Guides watching CI builds to completion and diagnosing failures. Covers GitHub Actions and CircleCI with commands for polling, gathering evidence, and analyzing root causes.
Ships in idea-to-code. 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.
None: SKILL.md is the whole skill.
This skill covers two scenarios: watching a CI build to completion after a push, and diagnosing failures when a build fails.
Follow these steps in order:
TEST-*.xml files for the full stack trace and container logs.Phases 0 and 1 have CI-specific commands — see the "GitHub Actions" and "CircleCI" sections below. Phase 2 is CI-agnostic.
Check which CI system the project uses:
.github/workflows/*.yml → GitHub Actions.circleci/config.yml → CircleCIFor CircleCI, extract the org and repo from git remote get-url origin to construct API URLs.
Use the gh CLI (no caching issues).
Poll for the latest run on the branch:
gh run list --branch <branch> --limit 1 --json status,conclusion,databaseId,name
Then poll the specific run until it completes:
gh run view <run-id> --json status,conclusion,jobs
Repeat every 10-15 seconds until status is completed. Then check conclusion for success or failure.
If the build failed, proceed to Phase 1.
Step 1: Get the failed job summary
gh run view <run-id> --log-failed 2>&1 | grep -i "FAILED\|error\|Exception" | head -30
This gives you the failing task/test name and a high-level error.
Step 2: Download test artifacts
Test results are often saved via actions/upload-artifact, frequently inside a composite or reusable action rather than the workflow file itself. Do not decide whether artifacts exist by reading the workflow definition. List the run's artifacts:
gh api repos/<owner>/<repo>/actions/runs/<run-id>/artifacts --jq '.artifacts[] | {name, size_in_bytes}'
Then download the one containing test results:
gh run download <run-id> --name <artifact-name> --dir test-reports
Step 3: Read the TEST-*.xml files — see "Reading TEST-*.xml files" below.
Use the circleci CLI. It has no caching issues (unlike WebFetch) and returns proper exit codes.
The project slug has the form gh/<org>/<repo> (e.g., gh/eventuate-foundation/eventuate-common). When run from inside the project's git checkout, the CLI infers the slug from the git remote and --project can be omitted.
circleci run watch blocks until the run reaches a terminal state and its exit code reflects the outcome:
0 — all workflows succeeded1 — one or more workflows failed6 — cancelled8 — timed outcircleci run watch --project gh/<org>/<repo> --branch <branch>
Or, from inside the project after git push:
circleci run watch --sha $(git rev-parse HEAD)
If you need to poll instead of block (e.g., interleaving other work), use run list + run get:
circleci run list --project gh/<org>/<repo> --branch <branch> --limit 1 --json --jq '.[0] | {id, phase, outcome}'
circleci run get <run-id> --json --jq '{phase, workflows: [.workflows[] | {name, phase, jobs: [.jobs[] | {id, name, phase, outcome}]}]}'
If the build failed, proceed to Phase 1.
Step 1: Identify the failing job(s)
circleci run get <run-id> --json --jq '.workflows[].jobs[] | select(.outcome == "failed")'
Step 2: Get the failed step and its output
List the job's steps and find the one with a non-zero exit code:
circleci job output list <job-id> --json --jq '.steps[] | select(.exit_code != 0) | {num, name, exit_code}'
Then fetch that step's output. Use --condensed for an AI-friendly filtered view:
circleci job output get <job-id> --step-num <N> --condensed
Step 3: Check parsed test results
If the job uses store_test_results, CircleCI has already parsed them — this may be enough to identify the failing test without downloading anything:
circleci testresult list <job-id>
Step 4: Download test artifacts
List artifacts, then download into a project-relative directory:
circleci artifact <job-id> --json
circleci artifact <job-id> --output test-reports
Step 5: Read the TEST-*.xml files — see "Reading TEST-*.xml files" below.
Find and read the relevant TEST-*.xml file for the failing test. These files contain:
Testcontainers-based tests typically configure .withLogConsumer(new Slf4jLogConsumer(logger).withPrefix("SVC <service-name>")), so container logs appear in the XML prefixed with [SVC <service-name>]. Use this prefix to filter for the specific container's output when searching for errors.
Use the Glob tool to find the relevant test result:
Glob with pattern="**/TEST-*FailingTestName*.xml" path="test-reports"
Use the Grep tool to search within large XML files for the root cause:
Grep with pattern="ERROR|Exception|FATAL|Application run failed" path="test-reports/path/to/TEST-*.xml" output_mode="content"
Do NOT read HTML reports — they are for humans in browsers. The XML files contain the same information in a machine-readable format.
Do NOT download artifacts to /tmp or other directories outside the sandbox — download to a project-relative path like test-reports/.
Only after gathering evidence, analyze it systematically.
Look past the test framework wrappers. A typical failure chain looks like:
TestName > testMethod() FAILED
IllegalStateException ← symptom (Spring context failed)
CompletionException ← symptom (async wrapper)
ContainerLaunchException ← symptom (container didn't start)
THE ACTUAL ERROR ← root cause (e.g., missing bean, bad config, JDK bug)
Read the full chain — the root cause is at the bottom.
FROM-CACHE in a previous run means it wasn't re-executed then — it may have been broken alreadyFileNotFoundException for a .yml file is different from a missing .class filegrep or read of the test XML will give you the answerjava_version_to_install, machine_image). Compare with other upgraded projects that use the same orb.When fixing issues caused by naming conventions or patterns:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub humansintheloop-dev/humansintheloop-dev-workflow-and-tools --plugin idea-to-code24 skills in this plugin
/apply-design-patternsConsult the design pattern catalog before implementing or refactoring code./ask-a-friendWhen stuck on a problem, formulate a well-structured question and copy it to the clipboard for pasting into ChatGPT. Claude should use this skill when debugging efforts stall or when an outside perspective would help./brainstorm-ideaUse when refining an idea in an idea directory through questions and answers and classifying it.Other plugins' skills for the same job