AAWEA.ORG
AAWEA.ORG
AAWEA.ORG
Performance Manual trigger πŸ‘‘ Official πŸ›‘ Hardened

Bundle Size Budget

Ship features without bloating the client bundle β€” loop until size checks pass under your budget threshold.

πŸ‘ 1,727 views πŸ“₯ 1,415 installs πŸ‘€ by loops!
Download loop
Share Now
Manual start
↓
  1. 1
    Measure bundle

    Run the production build and bundle size check. Report total KB and the largest new chunks.

    > npm run build && npm run size-limit
  2. 2
    Trim or lazy-load

    If over budget: dynamic-import heavy modules, remove unused deps, or split routes. No feature cuts unless necessary.

↓
βœ“
Exit condition: tests_pass

Bundle size is under the configured budget

> npm run size-limit
πŸ“Š Flow Diagram
flowchart TD Start(["Manual start"]) Start --> S0 S0("Measure bundle") S1("Trim or lazy-load") S0 --> S1 Exit{"Bundle size is under the configured budget"} S1 --> Exit Exit -- "No" --> S0 Exit -- "Yes" --> Done(["Success"]) style Exit fill:#fffbeb,stroke:#f59e0b,stroke-width:2px,color:#92400e style Done fill:#ecfdf5,stroke:#10b981,stroke-width:2px,color:#065f46
Run "Bundle Size Budget" in your agent
Prompt only
Deeplinks and "Open in Cursor" only paste the kickoff prompt. They do not install hook files β€” your agent cannot tell whether files are on disk until you add them yourself.
Two separate pieces
  • Kickoff prompt β€” tells the agent the goal, check command, exit condition, and how to self-pace.
Kickoff prompt
Start the "Bundle Size Budget" loop.

Goal: client bundle stays under the size-limit budget
Max iterations: 6
Between iterations run: npm run build && npm run size-limit
Exit when: size-limit exits 0

Step 1: Build and measure bundle size. If over budget, lazy-load or trim deps until size-limit passes.

Self-pace this loop. After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when the exit condition passes or max iterations is reached. Give a short status update each pass.
Anti-gaming rules
Rules the agent must follow so it cannot cheat the exit condition.
  • Do not modify the check command or exit criteria to force success
  • Do not skip, disable, or bypass checks to pass the exit condition
  • If stuck after several iterations, stop and report blockers instead of gaming metrics