一键导入
ci-flaky
Analyze flaky CI tests using CircleCI Insights. Use when investigating test flakiness, triaging CI failures, or deciding which flaky tests to fix next.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Analyze flaky CI tests using CircleCI Insights. Use when investigating test flakiness, triaging CI failures, or deciding which flaky tests to fix next.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Check CircleCI status for a branch and help fix CI failures.
Add a comment to the current ClickUp ticket. Use when the user says "workon comment" or wants to add a comment to the ticket.
Merge a pull request and post a merge comment. Only use when explicitly requested.
Create a pull request using the workon CLI. Use when the user says "workon pr", "create a PR", "open a PR", or indicates code is ready for review.
Check the status of a pull request including CI checks and approvals.
Update sections of an existing pull request. Use when the user wants to improve or fix the PR description.
基于 SOC 职业分类
| name | ci-flaky |
| description | Analyze flaky CI tests using CircleCI Insights. Use when investigating test flakiness, triaging CI failures, or deciding which flaky tests to fix next. |
| argument-hint | [action] e.g. 'list', 'list --days 2 --job api', 'details', 'plan', 'plan --days 2 --job api' |
list or no arguments → List mode (summary only)details → Details mode (summary + failure messages)plan → Plan mode (fetch details, generate plan file, suggest ralph command)--days N or --job <name> flags are passed through to workon ci-flakyAll modes accept --days N and --job <name> filters.
Run workon ci-flaky with any filters from $ARGUMENTS:
workon ci-flaky $ARGUMENTS
Show the output to the user. This is the compact summary — no failure details.
Run workon ci-flaky --details with any filters:
workon ci-flaky --details $ARGUMENTS
Show the output. This includes failure messages for each test, useful for quick triage.
This mode generates a plan file and sets up a ralph loop to fix flakes one at a time.
Run workon ci-flaky --details with any filters to get the full output including failure messages. Parse the output to understand which tests are flaky and what their errors are.
Create flaky-test-plan.md in the current directory. Structure it as a ralph-compatible task list:
# Flaky Test Fix Plan
Generated: <today's date>
Window: <filter description, e.g. "last 2 days">
Total: <N> flaky test(s)
## Rules
- Fix ONE task per iteration, then stop.
- Read the spec file AND the implementation it tests to understand the code path.
- Only modify spec files. Do NOT touch application code unless there is a clear, confirmed production bug. If you suspect an app bug, skip the task and note it — do not change production code without explicit approval.
- After fixing, run the spec file to verify the fix works.
- Check the checkbox when done and add a brief note about what you changed.
- Common flake causes: timestamp ordering (use `id`-based assertions), `Time.now` without `freeze_time`, shared `let_it_be` state being mutated, missing sort before asserting order, database state leaking between tests.
## Tasks
- [ ] **[22x]** External::V1::Stores::MenuProducts::Get filters uses custom product type labels
- Job: api
- File: spec/lib/external/v1/stores/menu_products/get_spec.rb
- Error:
```
<first ~8 lines of the failure message>
```
- [ ] **[10x]** ...
Sort tasks by times_flaked descending (highest priority first). Include the error message for each test if available. If a test had no failure data, note that.
Show the user what was generated:
Plan written to
flaky-test-plan.mdwith N tasks.Start the fix loop:
ralph -f ~/.claude/prompts/fix-flaky-tests.md -p "FLAKY FIXES COMPLETE"
STOP. Do NOT start fixing tests yourself. Your only job is to generate the plan and output the command.
A test is flaky if it both passed and failed within the same commit during the rolling window (~14 days). The times_flaked count reflects how many times this occurred.
All fixes should target the spec file, not application code.
| Pattern | Symptom | Spec Fix |
|---|---|---|
| Timestamp collision | created_at-based ordering fails | Use id-based assertions, or travel_to to space timestamps |
| Time-dependent assertion | expect(updated_at).to have_changed random | Wrap in freeze_time / travel_to, or assert value change not timestamp |
| Missing ORDER BY | Results in unpredictable order | Sort results in spec before asserting, or use match_array |
| Shared mutable state | let_it_be data mutated across tests | Use let instead, or let_it_be with reload: true |
| Database leakage | Extra records from other tests | Scope spec queries more tightly, use unique attrs |
| External service timing | HTTP/async races | Tighten mocks or add deterministic waits in spec |
workon ci-failure <job-number> to get the full error output from a specific flake occurrence if the details from --details aren't enough.