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 - Run the CI fix loop unattended where possible. After CI passes, automatically consolidate [FIX PIPELINE] commits using the automated consolidation flow instead of prompting. If consolidation cannot be completed safely, stop with MISSING REQUIREMENT rather than leaving fix commits separate.Before Step 1, parse $ARGUMENTS. If --fixup is present, set FIXUP_MODE=true; if --auto is present, set AUTO_MODE=true; if --no-consolidate is present, set NO_CONSOLIDATE=true. If both --auto and --no-consolidate are present, stop with MISSING REQUIREMENT: choose either --auto to consolidate fix commits or --no-consolidate to keep them separate.
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 flag is set.
Read and follow the consolidation flow from references/consolidation-flow.md. This covers detecting [FIX PIPELINE] commits, choosing consolidation mode, mapping commits to targets, executing rebase, and force pushing. If AUTO_MODE=true, choose Automated without prompting; do not choose "Keep separate". On shared branches, consolidation still 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:
--auto: Working unattended, want [FIX PIPELINE] commits automatically consolidated once CI and review feedback are clear--fixup: Working alone, want clean history throughout, comfortable with force push--no-consolidate: Working in a context where history rewrite is undesirable and [FIX PIPELINE] commits should remain visibleUse 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.tools
Requires Linear MCP. Implements one Linear issue end to end, selects applicable code-review, convention, and PR-refactor gates, runs them to bounded convergence, verifies, and optionally opens the PR and iterates on CI and review feedback until green. Use when the user wants a single Linear issue taken from implementation through a clean Pull Request. Not for implementation-only work, SIW-tracked issues, stacked PRs, existing PR updates, or post-merge rollout.
development
Reviews PR and local changes for convention drift and overcaution against documented rules and mined peer-file practice. Use for new patterns, dependencies, abstractions, or defensive complexity that departs from established practice; every finding cites evidence. Supports --inline. Not for general code quality (use kramme:pr:code-review) or spec review (use kramme:siw:spec-audit --team).
testing
Charts huge or foggy initiatives into a local `.context` decision map and resolves one typed frontier ticket per session until the work is ready for SIW or another execution workflow. Use when the route to a destination cannot fit in one agent session or parallel workspaces need coordinated planning state. Not for clear specs, ordinary issue decomposition, implementation, or Linear-native tracking.
development
Investigates a question against primary sources and saves one cited Markdown artifact. Use for reading legwork: official docs/API facts, source-code or spec checks, standards, and first-party service behavior before planning or implementation. Not for making product or architecture decisions, implementing code, broad web search, secondary blog summaries, or uncited answers.