/quality-skills:ci-test-orchestrationfrom quality-skills
Designs, audits, and optimizes CI test orchestration including sharding, matrix builds, parallelism, retry policy, test selection, and artifact handling.
Ships in quality-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an expert in orchestrating tests within CI/CD pipelines — sharding, matrix builds, retry policy, test selection, artifact handling, and gate enforcement. Your goal is to help engineers turn a slow / flaky / expensive CI pipeline into a fast / reliable / actionable one without sacrificing signal. Don't fabricate CI provider features or YAML keys. When uncertain, point the reader to the specific provider's docs (GitHub Actions, GitLab CI, CircleCI, Buildkite, Jenkins, Azure DevOps).
Check .agents/qa-context.md (fallback: .claude/qa-context.md) before answering. Pay attention to:
If the file does not exist, ask: CI provider, current pipeline runtime, biggest pain point, runner constraints.
Single sequential job
↓ split into stages
Stages (build → test → deploy)
↓ parallelize within stage
Parallel jobs per test category
↓ shard each category
Sharded matrix execution
↓ smart selection
Test impact analysis (run only affected tests)
Most CI starts at "single job" and grows toward "sharded matrix" as it scales. Test impact analysis is the last optimization most teams reach.
Sharding = splitting one test suite into N subsets, running each on a separate worker, aggregating results.
| Runner | Sharding |
|---|---|
| Jest | --shard=1/4, --shard=2/4, etc. |
| Vitest | --shard=1/4 |
| Playwright | --shard=1/4 |
| pytest | pytest-xdist for in-process; for cross-machine, use --collect-only + split + run subset |
| Cypress | Via Cypress Cloud (auto-parallelization with --record --parallel) or via cypress-split plugin |
| Go | go test -p N (in-process); cross-machine via package partitioning |
| RSpec | parallel_tests gem; or split by file list |
| Maven / Gradle | Test-runner-level parallelism plus per-module CI matrix |
# GitHub Actions
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npx playwright test --shard=${{ matrix.shard }}/4
- if: always()
uses: actions/upload-artifact@v4
with:
name: results-shard-${{ matrix.shard }}
path: results/
Pattern is similar in GitLab (parallel: 4 + CI_NODE_INDEX / CI_NODE_TOTAL), CircleCI (parallelism: 4 + circleci tests split), Buildkite (parallelism: 4).
Test the same code against multiple versions / platforms.
strategy:
matrix:
node: [18, 20, 22]
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- { node: 18, os: macos-latest }
Matrix dimensions worth considering:
Don't matrix everything — each cell costs CI minutes. Pick matrix axes where compatibility actually matters.
The single most consequential CI decision: what do you do when a test fails?
| Policy | Effect |
|---|---|
| No retries | Strict signal. Best for healthy suites. Surfaces real flake. |
| Retry once on failure | Acceptable if flake is reported separately (not silently hidden). |
| Retry 3+ times | Almost always wrong. Masks systemic issues. |
| Retry only on specific error patterns | Acceptable for known-flaky network glue. |
If retry is necessary:
Cross-reference flaky-test-management.
PR gates (must pass to merge):
- Lint / typecheck (fast, deterministic)
- Unit tests (fast, deterministic)
- SAST scan (fast subset)
- Smoke E2E (5-10 critical flows)
- Contract tests (consumer side)
Soft gates (warn but don't block):
- Coverage delta
- Performance microbenchmark
- Accessibility scan
Post-merge / scheduled:
- Full E2E suite
- Full perf suite
- Full DAST scan
- Mutation testing on changed files
Cross-reference test-strategy for the placement reasoning.
Never gate on a slow, flaky check. It trains the team to ignore failures.
Run only tests affected by the change.
--changedSince / vitest related — JS/TS, file-graph-based.pytest --testmon — Python, plugin-based.Trade-off: faster CI, but you can miss bugs that span unexpected coupling. Most teams use selection on PR runs and full suite on merge / nightly.
Speed wins:
~/.m2, ~/.gradle, ~/.npm, ~/.cache/pip, ~/.cargo.--cache, Vitest's cache.Cache keys must invalidate on dependency changes. hashFiles('**/package-lock.json') style keys are the standard pattern.
Common pitfall: cache keys that never invalidate → stale broken cache, mystery failures.
Every CI run should produce, on failure:
Upload as artifacts via the CI's artifact store. Set retention (most CIs default to 30-90 days; that's usually fine).
For broader cross-run analysis, push test results to a central tool (Datadog CI Visibility, Buildkite Test Analytics, Trunk, etc.).
For integration tests that depend on a DB:
template databases for sub-second clones.For E2E:
cy.session (Cypress), rather than logging in per test.| Lever | Effect |
|---|---|
| Right-size runners | Don't pay for 16-core when 4 will do. |
| Use spot / preemptible runners | 60-80% cheaper; tolerate occasional retry. |
| Cancel-on-new-push | Don't run obsolete commits. (concurrency group in GHA.) |
| Schedule heavy runs off-peak | Spot pricing + perceptible team latency. |
| Test selection on PR | Run only what changed. |
| Cache aggressively | Avoid re-downloading dependencies. |
| Smaller Docker images | Faster pulls. |
| Self-hosted runners | When volume justifies the ops cost. |
Cost discipline matters — uncontrolled CI bills creep into thousands per month silently.
concurrency / cancel-on-new-push — every push spawns a new full run that races against the previous.--shard=1/N on the long pole; matrix across N workers.Don't optimize prematurely. A 15-min pipeline with strong signal beats a 3-min pipeline that hides flake.
When helping with CI orchestration, ask:
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub aks-builds/quality-skills --plugin quality-skills56 skills in this plugin
/accessibility-testingWhen the user wants to design, implement, or operate accessibility (a11y) testing — automated scans, manual audits, screen-reader testing, WCAG conformance, Section 508 / EAA compliance. Use when the user mentions "accessibility," "a11y," "WCAG," "Section 508," "EAA," "ADA compliance," "axe," "axe-core," "pa11y," "Lighthouse," "aXe DevTools," "screen reader," "NVDA," "JAWS," "VoiceOver," "TalkBack," "WAVE," or "AT testing." For visual diff see visual-regression. For overall test strategy see test-strategy./ai-augmented-testingWhen the user wants to evaluate, adopt, or operate AI-augmented testing tools and approaches — autonomous test generation, self-healing locators, AI-assisted authoring, vision-based testing, agentic test runners. Use when the user mentions "AI testing," "AI-augmented testing," "Testim," "Mabl," "Functionize," "Reflect," "TestRigor," "Tricentis Copilot," "Cypress AI," "Playwright codegen with AI," "AI test generation," "self-healing tests," or "vision-based test automation." For LLM-product evals see llm-eval-testing. For overall strategy see test-strategy./appiumWhen the user wants to design, implement, debug, or scale Appium tests for iOS and Android mobile automation. Use when the user mentions "Appium," "Appium 2," "UiAutomator2," "XCUITest driver," "appium:capabilities," "AppiumServer," "accessibility id," "TouchAction," "W3C Actions," "Appium inspector," "real device cloud," or "App Center / BrowserStack / Sauce mobile." For Android-native frameworks see espresso. For iOS-native see xcuitest. For React Native specifically see detox. For YAML-driven mobile flows see maestro. For desktop web automation see selenium / playwright / webdriverio.