一键导入
performance
mokata · Performance optimization — measure-first, before/after to the ledger, no guessing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
mokata · Performance optimization — measure-first, before/after to the ledger, no guessing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | performance |
| description | mokata · Performance optimization — measure-first, before/after to the ledger, no guessing. |
| when_to_use | Engage when an approach touches a hot path, a database query, a cache, or a batch/loop over data, when the spec's `domains` constraint names `performance`, when an acceptance criterion states a latency/throughput/size budget, or when a change is made in the name of speed. Do NOT engage for a correctness-only change with no performance claim or budget, or for a change whose cost you have not first measured — measure before you optimize, do not engage to guess. |
mokata Agent Skill. This is mokata's
performancedomain knowledge, attached to the pipeline so Claude engages it automatically when an approach touches a hot path or a change is made for speed. It is NOT a parallel advisory: it enriches optimize/review, feeds the instrument that already runs there (measure-first), and records the before/after to memory + the audit ledger. mokata's non-negotiables still hold — durable writes are human-gated, and no optimization is kept without a measurement.
⛭ mokata performance active — gate: no optimization is kept without a before/after measurement proving the win
Performance is a measured property, not a felt one. A change that "should be faster" is a hypothesis until a number confirms it; a change kept on a hunch is as likely to have added complexity for nothing — or a regression — as to have helped. This skill makes mokata treat optimization as an experiment: state the metric and its budget, measure the baseline first, make the change, measure again, and record the before/after so the win (or its absence) is on the ledger and the next change can see it.
Never optimize without a measurement. Take a BEFORE measurement of the metric you intend to move, make the change, take an AFTER measurement under the same conditions, and keep the change only if the number improved by a margin that clears the noise. "It should be faster" is not evidence — a before/after is. This is the discipline the measure-first instrument enforces, and it is why a perf change in mokata carries a recorded baseline, not just a claim. web.dev states the same principle for the web — you optimize against measured data, not intuition (https://web.dev/articles/vitals). The exact tooling and measurement procedure vary by stack; treat any specific tool's numbers as UNVERIFIED until reproduced under your own conditions.
For user-facing web work, Google's Core Web Vitals are the primary, user-centric performance metrics — each measures a distinct dimension of the loading/interaction experience (https://web.dev/articles/vitals):
web.dev publishes "good / needs-improvement / poor" thresholds for each (commonly cited as LCP ≤ 2.5 s, INP ≤ 200 ms, CLS ≤ 0.1, assessed at the 75th percentile of page loads). The exact current threshold values and the assessment percentile are UNVERIFIED here — confirm them at the cited web.dev pages before quoting a number as a pass/fail bar, because the definitions are revised over time.
Distinguish lab data (a reproducible measurement in a controlled environment — a synthetic run you can diff before/after) from field data (real-user measurement in the wild, which captures device/network variance a lab run cannot). Both are legitimate; they answer different questions. Use a lab measurement for the deterministic before/after of a specific change; use field data to know whether the change mattered to real users (https://web.dev/articles/vitals). Do not compare a lab number to a field number and call it a delta — measure the same way on both sides.
Effort spent speeding up code that is not on the hot path buys nothing and adds complexity. Find where the time actually goes — profile, measure, or query the graph for the hot path — before choosing what to change, and prefer the change with the largest measured effect. The oft-cited caution against premature optimization is exactly this: optimizing before you have measured where the cost is spends complexity you may never recover. Treat the specific attributions of that maxim as UNVERIFIED provenance and rely on your own measurement, not the aphorism.
performance in the
spec's domains, so the budget is a first-class, human-approved constraint, not an afterthought.context entry through the human gate
and written to the audit ledger, so the win is walkable later (P7) and a future change can see the
baseline. Record it with mokata's domain-decision path — never as loose prose. The perf budget is
advisory in this release (measurement + ledger, not a hard gate).This skill feeds measure-first (an SK.S1/S2 instrument, not a hard gate): an optimization is kept only against a before/after measurement proving the win. It is advisory — it informs and records the change, it does not block it — but the durable write recording the measurement is human-gated (write-gate), and any change to an approved spec's perf budget/scope routes through the deviation gate. The perf budget itself ships advisory this release.
Decide from the measurement and the metric definition, not from a feeling. Before asserting a change is faster, a path is hot, or a budget is met, MEASURE it — take the baseline, run the change, take the after under the same conditions — and for a web metric read the cited web.dev definition for the version in use and CITE the URL. Prefer the primary source (web.dev / Core Web Vitals) and your own reproduced numbers over memory or a blog. Flag anything you could not measure or verify as UNVERIFIED rather than stating it as fact.
| Excuse | Reality |
|---|---|
| "This is obviously faster — no need to measure." | "Obviously" is a hypothesis; keep the change only against a before/after that clears the noise (measure-first). |
| "I'll optimize this loop while I'm here." | If it is not on the measured hot path, you are adding complexity for no measured win — profile first, then optimize what matters. |
| "The lab number improved, so real users are faster." | Lab ≠ field; a lab delta is a controlled diff, not proof it reached real users (web.dev lab-vs-field). |
| "I'll record the win later." | The before/after IS the evidence; an optimization without a recorded baseline is a claim, not a result — write it to the ledger. |
| "LCP under 2.5 s is the rule." | The exact thresholds/percentile are revised over time — confirm the current bar at the cited web.dev page before treating a number as pass/fail (UNVERIFIED). |
Evidence, not "seems right" — check every box or say which is unmet and why:
references/web-vitals.md — Core Web Vitals (LCP / INP / CLS), the measure-first discipline, and lab-vs-field measurement in full, each with its primary-source URLCAN
context entry to memory + the ledger (human-gated)MUST NOT
DEPENDS ON
performance domain (classified at brainstorm; amend-in if reached late) (advisory)Grounding:
(gate: …)boundaries are enforced by that gate in code;(advisory)ones are protocol discipline this skill follows, not a hard block.
mokata · Socratic pre-spec exploration — explore approaches WITH the user, one question at a time, and HARD-GATE the spec behind explicit approval. Runs standalone or as the front of mokata's pipeline.
mokata · Author a new mokata skill test-first (RED-GREEN-for-docs); the write is human-gated.
mokata · Implement the minimum to turn a failing test green.
mokata · Turn the problem into testable acceptance criteria; map each to a test.
mokata · API & interface design — contract-first, blast-radius on every change.
mokata · Browser testing (DevTools) — live runtime captured via the existing MCP surface, fed to the test gate.