- All playbooks
- Agent PR volume
- Install and build only the workspace packages a job uses
Install and build only the workspace packages a job uses
Scope dependency installation and builds to the package or lane under test, including its actual dependencies.
How companies used this technique
Read what each company changed and follow the original sources.
Install or build only the workspace packages this step needs
Linear restricted its API test install to the API package and its dependencies, which cut pnpm install from 44-73 seconds to 16-18 seconds, then applied the same filter to API-adjacent jobs. In its public SDK, the release-preparation job builds only the package schema generation imports before updating the schema.
- Use it when
- A job’s dependency closure is smaller than the workspace.
- Before applying it
- Include transitive dependencies and generated prerequisites.
Build only the dependencies the test consumes
The memory test build replaced the entire stores wildcard with libsql, pg and upstash while retaining its other required packages. Another change moved a docs-server build out of the changed-test gate.
- Use it when
- A narrow test job pays for unrelated workspace builds.
- Before applying it
- Trace transitive dependencies and generated artifacts. Before moving a build out of a gate, confirm another required check still runs it.
Give each CI lane a defined package set
The app libraries ran everything in ci.yml in sequence, once per Node version. Shopify/shopify-app-js#2777 split that into a lint job and three package-family jobs that run in parallel; each builds its own dependency closure with pnpm filters and tests only its family. The pattern match is partial: the filters scope each lane, and the speedup comes from running the lanes in parallel.
The PR reports CI running in about 5 minutes against about 11 before. Source
- Use it when
- A monorepo runs one long sequential job that builds and tests every package on every run.
- Before applying it
- A new package has to be added to a lane, and each lane repeats install and setup.
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