size-limit
Installation
SKILL.md
Size Limit
Pin bundle size as a tested contract with size-limit: every package with a public surface gets a .size-limit.json, and any regression fails npx size-limit instead of silently shipping.
Size-limit only makes sense for libraries that target the browser and are designed for tree-shaking (see the tree-shaking skill): the measured number is what a consumer's bundler ships over the wire. For Node-only tools, CLIs, or server-side code, bundle size is not the constraint — skip it there.
Setup
Per package with a public surface:
- dev dependencies:
size-limit+@size-limit/preset-small-lib; - a script:
"test:size": "size-limit"; - a
.size-limit.jsonnext topackage.json.
Each entry measures one bundle (path + optional import subset) against a pinned limit: