Back to loops
Performancemanual

Bundle Size Budget

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

0 views0 usesby solo lemon.

// parameters

Triggermanual
Max iterations6
Check commandnpm run size-limit
Exit conditionBundle size is under the configured budget

// run_this_loop

Copy the kickoff into your agent first. The blueprint below explains how the loop evaluates progress and when it should stop.

Open in CursorOpen in Claude

Use loop copies the kickoff prompt. Share copies the loop link. Open in Cursor / Claude only pre-fill that prompt — they do not install hook files. Download loop saves the loop as bundle-size-budget.md.

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.

// blueprint

The loop contract: target outcome, execution sequence, checks, stopping condition, and safety constraints.

Goal

client bundle stays under the size-limit budget

// loop_sequence

// loop_sequence_diagram.json
closed loop

Trigger

Manual start

Actions block

2 steps
1Measure bundle
2Trim or lazy-load

Feedback gate

Evaluate: npm run size-limit

Run the check, read the output, then decide whether the loop is complete.

Check failed

Repeat actions with the latest feedback.

Success

Bundle size is under the configured budget

Safety capMax 6 iterations

// steps

  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.