Perf Budget Loop

Profiles and optimizes the app pass after pass until it consistently meets a defined performance budget.

WorkflowengineeringMIT1 source files

Before you use this component

This is a third-party source bundle, not an installation into your account. UI Discovery has checked the available redistribution license evidence; runtime behavior has not been tested. Review all files, use a disposable project first, and do not enable scripts or hooks until you understand their permissions.

Some integrations require separately installed software, API keys or paid services. Credentials and subscriptions are not included. These are Claude Code resources; other clients may require adaptation.

Extract the ZIP into a temporary folder, inspect its entry file and supporting resources, then follow the original instructions. Do not overwrite an existing project configuration blindly. Keep the bundled license and attribution notices.

Source publisher
Claude Code Templates
Creator supplied by source
Not listed in source
Pinned source version
a344359459263d73d8948651c789244093c02e4e
License evidence
LICENSE

Source preview

cli-tool/components/loops/engineering/perf-budget-loop.md

---
name: perf-budget-loop
description: Profiles and optimizes the app pass after pass until it consistently meets a defined performance budget.
category: engineering
interval: 20m
stop-condition: The target metric meets the budget across repeated runs with no functional regressions.
components: [agent:performance-testing/performance-engineer, command:performance/performance-audit, command:performance/optimize-bundle-size]
tags: [performance, optimization, profiling, loop]
---

# Performance Budget Loop

> **Loop Engineering** — hold the agent to a concrete, measurable budget and let it optimize until the number is real and stable.

## 🎯 Goal
Drive a target metric (page load, bundle size, p95 latency, etc.) under its budget by profiling, fixing the biggest bottleneck each pass, and re-measuring — without breaking functionality.

## ⏱️ Schedule
Suggested interval: `20m`.

## ▶️ Run it
```
/loop 20m "Profile the app against the performance budget. Find the single biggest bottleneck, fix it, and re-measure. Verify no tests break. Continue until the metric meets the budget across three consecutive runs."
```

## 🔁 Iteration steps
1. **Perceive** — run `/performance-audit` and capture the current metric.
2. **Reason** — the `performance-engineer` agent identifies the top bottleneck.
3. **Plan** — choose one optimization (code-split, cache, query, bundle).
4. **Act** — apply it (e.g. `/optimize-bundle-size`).
5. **Observe** — re-measure; require the budget to hold across repeated runs before stopping.

## 🛑 Stopping condition
Metric ≤ budget across consecutive runs, with no functional regression.

## 🧩 Referenced components
- `agent:performance-testing/performance-engineer` — diagnoses bottlenecks.
- `command:performance/performance-audit` — measures each pass.
- `command:performance/optimize-bundle-size` — one of the optimization levers.

## 💡 Example
Targeting a 200 KB JS budget, the loop lazy-loads a chart library, trims a moment.js import, and de-dupes a dependency until the bundle stabilizes under budget.

Preview capped at 60,000 characters. Download the bundle for every original file and notice.

Read the redistribution license
MIT License

Copyright (c) 2025 Daniel (San) Ávila

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Bundle SHA-256: 77b0c00cdcc1a8f0755b56d3d8e040e40f382082f3dc8ba40ba0b1ab8acd4b28. Files are served as downloads and are never executed by this page.