ci-prep
Prepares the current branch for CI by running the exact same steps locally and fixing issues. If CI is already failing, fetches the GH Actions logs first to diagnose. Use before pushing, when CI is red, or when the user says "fix ci".
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 68
- Forks
- 4
01 前言 Front Matter
- name
- ci-prep
- description
- Prepares the current branch for CI by running the exact same steps locally and fixing issues. If CI is already failing, fetches the GH Actions logs first to diagnose. Use before pushing, when CI is red, or when the user says "fix ci".
- argument-hint
- [--failing] [optional job name to focus on]
02 资源文件 1
- 参考文档reference.md1.8 KB
03 SKILL.md 正文
<!-- agent-pmo:795a9c2 -->
CI Prep
Prepare the current state for CI. If CI is already failing, fetch and analyze the logs first.
Arguments
--failing— Indicates a GitHub Actions run is already failing. When present, you MUST execute Step 1 before doing anything else.- Any other argument is treated as a job name to focus on (but all failures are still reported).
If --failing is NOT passed, skip directly to Step 2.
Step 1 — Fetch failed CI logs (only when --failing)
You MUST do this before any other work.
BRANCH=$(git branch --show-current)
PR_JSON=$(gh pr list --head "$BRANCH" --state open --json number,title,url --limit 1)
If the JSON array is empty, stop immediately:
No open PR found for branch
$BRANCH. Create a PR first.
Otherwise fetch the logs:
PR_NUMBER=$(echo "$PR_JSON" | jq -r '.[0].number')
gh pr checks "$PR_NUMBER"
RUN_ID=$(gh run list --branch "$BRANCH" --limit 1 --json databaseId --jq '.[0].databaseId')
gh run view "$RUN_ID"
gh run view "$RUN_ID" --log-failed
Read every line of --log-failed output. For each failure note the exact file, line, and error message. If a job name argument was provided, prioritize that job but still report all failures.
Step 2 — Analyze the CI workflow
- Find the CI workflow file. Look in
.github/workflows/forci.yml,build.yml,test.yml,checks.yml,main.yml,pull_request.yml, or any workflow triggered onpull_requestorpush. - Read the workflow file completely. Parse every job and every step.
- Extract the ordered list of commands the CI actually runs. In a spec-compliant repo this is
make lint → make test → make build(REPO-STANDARDS-SPEC [MAKE-TARGETS]), but the actual CI may usenpm,cargo,dotnet, raw shell commands, or anything else. Extract what is actually there. - Note any environment variables, matrix strategies, or conditional steps that affect execution.
Do NOT assume the steps are make lint, make test, make build. The actual CI may run different commands, in a different order. Extract what the CI actually does. If you find extra targets beyond the 7 in [MAKE-TARGETS] (e.g. make fmt-check, make coverage-check), flag them in your final report — they should be consolidated by the agent-pmo skill.
Release workflow blocker scan
If .github/workflows/release.yml exists, scan it before broad local CI. These are critical blockers
and must be fixed before release work is considered CI-ready:
- Tag-triggered jobs checking out
ref: maininstead of the tagged SHA. - Any
git commit,git push, branch mutation, or tag mutation during release. - Version bump commits after the tag already exists.
- Ad hoc
sedversion stamping of structured files instead of a first-class stamper/build input. - Missing tests that pass a test version into the same stamper used by release.
- Native VSIX releases without Node
22.x,npx vsce package --target <vsceTarget>, one VSIX per target, target-suffixed filenames, and package-content verification. - VS Code native-binary activation that reads or mutates PATH, uses package-manager/global installs as normal startup sources, or copies bundled VSIX binaries after install.
Step 3 — Run each CI step locally, in order
Work through failures in this priority order:
- Formatting — run auto-formatters first to clear noise
- Compilation errors — must compile before lint/test
- Lint violations — fix the code pattern
- Runtime / test failures — fix source code to satisfy the test
For each command extracted from the CI workflow:
- Run the command exactly as CI would run it (adjusting only for local environment differences like not needing
actions/checkout). - If the step fails, stop and fix the issues before continuing to the next step.
- After fixing, re-run the same step to confirm it passes.
- Move to the next step only after the current one succeeds.
Hard constraints
- NEVER modify test files unless you are absolutely certain that the test is INCORRECT — fix the source code, not the tests
- NEVER add suppressions (
#[allow(...)],// eslint-disable,#pragma warning disable) - NEVER use
anyin TypeScript to silence type errors - NEVER delete or ignore failing tests
- NEVER remove assertions
If stuck on the same failure after 5 attempts, ask the user for help.
Step 4 — Report
- List every step that was run and its result (pass/fail/fixed).
- If any step could not be fixed, report what failed and why.
- Confirm whether the branch is ready to push.
Step 5 — Remote CI follow-up (only when --failing)
Once all CI steps pass locally:
- Report the local fixes and exact commands that now pass.
- Do not commit or push. The user owns source-control writes.
- If the user pushes, monitor the new run until completion or failure.
- Upon failure, go back to Step 1.
Rules
- Always read the CI workflow first. Never assume what commands CI runs.
- Do not commit or push from this skill.
- Fix issues found in each step before moving to the next
- Never skip steps or suppress errors
- If the CI workflow has multiple jobs, run all of them (respecting dependency order)
- Skip steps that are CI-infrastructure-only (checkout, setup-node/python/rust actions, cache steps, artifact uploads) — focus on the actual build/test/lint commands
Success criteria
- Every command that CI runs has been executed locally and passed
- All fixes are applied to the working tree
- The CI passes successfully (if you are correcting and existing failure)
04 同仓库更多 Skills
网站 SEO 审计优化
website-audit
对网站进行 SEO、AI 搜索性能、结构化数据、移动端可用性、断链和社交媒体卡片方面的审计,并修复发现的问题。当用户提到"审计网站"、"SEO"、"修复搜索排名"、"AI 搜索"、"结构化数据"、"社交媒体卡片"或"网站性能"时使用。
依赖包升级更新
upgrade-packages
将检测到语言的所有依赖项/包升级到最新版本。当用户说"升级包"、"更新依赖"、"提升版本"、"更新包"或"升级依赖"时使用。
创建并提交 Pull Request
submit-pr
在验证 CI 通过后,创建带有结构清晰描述的拉取请求(pull request)。当用户要求提交、创建或打开拉取请求时使用。
规格文档与代码一致性审查
spec-check
根据代码库审计规格/计划文档。确保每个规格章节都有对应的实现代码、测试和匹配的逻辑。当用户说“检查规格”(check specs)、“规格审计”(spec audit)或“验证规格”(verify specs)时使用。
测试驱动修复 Bug
fix-bug
使用测试驱动开发(TDD)修复 Bug。当用户报告 Bug、描述意外行为、想要修复缺陷或说某处出问题时使用。强制执行严格的测试优先工作流:在尝试任何修复之前,必须先编写并验证一个失败的测试。
重复代码与死代码清理
code-dedup
搜索重复代码、重复测试和死代码,然后安全地合并或移除它们。当用户说“去重”(deduplicate)、“查找重复”(find duplicates)、“移除死代码”(remove dead code)、“DRY 化”(DRY up)或“代码去重”(code dedup)时使用。需要有测试覆盖——拒绝修改未经测试的代码。