Implement comprehensive error handling for Python code paths to keep services resilient and user-friendly. Use when failures are currently silent or exceptions leak through.
日本語の概要は準備中です。原文の説明を表示しています。
Diagnose and fix CI failures without leaving your editor.
インストールする前に、エージェントに与えられる指示の中身を確認できます。
I help you diagnose and fix failing CI runs without switching context to the GitHub Actions UI:
gh run view --log-failed, or target a specific run by IDSupporting files in this skill:
assets/diagnosis-output.template — structured summary rendered at the end of every invocationUse when you want to:
ruff when you want a dedicated, local Python lint/format cleanup flow outside CI triage.uv when dependency/lock operations are the primary task in a uv-managed project.poetry when dependency/lock operations are the primary task in a Poetry-managed project."Fix my failing CI" "Why is CI failing on my branch?" "Diagnose the test failure in CI" "/ci-fix" "/ci-fix 9823456"
Two modes depending on invocation:
Mode A — Auto-detect (no argument given)
Run the following to find the latest failed run on the current branch:
BRANCH=$(git rev-parse --abbrev-ref HEAD)
gh run list --branch "$BRANCH" --status failure --limit 1 --json databaseId,workflowName,conclusion,createdAt
Extract the databaseId from the JSON result, then fetch the failed log output:
gh run view <databaseId> --log-failed
Mode B — Specific run ID (/ci-fix <run-id>)
If a run ID is provided as an argument, skip auto-detection and fetch directly:
gh run view <run-id> --log-failed
If the run ID is invalid or inaccessible, report clearly:
"Run ID
<run-id>could not be fetched. Verify the ID is correct and thatgh auth statusshows an authenticated session."
Fallback — gh unavailable or unauthenticated
If gh is not installed or gh auth status fails:
gh CLI is not available or not authenticated. Run gh auth status to diagnose."Scan the log output for these patterns to identify the failure category:
Lint violations — look for tool name + violation codes:
ruff: lines containing E[0-9]{3}, F[0-9]{3}, W[0-9]{3} codes (e.g., E501 line too long, F401 imported but unused)flake8: same code pattern — note: flake8 is read-only, cannot auto-fix; treat as propose-onlyeslint: lines with error or warning + rule name (e.g., no-unused-vars)Formatting failures — look for "would reformat" or diff output:
black: would reformat <file>ruff format: Would reformat: <file>prettier: diff output from prettier --checkPre-commit hook failures — look for:
hook id: followed by Failed[ERROR] markers or exit code annotationsLock file out of sync — look for these exact log signals:
| Log signal | Package manager |
|---|---|
uv.lock is not up to date | uv |
poetry.lock is not consistent | poetry |
package-lock.json mismatch or npm ci failure mentioning lock file | npm |
yarn.lock out of date | yarn |
Cargo.lock needs to be updated | cargo |
go.sum mismatch or go mod tidy required | go modules |
Test assertion failures — look for test runner output:
pytest: FAILED, AssertionError, lines starting with E assertjest: FAIL, ● Test name, Expected: / Received:cargo test: thread '...' panicked atgo test: --- FAIL:, lines starting with FAIL\tEnvironment / infrastructure — look for:
Secret 'FOO' not found, undefined environment variableconnection refused, timeout, Could not resolve hostRouting:
Apply the fix determined in Step 1 and stage the result. The rule: re-run the tool that reported the failure.
Lint violations (ruff, eslint):
ruff check --fix . # ruff — applies all auto-fixable violations
eslint --fix <file> # eslint — applies auto-fixable rules
Note: flake8 has no --fix flag — route flake8 failures to Step 3 instead.
Formatting (black, ruff format, prettier):
black . # black
ruff format . # ruff format
npx prettier --write . # prettier
Pre-commit:
pre-commit run --all-files
Lock file — use the package manager identified in Step 1:
uv lock # uv
poetry lock --no-update # poetry 1.x (≥1.2) — regenerates without upgrading
# If --no-update is not recognised (poetry 2.x, flag removed):
poetry lock # poetry 2.x — safe by default; existing packages not updated
npm install # npm
yarn install # yarn
cargo update # cargo
go mod tidy # go modules
After the fix runs, stage only the files related to the CI fix:
git status --porcelain
git add <expected-files-from-fix>
Never use git add . in this workflow — it can stage unrelated local work.
Then proceed to Step 4.
For test assertion failures:
Extract from the log:
test_checkout_total, ● Cart › calculates discount)Infer the root cause — what does the assertion tell you about the mismatch? Consider:
Compose a proposed fix:
If multiple tests fail: group related failures (same module or same root cause) and address the primary root cause first.
Populate the diagnosis summary with action: proposed.
Example output:
Test failed: test_checkout_total
Failure: AssertionError: expected 95.0, got 100.0
Root cause: The discount logic in checkout.apply_discount() no longer applies the
5% member discount — likely removed in the recent refactor of the pricing module.
Proposed fix: In src/checkout.py line 42, restore the discount multiplier:
total *= (1 - discount_rate)
This resolves the assertion because the expected value (95.0) assumes 5% is applied.
For environment / infrastructure failures:
Identify the category:
State clearly: "This failure cannot be resolved by a code change."
Suggest the next action — who to contact or what to check (DevOps, repository admin, re-run the job).
Populate the diagnosis summary with action: explained.
Fill and render the diagnosis-output.template:
## CI Diagnosis Summary
**Workflow**: <workflow name>
**Run ID**: <run id>
**Branch**: <branch name>
**Failure type**: <lint | format | pre-commit | lock-file | test | environment>
**Root cause**:
> <quoted excerpt from the CI log that identifies the failure>
**Action**: <fixed-and-staged | proposed | explained>
**What was done / proposed**:
<description of the fix applied or proposed>
**Why this resolves it**:
<rationale — why the fix addresses the root cause, not just what was changed>
**Next step**:
<review staged changes with `git diff --staged` then commit>
— OR —
<apply proposed fix, then push>
— OR —
<contact [person/team] / re-run CI job>
If files were staged automatically, remind: "Run git diff --staged to review the changes before committing."
ruffuvpoetrygit diff --staged before committing any auto-applied fix; confirm only the expected files changedgh auth status first — if gh isn't authenticated, the skill falls back to manual log paste; authenticating once eliminates this frictionruff for auto-fixable lint, or fix violations manuallypackage-lock.json), scan the diff for unexpected major version bumps in transitive dependencies before committinggh is unavailable, copy the failed step output from the GitHub Actions UI and paste it; the diagnosis workflow is identicalまだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
Implement comprehensive error handling for Python code paths to keep services resilient and user-friendly. Use when failures are currently silent or exceptions leak through.
日本語の概要は準備中です。原文の説明を表示しています。
Tabular and numerical data analysis with descriptive statistics and insights. Use when the user provides data, tables, CSVs, or numbers and wants analysis.
日本語の概要は準備中です。原文の説明を表示しています。
Financial factsheet analysis with key metrics extraction and investment rationale
日本語の概要は準備中です。原文の説明を表示しています。
Reproduce ai-repo PR checks locally with Poe and CI scripts, including per-package typecheck and coverage behavior. Use when validating changes before push or when user asks which local commands match CI.
日本語の概要は準備中です。原文の説明を表示しています。
Ask clarifying questions before implementing to ensure Python requirements are understood. Use when a task lacks detail, dependencies are unclear, or multiple interpretations are possible.
日本語の概要は準備中です。原文の説明を表示しています。
Delete local git branches whose remotes are gone, after verifying via gh CLI that each was actually merged.
日本語の概要は準備中です。原文の説明を表示しています。