Agent SkillsTerry-Mao/AICodingFlow › diagnose-ci-failures

diagnose-ci-failures

GitHub

诊断PR、分支或运行ID的CI失败,提取错误日志并生成修复计划。支持GitHub Actions URL、Run ID及分支输入,仅用于分析不修改代码。

.agents/skills/diagnose-ci-failures/SKILL.md Terry-Mao/AICodingFlow

Trigger Scenarios

检查CI状态 排查测试失败 调查PR构建故障 获取CI问题

Install

npx skills add Terry-Mao/AICodingFlow --skill diagnose-ci-failures -g -y
More Options

Non-standard path

npx skills add https://github.com/Terry-Mao/AICodingFlow/tree/main/.agents/skills/diagnose-ci-failures -g -y

Use without installing

npx skills use Terry-Mao/AICodingFlow@diagnose-ci-failures

指定 Agent (Claude Code)

npx skills add Terry-Mao/AICodingFlow --skill diagnose-ci-failures -a claude-code -g -y

安装 repo 全部 skill

npx skills add Terry-Mao/AICodingFlow --all -g -y

预览 repo 内 skill

npx skills add Terry-Mao/AICodingFlow --list

SKILL.md

Frontmatter
{
    "name": "diagnose-ci-failures",
    "description": "Diagnose CI failures for a PR, branch, run ID, or GitHub Actions run URL using the GitHub CLI, extract error logs, and generate a plan to fix them. Use when the user asks to check CI status, pull CI issues, triage test failures, or investigate PR build failures."
}

diagnose-ci-failures

Programmatically diagnose CI failures and generate a plan to fix them.

Overview

This skill provides a deterministic workflow to check CI status, extract failure logs, analyze errors, and create a plan to resolve issues. The output is always a plan document that can be reviewed before execution.

This skill is diagnosis-only. Do not make code changes, commits, pushes, or pull requests.

Workflow

1. Locate the failing CI target

Determine the CI target from the user's input.

If the user provides a GitHub Actions run URL, extract the run ID from the URL:

gh run view <run-id> --verbose

Example URL:

https://github.com/OWNER/REPO/actions/runs/RUN_ID

If the user provides a run ID directly:

gh run view <run-id> --verbose

If the user provides a branch name:

gh run list --branch <branch> --status failure --limit 5
gh run view <run-id> --verbose

If no branch, run ID, or URL is provided, use the current checkout. First check whether the current branch has an associated PR:

gh pr view --json number,title,url,state,statusCheckRollup

For a current PR branch, list failed PR checks:

gh pr view --json statusCheckRollup --jq '.statusCheckRollup[] | select(.conclusion == "FAILURE")'

If the current branch does not have an associated PR, fall back to recent failed workflow runs for the current branch:

git branch --show-current
gh run list --branch <branch> --status failure --limit 5
gh run view <run-id> --verbose

If no failed PR check or failed workflow run exists, report that no failing CI target was found and stop.

2. Check CI status

Fetch the status of all CI checks for the selected PR, branch, or run.

For a PR branch:

gh pr view --json statusCheckRollup

For a workflow run:

gh run view <run-id> --verbose

Parse the output to identify:

  • Completed checks
  • In-progress checks
  • Successful checks
  • Failed checks, including names, run IDs, job IDs, and details URLs when available

If CI is still running, inform the user which checks have already failed or passed, highlight checks still running, and suggest waiting for completion before final diagnosis.

3. Extract failure logs

For each failed run or failed check, pull failed-step logs:

gh run view <run-id> --log-failed

For deeper inspection when needed:

gh run view <run-id> --log --job <job-id>
gh run download <run-id> -D .artifacts/<run-id>

Focus on extracting:

  • Error messages and locations, including file paths and line numbers
  • Build or compilation errors
  • Linting or formatting failures
  • Test failure messages, failing test names, stack traces, and assertion output
  • Environment or CI setup failures, such as missing secrets, permissions, unavailable services, dependency installation failures, or resource limits

4. Categorize errors

Group errors by type:

  • Build/compilation errors: Type errors, syntax errors, missing imports, missing dependencies, incompatible versions, failed builds
  • Test failures: Failing tests, assertion failures, snapshot mismatches, timeouts, integration failures, flaky-looking behavior
  • Linting/formatting issues: Formatter failures, linter violations, unused code, style violations
  • Environment issues: Missing secrets, permissions, unavailable services, CI image problems, dependency download failures, resource limits, platform-specific setup issues

When tools are language-specific, mention them only as observed facts from the logs, not as assumptions.

5. Generate fix plan

Create a plan document with:

  • Problem Statement: Summary of failing checks or workflow runs
  • Current State: What errors were found, where they occur, and which checks are affected
  • Root Cause Analysis: The most likely cause of each failure category, based on the logs
  • Proposed Changes: Specific fixes needed for each error category
  • Validation Steps: Commands or CI checks that should be run to verify the fixes

Do not implement the fixes. The plan should be specific enough for a follow-up implementation task.

Important Notes

  • Always create a plan first. Never make code changes directly.
  • Prefer evidence from CI logs over local assumptions.
  • If tests fail locally but pass in CI, treat them as local/environment-specific unless CI logs show the same failure.
  • If CI logs show multiple unrelated failures, group them and recommend fixing one category at a time.
  • Avoid assuming a programming language, package manager, test framework, or build system until it is observed from repository files or CI logs.

Common CI Check Types

  • Formatting and linting
  • Unit tests
  • Integration tests
  • Build or package checks
  • Platform-specific tests
  • Deployment or artifact checks
  • CI summary or required-status checks

Example Commands

Get failed checks for the current PR branch:

gh pr view --json statusCheckRollup --jq '.statusCheckRollup[] | select(.conclusion == "FAILURE")'

Get recent failed runs for a branch:

gh run list --branch <branch> --status failure --limit 5

Inspect a specific run:

gh run view <run-id> --verbose

Get failed logs from a specific run:

gh run view <run-id> --log-failed

Inspect a specific failed job:

gh run view <run-id> --log --job <job-id>

Version History

  • e53c5ac Current 2026-07-24 11:35

Same Skill Collection

.agents/skills/bootstrap-issue-config/SKILL.md
.agents/skills/create-issue/SKILL.md
.agents/skills/create-pr/SKILL.md
.agents/skills/git-branch/SKILL.md
.agents/skills/git-commit/SKILL.md
.agents/skills/git-push/SKILL.md
.agents/skills/git-worktree/SKILL.md
.agents/skills/pr-walkthrough/SKILL.md
.agents/skills/resolve-merge-conflicts/SKILL.md
.agents/skills/review-pr-local/SKILL.md
.agents/skills/review-spec-local/SKILL.md
.agents/skills/spec-driven-implementation/SKILL.md
.agents/skills/write-product-spec/SKILL.md
.agents/skills/write-tech-spec/SKILL.md
.github/skills/check-impl-against-spec/SKILL.md
.github/skills/create-product-spec/SKILL.md
.github/skills/create-tech-spec/SKILL.md
.github/skills/dedupe-issue-repo/SKILL.md
.github/skills/dedupe-issue/SKILL.md
.github/skills/implement-issue/SKILL.md
.github/skills/implement-specs/SKILL.md
.github/skills/product-change-report/SKILL.md
.github/skills/product-docs-sync/SKILL.md
.github/skills/product-wiki/SKILL.md
.github/skills/review-pr-repo/SKILL.md
.github/skills/review-pr/SKILL.md
.github/skills/review-spec-repo/SKILL.md
.github/skills/review-spec/SKILL.md
.github/skills/security-review-pr/SKILL.md
.github/skills/security-review-spec/SKILL.md
.github/skills/triage-issue-repo/SKILL.md
.github/skills/triage-issue/SKILL.md
.github/skills/update-dedupe/SKILL.md
.github/skills/update-pr-review/SKILL.md
.github/skills/update-triage/SKILL.md

Metadata

Files
0
Version
e53c5ac
Hash
d9e87628
Indexed
2026-07-24 11:35

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-06 19:35
浙ICP备14020137号-1 $Гость$