perf-budget
Set a perf budget — per critical user journey, single percentile + threshold, explicit budget components (network / compute / dependencies), tripwire alerts. Backend journeys; not web CWV or mobile.
- License 许可
- MIT
- 最近更新
- 2026-10-29
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- perf-budget
- description
- Set a perf budget — per critical user journey, single percentile + threshold, explicit budget components (network / compute / dependencies), tripwire alerts. Backend journeys; not web CWV or mobile.
03 SKILL.md 正文
perf-budget
A perf budget is a contract per critical user journey. One percentile, one threshold, components named. Without that, "make it fast" is the spec.
Mode: analytical — judgment inside a fixed frame. Keep the output shape; every verdict cites its evidence; unknowns are marked [TBD] or [VERIFY], never filled in.
When to use
- A new service or page is shipping and the team wants a target before code.
- An existing surface keeps regressing because the target was never written down.
Inputs
- The critical user journey (CUJ) — one journey, not the whole service.
- The audience tier (high-end-desktop / median-mobile / low-end-mobile for frontend; in-datacenter / cross-region for backend).
Procedure
- Pin the CUJ. Example: "User opens /checkout and sees totals." Not "/checkout responds 200".
- Pick the percentile. P95 or P99 — pick one. Avoid pyramid targets (P50 + P99 stacked).
- Pick the threshold. Tied to user expectation, not "round number". For interactive: 200ms / 500ms / 1s are common thresholds. For batch: minutes.
- Decompose the budget into components and pre-allocate ms per component:
- Network / DNS / TCP / TLS.
- CDN / origin.
- Application compute (handler + middleware + serialization).
- Database / cache / external API calls.
- Render / hydration (frontend only). The sum should be ≤ threshold, with ≥ 20% headroom.
- Tripwire alerts: an alert fires when the P-percentile crosses 80% of the threshold over a 10-minute window. Catches degradation before the budget is blown.
- Renegotiation rule: budget can only be moved with an ADR. "We need more time for X" is not a budget change.
Output
Perf budget: /checkout sees totals (P99 latency)
CUJ: User loads /checkout after adding 1+ items.
Audience: median-mobile.
Percentile: P99.
Threshold: 1,000 ms.
Component allocations (sums to 800 ms; 200 ms headroom):
Network (DNS+TCP+TLS): 150 ms
CDN/origin fetch: 100 ms
Handler + middleware: 150 ms
Cart DB query: 120 ms
Pricing service call: 180 ms
Frontend render: 100 ms
Tripwire: P99 > 800 ms over a 10-min window → page sev3.
Renegotiation: requires ADR + sign-off from <role>.
Quality bar
- One CUJ per budget.
- One percentile + one threshold.
- Components sum to ≤ threshold with 20% headroom named.
- Tripwire alert pre-fires at 80% of budget.
- Renegotiation gated through an ADR.
Anti-patterns to avoid
- Pyramid targets (P50 + P99 + ...). Pick one.
- Budget without component breakdown. You can't tell what's eating it.
- Threshold at "round number". Match user expectation.
- Allowing budget changes by Slack ping. ADR-gate it.
04 同仓库更多 Skills
runbook
Write or refresh an operational runbook for an alert/symptom; structured as TL;DR + Pre-checks + Steps + Verification + Rollback + Escalation.
rfc
Draft a lightweight design RFC to docs/rfcs/<slug>.md; Summary, Motivation, Detailed design, Drawbacks, Alternatives, Unresolved questions. A proposal to debate, not a recorded decision (adr).
editorial-pass
Review and tighten prose in a Markdown artifact for a target tone (terse, formal, friendly) without dropping information; preserve quotations and load-bearing constraints.
architecture-review-facilitation
Run an architecture review as a process — entry criteria, reviewer checklist, decision log, and follow-up actions — pairing the design artifact with a red-team pass.
architecture-doc
Write a C4-style architecture document; System Context + Containers (+ Components when interesting) with mermaid diagrams. Describes structure, not a decision (adr) or proposal (rfc).
adr
Write an Architecture Decision Record (Michael Nygard format) to docs/adrs/NNNN-<slug>.md; frontmatter validated by the ADR artifact schema. Records a made decision, not a proposal to debate (rfc).