Optimize CI Speed Without Weakening Checks
Once per repository, when CI feedback is too slow — audit where pipeline time goes and restructure it toward sub-minute PR results without hiding or dropping any check.
- existing
- quality
- #ci
- #performance
- #testing
- #bun
- by Pontus Abrahamsson (@pontusab)
## Context
You are making this repository's CI as fast as possible without letting it lie. This is
a ONE-TIME restructure task. The repository already exists and has a running CI pipeline
with real history to mine.
**The rules in the Guardrails section outrank speed. Read them before starting.**
## Goal
A PR gets its CI result in under 1 minute at the median and under 2 minutes at p95.
## Inputs
This prompt is self-contained: it discovers everything it needs from the repository and
its CI run history. The named tools and services (bun, oxlint, TypeScript 7, Blacksmith,
hk, GitHub-hosted runners) are defaults — replace them with what the repo actually uses
per the tool-switching rule in **Instructions**.
## Instructions
### Audit first
Pull the last 150 CI runs and split every job into waiting, setup and running, at p50
and p95. Fix the biggest bucket first.
### Hit these budgets
- **Waiting, under 5 seconds**: move every job off GitHub's hosted runners to Blacksmith
and keep machines warm. Cancel a branch's in-progress run when a new commit lands.
- **Setup, under 15 seconds**: bake the toolchain into the runner image. Get PR cache
hits above 95% by seeding caches from main, and cache `node_modules` itself. Use a
blobless clone (`filter: blob:none`).
- **Slowest job, under 35 seconds**. No required job waits on another.
- **Lint, under 1 second**: `bun lint`. It reads the existing `.oxlintrc.json`. Turn on
every rule you can.
- **Format, under 1 second**: `bun fmt`.
- **Typecheck, under 5 seconds**: `bun check` on TypeScript 7.
- **Tests, under 30 seconds per shard**: `bun test`. Test files keep their `vitest`
imports. Isolate modules, not processes, reset state after every file, and run in
random order to flush out leaks.
- **Install and scripts**: bun. Delete npm, yarn, pnpm, Prettier, ESLint, oxlint, Vitest
and Jest. If a tool only exists in a canary, pin that exact canary.
- **Shards**: buy cores before shards, match workers to cores, and give each shard its
own throwaway database. Split any test file over 20 seconds. Balance shards from file
times that main records on every full run, and prove the shards together ran every
file.
- **Fewer tests, on evidence**: for two weeks, log every test failure you fix as a
caught regression or a change detector. Delete the files that only detect change and
ban their patterns in `AGENTS.md`.
- **Shape**: run lint, typecheck, build and tests in parallel. Fold the small checks
into one job that lists every failure.
- **Selection**: on PRs, run only the tests the diff can reach, and list the inputs that
rerun everything. Then hide a real change from it on purpose and confirm CI goes red.
- **Local, under 9 seconds**: hk hooks. Pre-commit formats and lints staged files;
pre-push runs the same check as CI. A hook, not a line in `AGENTS.md`, because agents
skip steps.
- **Keep it fast**: fail any job that exceeds its budget.
### Tool switching
The tools above are defaults; you need a measured reason to keep an old one. Before each
switch, run old and new side by side and list anything the new one misses.
### Working agreement
One small PR per change, with before and after numbers from real runs. Do everything you
can without me first.
## Output format
- One small PR per change, each including before and after numbers from real runs.
- One consolidated list of anything that needs an account, a secret or a bigger bill,
with expected monthly cost for each item.
- A final report ending with total CI time and cost, before and after.
## Guardrails
These rules outrank speed — binding throughout the whole task:
- The full suite runs before anything reaches main, in a merge queue. Selection only
narrows PR feedback.
- Never hide failures. No retries, wider timeouts or skipped tests. A check that needs a
retry has a bug; find it.
- Never check less. Lint rules and required checks only stay or grow.
- Never delete tests for authorization, privacy, migrations or concurrency.
- You may modify repository files (CI workflows, configs, hooks, `AGENTS.md`) as part of
the one-small-PR-per-change flow. Anything that requires an account, a secret or
spend goes on the escalation list instead of being done unilaterally.More prompts
## Context You are setting up an automated gate that blocks sloppy, AI-generated Go code. This is aONE-TIME setup task. The repository already exists and builds; nothing has been gated yet. **The ground rules in the Guardrails section are binding. Read them before starting.** Work in the phases below, in order. Do not write any config before Phase 1 is complete andyou have evidence from this codebase.
Set Up a Self-Improving Quality Gate for a Go Repository
Once per Go repository, when the code is already built and you want an automated gate that blocks sloppy, AI-generated Go code and gets stricter over time.
- #go
- #quality
- #ci
- #linting
- #agents
By Claude Sonnet 5.5 Medium
## Context This repository is already built and running. You are starting a thorough refactor ofthe whole codebase and completing it to the end. Treat it as a goal. Why do this at all: - **Better output:** agents write better code in a well-structured codebase.- **Cheaper & faster changes:** agents spend fewer tokens searching and more on the
Untangle Codebase
Once per codebase, when it has grown tangled — a one-pass structural refactor so a typical change lands in one place and agents working in it break less.
- #refactoring
- #tech-debt
- #architecture
- #agents
mBy @mazeincoding