optimize-ci
Skill15 starsChanged 5 days agoMITView on GitHub
Audits and optimizes repository CI pipelines to achieve sub-1-minute p50 and sub-2-minute p95 PR check durations without reducing coverage or hiding failures. Manual invocation only — do not auto-invoke unless explicitly requested by the user.
In this repository14 other files it gives its agents.
- agent-instruction-auditSkill
- agent-tool-auditSkill
- changes-verificationSkill
- cheap-ui-auditSkill
- code-reviewSkill
- create-prSkill
- debuggingSkill
- engineering-decisionSkill
- formal-verificationSkill
- micro-animationSkill
- optimistic-uiSkill
- oxlint-setupSkill
- test-auditSkill
- zstack-modeSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 9 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Full suite on merge: Run the full test suite in a merge queue before anything reaches main.
- Distinctive: line 17
Never hide failures: Never add retries, widen timeouts, or skip tests.
- Very specific: line 22
Before changing any workflow or toolchain, pull the last 150 CI runs via the GitHub CLI (gh).
- Very specific: line 38
Use blobless clones (filter: blob:none).
- Distinctive: line 42
Run lint, typecheck, build, and tests in parallel.
- Distinctive: line 44
Ensure no required job waits on another required job.
- Very specific: line 47
Lint (
< 1s): Run via bun run lint (reading existing .oxlintrc.json with max rules enabled). - Very specific: line 48
Format (
< 1s): Run via bun run fmt. - Very specific: line 49
Typecheck (
< 5s): Run TypeScript 7 (tsgo --noEmit) via bun run check. - Very specific: line 50
Tests (
< 30sper shard): Run bun test (keeping existing vitest imports). - Very specific: line 54
Remove npm, yarn, pnpm, Prettier, ESLint, Vitest, and Jest (retain only the binary powering lint/fmt).
- Distinctive: line 63
Run only tests reachable from the PR diff.
- Distinctive: line 65
Verify selection integrity by intentionally hiding a breaking change and confirming CI catches it.
- Distinctive: line 69
Delete pure change-detector tests and ban those patterns in AGENTS.md.
- Distinctive: line 70
Never delete tests covering authorization, privacy, migrations, or concurrency.
- Distinctive: line 80
Side-by-Side Verification: Treat the tools above as defaults.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Optimize CI
Make the repository's CI as fast as possible without letting it lie.
- Target: PR checks complete in < 1 minute (p50) and < 2 minutes (p95).
- Invocation: Manual-only (
disable-model-invocation: true). Run only when explicitly invoked by the user.
Non-Negotiable Rules (Outrank Speed)
- Full suite on merge: Run the full test suite in a merge queue before anything reaches
main. Test selection only narrows PR feedback. - Never hide failures: Never add retries, widen timeouts, or skip tests. Treat every flaky check as a bug and fix its root cause.
- Never check less: Lint rules and required checks may only stay the same or grow.
Phase 1: Audit (Do This First)
Before changing any workflow or toolchain, pull the last 150 CI runs via the GitHub CLI (gh). Resolve <skill-dir> to the directory containing this SKILL.md and run:
bash <skill-dir>/scripts/audit_ci.sh --limit 150Output a Markdown table breaking down every job into Waiting, Setup, and Running durations at p50 and p95. Always fix the biggest bottleneck bucket first.
Phase 2: Target Budgets & Architecture
Waiting (< 5s)
- Configure GitHub Actions
concurrencygroups to cancel in-progress branch runs when new commits are pushed. - Switch to warm self-hosted runners or GitHub larger runners if queue wait times exceed
5s.
Setup (< 15s)
- Bake the toolchain into the runner image where possible.
- Use blobless clones (
filter: blob:none). - Seed PR caches from
main(target> 95%cache hit rate) and cachenode_modules.
Pipeline Shape
- Run lint, typecheck, build, and tests in parallel.
- Fold fast checks (lint, format, typecheck) into a single job that reports all failures together.
- Ensure no required job waits on another required job.
Slowest Job (< 35s total)
- Lint (
< 1s): Run viabun run lint(reading existing.oxlintrc.jsonwith max rules enabled). - Format (
< 1s): Run viabun run fmt. - Typecheck (
< 5s): Run TypeScript 7 (tsgo --noEmit) viabun run check. - Tests (
< 30sper shard): Runbun test(keeping existingvitestimports). Isolate modules—not processes—reset state between files, and randomize execution order to expose state leaks.
Tooling Consolidation
- Standardize on
bunfor installs and script execution. - Remove
npm,yarn,pnpm, Prettier, ESLint, Vitest, and Jest (retain only the binary poweringlint/fmt). - Pin exact canary versions when required for reproducibility.
Sharding
- Scale CPU cores before adding shards; match worker count to available cores and give each shard an isolated throwaway database.
- Split any test file taking
> 20s. - Balance shards using historical file timings recorded on
main, and verify 100% test-file coverage across all shards.
PR Test Selection
- Run only tests reachable from the PR diff.
- Explicitly list global inputs (such as lockfiles, CI workflows, and shared config) that trigger a full suite run.
- Verify selection integrity by intentionally hiding a breaking change and confirming CI catches it.
Test Suite Pruning (Evidence-Based)
- Log every test failure fixed over a 2-week window as either a caught regression or a change detector.
- Delete pure change-detector tests and ban those patterns in
AGENTS.md. - Never delete tests covering authorization, privacy, migrations, or concurrency.
Local Guardrails (< 9s)
- Enforce formatting and linting on
pre-commitand full CI parity onpre-pushusinghkgit hooks (not prose instructions inAGENTS.md, which agents skip).
Enforce Budgets (Final PR)
- Once optimization is complete, enforce hard job timeouts matching these budgets so CI fails immediately on speed regressions.
Migration & Execution Rules
- Side-by-Side Verification: Treat the tools above as defaults; keep an existing tool only with measured proof. Before replacing any tool, run old and new side by side and log anything the new tool misses.
- One Small PR Per Change: Submit one focused PR per optimization step, including real before/after timing measurements in the PR description.
- Autonomy First: Execute every change you can independently. Compile items requiring an account, secret, or spend increase into a single list with estimated monthly costs.
- Final Report: Conclude with a before-and-after comparison of total CI duration (p50 and p95) and estimated monthly cost.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

