A Four-Week Plan for Introducing API Review on a Library

Accidental breaking changes usually slip through because nobody was looking at the public surface specifically; reviewers were looking at logic. An API review step fixes that by making every change to exported names, signatures and types visible and deliberate. Here is an illustrative four-week rollout for a team maintaining one or more libraries. Stretch or compress it to fit.

Week 1: define and snapshot the surface

Done when: there is one committed file a reviewer can read to see the whole public API.

Week 2: make changes visible in CI

  1. Add a CI step that regenerates the snapshot and fails if it differs from the committed one.
  2. When the check fails, the contributor updates the snapshot in the same pull request. The diff of that file is now the API change, isolated from implementation noise.
  3. Add a pull request template line: "Public API change? none / additive / breaking".
# illustrative CI step
- run: npm run build
- run: npx api-extractor run   # fails if the report changed

Done when: no pull request can change the surface without touching the snapshot file.

Week 3: set the review rules

Kind of changeRule
Additive (new export, new optional field)One API owner approves naming and shape
BreakingTwo approvals, a deprecation already shipped, and a migration note drafted
Experimental entry pointNormal review; clearly labelled as unstable in docs

Use a CODEOWNERS entry on the snapshot file so the right people are requested automatically. Keep the group of API owners small but more than one person.

Week 4: practise and adjust

Run the process on real pull requests and hold a short retrospective at the end of the week. Typical adjustments: excluding generated files from the snapshot, adding a fast path for documentation-only changes, and writing a one-page naming guide so reviews stop relitigating the same questions.

Pitfalls to expect

Background: the API surface web read and semver policy briefing.

Related pages