- All playbooks
- Caching and setup
- Declare the inputs and outputs of cached builds
Declare the inputs and outputs of cached builds
Make build-cache contracts cover the actual files and configuration consumed and produced by the task.
Compare approaches
How companies used this technique
Read what each company changed and follow the original sources.
Make build cache keys describe the build
Mastra declared source, package and compiler configuration inputs for library builds, excluding test files and Markdown where they were not build inputs. Composite tasks received their own input declarations.
- Use it when
- A remote build cache misses after edits that leave the emitted artifact unchanged.
- Before applying it
- Exclusions must match actual tools, generators and imported assets.
Declare every input and output of expensive transforms
The Java SDK declared the R8 program, rule and JDK inputs and both the transformed JAR and mapping outputs, so Gradle restores the result when inputs match. Both executable compatibility smoke tests still run.
Fixture command on local JDK 21: 45s to 3s with the outputs restored Source
- Use it when
- A build task reruns an expensive transformation on unchanged inputs.
- Before applying it
- An undeclared input serves stale output. Toolchain paths can limit reuse across machines, and the cache needs a trusted writer.
Company Playbooks
- Read Anthropic’s playbookRun only affected tests
- Read DoorDash’s playbookRun build and test in parallel, sharded across CI agents
- Read Linear’s playbookBenchmark the same job on faster hardware
- Read Mastra’s playbookStarSling runners for the slowest test workflow
- Read OpenAI’s playbookRank CI fixes by the minutes they save
- Read Ramp’s playbookMove a CPU-bound test suite to a faster CPU
- Read Shopify’s playbookLet an agent iterate against one CI metric
- Read Spotify’s playbookBuild arm64 on native arm64 runners
- Read Stripe’s playbookRun only the tests a change can reach
- Read Uber’s playbookBuild the merge-queue speculations most likely to be needed