kramme-cc-workflow/skills/kramme:pr:fix-ci/SKILL.md
Iterate on a PR until CI passes. Use when you need to fix CI failures, address review feedback, or continuously push fixes until all checks are green. Automates the feedback-fix-push-wait cycle.
npx skillsauth add abildtoft/kramme-cc-workflow kramme:pr:fix-ciInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Continuously iterate on the current branch until all CI checks pass and review feedback is addressed.
Requires: GitHub CLI (gh) authenticated and available.
"A bug caught in linting costs minutes; the same bug caught in production costs hours."
"Smaller batches and more frequent releases reduce risk, not increase it."
The fix-CI loop is the CI Failure Feedback Loop pattern: read the failure, make a minimal fix, push, wait, repeat. This skill automates that loop so failures are surfaced and corrected in minutes instead of accumulating across a days-long review cycle.
Flags:
--fixup - Use fixup commits to amend existing branch commits instead of creating new commits. Requires force push. Orphan files (not touched by any branch commit, including files last modified on the base branch) are committed as new.--no-consolidate - Skip the consolidation prompt after CI passes. Use for scripting or when you want to keep [FIX PIPELINE] commits separate.--auto - Alias for --no-consolidate. Runs the CI fix loop unattended where possible and keeps [FIX PIPELINE] commits separate instead of prompting for history rewrite.gh pr view --json number,url,headRefName,baseRefName
PR_NUMBER=$(gh pr view --json number --jq .number)
If no PR exists for the current branch, stop and inform the user. Keep PR_NUMBER for Step 4.
A stale branch can produce CI failures unrelated to the PR, wasting iteration cycles. Catch this before iterating.
BASE=$(gh pr view --json baseRefName --jq .baseRefName)
git fetch origin "$BASE"
git rev-list --left-right --count "origin/$BASE"...HEAD
If the left count is non-zero (the base has commits not in the branch), inspect what moved (git log --name-only HEAD.."origin/$BASE"). Only stop if the base movement plausibly affects CI for this PR — it touches the same files or directories the branch changes, CI workflow/config files, lockfiles, or shared build tooling. In that case, point the user at /kramme:pr:rebase before proceeding. Otherwise note the drift and continue iterating.
Before starting the fix loop, snapshot the pre-existing working-tree state so Step 8 can keep it out of fix commits:
git status --porcelain
Record this output as the pre-existing dirty state. Any file already modified or untracked here was not produced by the fix loop and must never be swept into a [FIX PIPELINE] commit.
gh pr checks --json name,state,bucket,link,workflow
The bucket field categorizes state into: pass, fail, pending, skipping, or cancel.
Important: If any post-hoc review-commenting bots still have pending checks, wait before proceeding. These are services that post additional feedback comments to the PR once their checks complete — error trackers, coverage reporters, AI review bots, and hosted linter/code-analysis services (e.g. Sentry, Codecov, Cursor Bugbot, Seer). Key the wait on the category — does this check belong to a service that comments after completion? — not on any specific bot name. Waiting avoids duplicate work.
gh api auto-expands {owner} and {repo} from the current repo context. Substitute $PR_NUMBER (captured in Step 1) where the PR number is needed.
Review comments and status:
gh pr view --json reviews,comments,reviewDecision
Inline code review comments:
gh api "repos/{owner}/{repo}/pulls/$PR_NUMBER/comments"
PR conversation comments (includes bot comments):
gh api "repos/{owner}/{repo}/issues/$PR_NUMBER/comments"
# List recent runs for this branch
gh run list --branch "$(git branch --show-current)" --limit 5 --json databaseId,name,status,conclusion
# View failed logs for a specific run (substitute the databaseId from above)
gh run view "$RUN_ID" --log-failed
Do NOT assume what failed based on the check name alone. Always read the actual logs.
For each piece of feedback (CI failure or review comment):
Make minimal, targeted code changes. Only fix what is actually broken.
If --fixup mode is enabled: See Step 8b below.
Default (no flag):
Stage only the files the fix loop actually edited in Step 7 — never git add -A, which would sweep pre-existing uncommitted work (including untracked .env-style files) into pushed commits:
git add <file1> <file2> ...
git commit -m "[FIX PIPELINE] <descriptive message of what was fixed>"
git push origin "$(git branch --show-current)"
Compare git status --porcelain against the pre-existing dirty state snapshot from Step 2: files that were already modified or untracked before the loop started stay uncommitted. If such pre-existing state exists, warn the user (once) that it is being left untouched.
The [FIX PIPELINE] prefix marks commits as iteration fixes from CI or review feedback, making them easy to identify and consolidate later (see Step 11).
--fixup is enabled)Read and follow the fixup commit flow from references/fixup-flow.md. This covers base branch detection, file-to-commit mapping, fixup commit creation, autosquash rebase, and force push with lease. Shared branches still require explicit collaborator coordination before any history rewrite or force push.
gh pr checks --watch --interval 30
This waits until all checks complete. Exit code 0 means all passed, exit code 1 means failures.
If the watch hangs well past expected runtimes (rule of thumb: >30 minutes for a typical PR pipeline), a check is likely stuck pending — runner outage, missing webhook, or an external bot that never reported back. Cancel the watch, name the stuck check, and surface CONFUSION so the user can decide whether to retry, ignore, or escalate.
Return to Step 3 if:
Continue until all checks pass and no unaddressed feedback remains.
Skip this step if: --fixup mode was used, or --no-consolidate / --auto flag is set.
Read and follow the consolidation flow from references/consolidation-flow.md. This covers detecting [FIX PIPELINE] commits, prompting the user for consolidation options (automated, interactive, or keep separate), mapping commits to targets, executing rebase, and force pushing. On shared branches, consolidation requires explicit coordination before any history rewrite.
"No gate can be skipped. If lint fails, fix lint — don't disable the rule."
A failing gate is signalling a real problem until proven otherwise. The fix is to fix the gate, not to silence it.
Do not silently:
--no-verify or equivalent flags.eslint-disable, # noqa, @ts-ignore, or a similar suppression comment to silence the specific failure.If disablement is genuinely warranted — a confirmed false positive, a test that asserts old behavior the PR intentionally changes, a rule the team agrees to retire — stop and surface a MISSING REQUIREMENT marker with the rationale. Get explicit user approval before committing the disablement. The user may approve, redirect, or provide a different fix. Silent disablement is never the answer.
Success:
Ask for Help:
Stop Immediately:
/kramme:pr:rebase)GitHub:
gh pr checks --required to focus only on required checksgh run view <run-id> --verbose to see all job steps, not just failureslink field provides the URLChoosing a mode:
--fixup: Working alone, want clean history throughout, comfortable with force pushUse these markers so the user (and downstream tooling) can skim status at a glance. They are a plugin-wide convention for Addy-ported skills. Use them verbatim (uppercase, no decoration), one marker per line.
UNVERIFIED: log output was truncated at 500 lines; couldn't confirm the full failure trace.NOTICED BUT NOT TOUCHING: the flaky integration test on macOS has been red on main for a week, but it's outside this PR.CONFUSION: the job timed out after 10 minutes; is this a test regression or a runner issue?MISSING REQUIREMENT: the lint rule looks like a false positive, but disabling it requires your approval — proceed or redirect?Watch for these excuses — they signal the loop is slipping into damage.
| Excuse | Reality |
| --- | --- |
| "Just disable the lint rule to unblock the PR." | Silently disabling a gate is how quality erodes across PRs. Fix the root cause or surface MISSING REQUIREMENT. |
| "The check is flaky, I'll retry it." | Retry once. If it fails again, treat it as real until you've read the logs and can name the infrastructure cause. |
| "The failure is unrelated to my PR." | Maybe. Confirm with log evidence — git-blame the failing assertion, check main's CI history — not with assumption. |
| "The reviewer bot is wrong." | Reviewers and bots can be wrong, but verify by reading the relevant code first. A dismissal without evidence is hand-waving. |
| "I'll fix it in a follow-up." | Follow-ups are negotiable. A red CI blocking the merge is not. Land the fix or mark the failure NOTICED BUT NOT TOUCHING with a real reason. |
| "--no-verify just this once." | "Just this once" is how precedents form. Ask instead. |
Pause and escalate if any of these are true:
--no-verify, eslint-disable, # noqa, @ts-ignore, or a skip-marker without explicit user approval.--fixup mode or after consolidation.[FIX PIPELINE] commit.Before handing off, confirm:
[FIX PIPELINE] commit references a concrete issue you verified: either a CI failure whose logs you read or a review finding you validated against the code.UNVERIFIED, CONFUSION, or MISSING REQUIREMENT markers are unresolved.[FIX PIPELINE] commit.--force-with-lease and the branch either is not shared, or shared collaborators were coordinated with.NOTICED BUT NOT TOUCHING rationale.development
Runs kramme:pr:code-review as a closeout review loop for local or PR branch changes before commit, ship, or final response. Use when the user asks for autoreview, second-model review, or a final code-review pass after non-trivial edits. Not for UX, visual, accessibility, or product review.
development
Guides topic-level understanding verification for a PR, branch, feature, document, spec, design decision, bug fix, or other concrete subject. Use when the user asks to confirm, quiz, drill, teach-and-check, or verify that they understand a topic. Maintains a topic-specific checklist artifact and requires demonstrated understanding before marking the topic complete. Not for ordinary explanations without verification, end-of-session summaries, or code/test correctness checks.
testing
Design a CI/CD pipeline with quality gates, a <10-minute budget, feature-flag lifecycle, and an exit checklist. Use when adding a new CI pipeline, changing gate configuration, or planning a rollout for a new service. Complementary to kramme:pr:fix-ci (which fixes failures in an existing pipeline). Covers gate ordering, secrets storage, branch protection, rollback mechanism, and staged-rollout guardrails — not a rollout-execution runbook.
tools
--- name: kramme:visual:demo-reel description: Capture local demo evidence for observable product behavior: screenshots, before/after image sets, browser reels, terminal recordings, and short GIF/video proof. Use when shipping UI changes, CLI features, or any change where PR reviewers would benefit from visual or behavioral evidence. argument-hint: "[what to capture] [--url <url>|auto] [--tier static|before-after|browser-reel|terminal-recording]" disable-model-invocation: true user-invocable: tr