/core-skills:failed-build-analysisfrom core-skills
Queries failed CI/CD build jobs on an open PR, identifies the root cause of each failure, and produces a KISS + TDD implementation plan to fix them. Auto-invoked when a user mentions a failing build, broken CI, or failed PR checks.
Ships in core-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.
Analyse failed CI/CD build jobs on an open PR, identify root causes, and produce a
KISS + TDD implementation plan to fix them. Works from pasted logs (Codex, Claude Web)
or live gh CLI calls (Claude Code, Cursor with terminal).
Auto-invoke when the user says any of:
Manual invoke: /failed-build-analysis [pr-number-or-url]
If shell.exec is available (Claude Code, Cursor with terminal):
# 1. See all check statuses on the PR at a glance
# Omit PR_NUMBER if already on the PR branch
gh pr checks [PR_NUMBER]
gh pr checks [PR_NUMBER] --json name,state,description,link # scriptable
# 2. Resolve the PR's current head SHA, then find failed runs for that exact commit
SHA=$(gh pr view [PR_NUMBER] --json headRefOid --jq .headRefOid)
gh run list --commit "$SHA" --status failure \
--json databaseId,name,workflowName,createdAt --limit 10
# 3. For each failed RUN_ID — pull only the failed-step logs
gh run view $RUN_ID --log-failed
# If you need to drill into a specific job inside the run:
gh run view $RUN_ID --json jobs # list job IDs
gh run view --job $JOB_ID --log-failed # logs for that job only
# If you need the full run log (verbose):
gh run view $RUN_ID --log
Note:
gh run view --log-failedcan occasionally showUNKNOWN STEPor return incomplete data when the GitHub platform has log delivery issues. Fall back to--logor--verboseif a job's output is missing.
If only network.http is available:
Use GitHub Actions REST API:
GET /repos/{owner}/{repo}/actions/runs?head_sha={SHA}&status=failureGET /repos/{owner}/{repo}/actions/jobs/{job_id}/logsIf neither is available (prompt-only / Codex / Claude Web): Ask the user to paste the full build log or relevant error section. Proceed with the pasted content — no tooling required.
For each failed job extract:
lint, type-check, test, build, deploy, infraGroup related errors that share the same root cause — they get one fix entry.
For each unique failure group:
Produce a numbered, ordered plan. Each step is atomic and independently verifiable.
Format each step as:
N. [CATEGORY] What to do
- Why: reason this step is needed
- TDD: write/run this test first to confirm the failure, then make it green
- File(s): path/to/affected/file.ext
- Verify: exact command to confirm the step passes
KISS principles to enforce:
TDD order for every fix:
Emit two clearly delimited sections:
Job: <name> | Workflow: <workflow> | Type: <lint|type-check|test|build|deploy>
Root cause: <one sentence>
Affected: <N files / N tests>
Log excerpt: "<exact error line>"
One block per unique failure group.
1. [TEST] Write failing test reproducing <issue>
- Why: confirms root cause before touching production code
- TDD: <exact test command>
- File: <path>
- Verify: test fails with the same message as CI
2. [FIX] <minimal change — one sentence>
- Why: <reason>
- File: <path>:<line>
- Verify: <exact command> → green
3. [VERIFY] Full suite
- Verify: <test command> → all green, zero new failures
4. [COMMIT] git commit -m "fix: <one-line description of what was broken"
End with:
Input: PR #142 failing; job: test / unit
TypeError: Cannot read properties of undefined (reading 'send')
at UserService.notifyUser (src/services/user.service.ts:34)
at src/services/user.service.test.ts:22
Output:
FAILURE SUMMARY
Job: test / unit | Workflow: CI | Type: test
Root cause: `mailer.send` called in UserService but jest.mock('../mailer') is absent
in user.service.test.ts — the real module is imported, which has no send method
in the test environment.
Affected: 1 file / 4 tests
Log excerpt: "TypeError: Cannot read properties of undefined (reading 'send')"
FIX PLAN
1. [TEST] Reproduce in isolation
- Why: Confirm the exact mock gap before editing production code
- TDD: npx jest src/services/user.service.test.ts
- File: src/services/user.service.test.ts
- Verify: test fails with "Cannot read properties of undefined (reading 'send')"
2. [FIX] Add `jest.mock('../mailer')` at the top of the test file
- Why: Jest needs explicit mock registration; auto-mocking is off by default
- File: src/services/user.service.test.ts:1
- Verify: npx jest src/services/user.service.test.ts → 4 tests green
3. [VERIFY] Full suite
- Verify: npm test → all green
4. [COMMIT] git commit -m "fix: mock mailer in user.service tests"
Confidence: High
Input: Pasted log:
error TS2345: Argument of type 'string' is not assignable to
parameter of type 'number' at src/utils/format.ts:18
Output:
FAILURE SUMMARY
Job: build / tsc | Workflow: CI | Type: type-check
Root cause: formatAmount() called with a string value; its signature requires number.
A recent refactor removed the implicit Number() coercion at the call site.
Affected: 1 file
Log excerpt: "error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'"
FIX PLAN
1. [TEST] Add a type-level reproduction
- TDD: npx tsc --noEmit → confirm TS2345 at src/utils/format.ts:18
- File: src/utils/format.ts
- Verify: error appears at exactly that line
2. [FIX] Coerce the value at the call site: `formatAmount(Number(rawValue))`
- Why: Smallest fix; keeps the function signature strict for other callers
- File: src/utils/format.ts:18
- Verify: npx tsc --noEmit → 0 errors
3. [VERIFY] npm test → all green
4. [COMMIT] git commit -m "fix: coerce string to number before formatAmount call"
Confidence: High
What SKILL.md sets; muted values are Claude Code's defaults
35 skills in this plugin
/autoresearchAutonomously optimise any skill by running it repeatedly, scoring outputs against
binary evals, mutating the prompt, and keeping improvements. Based on Karpathy's
autoresearch methodology.
Use when: "optimise this skill", "improve this skill", "run autoresearch on",
"make this skill better", "self-improve skill", "benchmark skill", "eval my skill",
"run evals on". Outputs: an improved SKILL.md copy, a results log, and a changelog
of every mutation tried.
/changelogWhen to useGenerate structured changelog entries from git history, grouping commits by conventional prefix and flagging breaking changes./Other plugins' skills for the same job
npx claudepluginhub internet-dot/ai-config-os --plugin core-skills