page-performance-audit
Skill2 starsChanged 3 months agoMITView on GitHub
Audit web-page loading, responsiveness, memory, images, network traffic, and runtime stability under normal, weak-network, weak-CPU, and combined mobile conditions. Use for local-versus-production comparisons, Android Chrome or CDP performance investigations, high-memory or slow-homepage diagnosis, cold-cache validation, scroll/GC retention tests, key-timeline screenshots, source attribution, and standalone evidence-backed HTML reports.
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- audit-agent-workflowsSkill
- find-simplificationsSkill
- frontend-acceptanceSkill
- polish-code-changeSkill
- review-code-changeSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 11 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Read repository instructions before inspecting source.
- Distinctive: line 16
Create a goal only when the user explicitly requests one.
- Distinctive: line 27
Use at least two fresh baseline samples before treating a value as representative.
- Very specific: line 29
Every collector invocation receives a collision-resistant sample ID, so repeated baseline, failure, screenshot, and memory artifacts remain …
- Distinctive: line 33
Prefer Android Chrome over desktop emulation when an ADB device is available.
- Very specific: line 35
Use Node.js 22 or newer; the collector relies on the built-in fetch and WebSocket implementations.
- Very specific: line 56
Keep results outside tracked application source.
- Very specific: line 65
If the repository's file-editing policy requires apply_patch, use it for authored files such as analysis.json.
- Distinctive: line 77
Run one command per target and scenario:
- Distinctive: line 135
When source attribution is in scope:
- Very specific: line 137
Use CodeGraph first when .codegraph/ exists.
- Distinctive: line 142
Read metrics.md before interpreting memory, TBT, images, constrained runs, or cache behavior.
- Very specific: line 146
Create optional analysis.json in the artifact root after reviewing raw evidence:
- Distinctive: line 172
Avoid generic advice. Every finding needs runtime evidence.
- Very specific: line 190
Search the non-image HTML for undefined, NaN, ENOENT, or missing-file placeholders.
- Distinctive: line 192
Search the report for private hostnames, identifiers, account UI, and local paths before sharing it.
- Distinctive: line 197
Always reset or remove only state created for the audit:
- Distinctive: line 204
Remove mappings only if this audit created them.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Page Performance Audit
Produce a reproducible diagnosis, not a single Lighthouse score. Prefer a real Android device, preserve failed samples, correlate metrics with screenshots, and finish with a standalone HTML report.
Establish scope
- Read repository instructions before inspecting source.
- Identify every target URL, especially local and production variants.
- Record authentication state, route, device, browser version, viewport, and whether production matches the current checkout.
- State the scenario matrix and cache policy before a long run. Wait only when the user explicitly asks to approve the plan first.
- Create a goal only when the user explicitly requests one.
Default matrix:
| Scenario | Network | CPU |
baseline | Unthrottled | 1× |
weak-network | 300 ms RTT, 1.6 Mbps down, 750 Kbps up | 1× |
weak-cpu | Unthrottled | 4× slowdown |
combined | Weak network | 4× slowdown |
Use at least two fresh baseline samples before treating a value as representative. Run constrained scenarios as guarded time-series samples; a stalled page is evidence.
Every collector invocation receives a collision-resistant sample ID, so repeated baseline, failure, screenshot, and memory artifacts remain separate. Use --sample-id NAME only when a stable operator-chosen identifier is useful; it must be unique within the artifact directory.
Select the measurement surface
Prefer Android Chrome over desktop emulation when an ADB device is available. Use desktop Chrome CDP only as a clearly labeled fallback.
Use Node.js 22 or newer; the collector relies on the built-in fetch and WebSocket implementations. Android renderer PSS additionally requires adb and dumpsys meminfo. The bundled collector targets Chromium/CDP and has no equivalent iOS process-memory collector.
For Android Chrome:
AUDIT_CDP_PORT=9223
adb devices -l
adb forward "tcp:$AUDIT_CDP_PORT" localabstract:chrome_devtools_remoteFor a local development port, add only the required reverse mapping:
AUDIT_APP_PORT=5173
adb reverse "tcp:$AUDIT_APP_PORT" "tcp:$AUDIT_APP_PORT"Do not force-stop Chrome, clear global browser data, or close pre-existing tabs. The bundled collector creates and closes only its dedicated test target. Record the pre-existing target list with probe. Treat probe output as sensitive because it contains existing tab titles and URLs. Use --chrome-package or CHROME_PACKAGE when the device does not use com.android.chrome.
Prepare artifacts
Keep results outside tracked application source. Use a dated temporary or gitignored directory with raw/, screenshots/, optional analysis.json, and report.html.
AUDIT_SKILL_DIR="/path/to/installed/page-performance-audit"
AUDIT_OUTPUT_DIR="${TMPDIR:-/tmp}/page-performance-audit-$(date +%F)"
mkdir -p "$AUDIT_OUTPUT_DIR"
node "$AUDIT_SKILL_DIR/scripts/audit-page.mjs" probe --cdp http://127.0.0.1:9223If the repository's file-editing policy requires apply_patch, use it for authored files such as analysis.json. Generated raw data, screenshots, and reports may be written by the bundled scripts.
Protect private evidence
The collector never writes token or cookie values, but raw artifacts can still contain full target and request URLs, query parameters, remote IPs, console errors, device model/build metadata, screenshots, and boolean authentication heuristics. Keep raw/ private unless it has been reviewed and redacted. Probe output can expose unrelated tabs and must not be published by default.
The HTML report hides full target URLs, device model/version, local artifact paths, and URLs embedded in errors by default. Add --include-target-urls or --include-device-details only when the report audience is authorized to see them. Screenshots and authored analysis.json remain the operator's responsibility to review.
Run cold-load scenarios
The collector always calls both Network.setCacheDisabled(true) and Network.setBypassServiceWorker(true). Treat these as controlled cold-load results, not repeat-navigation behavior.
Run one command per target and scenario:
node "$AUDIT_SKILL_DIR/scripts/audit-page.mjs" run \
--url https://example.com/ \
--label production \
--scenario baseline \
--out "$AUDIT_OUTPUT_DIR"Repeat with weak-network, weak-cpu, and combined. For local development, use a separate label and URL. Useful overrides:
--duration-ms 60000
--threshold-mb 2200
--latency-ms 300
--download-kbps 1600
--upload-kbps 750
--cpu-rate 4
--cdp http://127.0.0.1:9223
--adb /absolute/path/to/adb
--chrome-package com.android.chrome
--require-auth --auth-selector '[data-testid="account-menu"]'
--sample-id production-baseline-02The safety threshold stops a run after preserving the current memory sample. Do not raise it merely to force a page to finish.
Without --auth-selector, authentication is only a generic heuristic based on storage keys, sign-in controls, and account-avatar UI. Use a stable project-owned CSS selector when authenticated state matters to the validity of the sample; do not describe the fallback heuristic as proof of identity.
Run scroll and retention testing
Choose the target that best represents user behavior, usually production. Measure initial state, intermediate scroll depths, idle retention, and forced GC:
node "$AUDIT_SKILL_DIR/scripts/audit-page.mjs" memory \
--url https://example.com/ \
--label production \
--out "$AUDIT_OUTPUT_DIR" \
--load-wait-ms 30000 \
--scrolls 10 \
--idle-ms 30000Compare renderer PSS, JS heap, DOM nodes, loaded images, decoded-image upper bound, and scroll depth. Do not equate a post-GC PSS drop with a fixed leak; distinguish reclaimable memory from retained DOM/media.
Diagnose before recommending
Rank hypotheses before deep source inspection. Test these common classes:
- Excess initial requests, preload closure, or eagerly mounted feature graphs.
- Oversized or over-eager media and decoded native memory.
- Hydration, long tasks, and main-thread blocking.
- Duplicate requests, polling, analytics, or subscriptions.
- Development-only overhead versus production behavior.
Aggregate network data by resource type, host, initiator, size, and time window. Compare screenshots at 0.5, 2, 5, and 10 seconds with FCP/LCP; a spinner is not meaningful content.
When source attribution is in scope:
- Use CodeGraph first when
.codegraph/exists. - Trace heavy initial resources to route imports, mounted components, loaders, preload configuration, media components, virtualization, and third-party SDK initialization.
- Reuse existing lazy boundaries, image-sizing utilities, and virtualization seams before proposing new abstractions.
- Separate measured facts, source-confirmed causes, inferences, proposed budgets, and unverified deployment assumptions.
Read metrics.md before interpreting memory, TBT, images, constrained runs, or cache behavior.
Add analysis
Create optional analysis.json in the artifact root after reviewing raw evidence:
{
"title": "Mobile homepage performance audit",
"summary": "One-paragraph evidence-backed conclusion.",
"findings": [
{
"priority": "P0",
"title": "Initial script closure dominates startup",
"evidence": "Measured request, transfer, timing, and source evidence."
}
],
"recommendations": [
{
"priority": "P0",
"title": "Move the heavy feature behind an interaction boundary",
"detail": "Expected impact and validation method."
}
],
"limitations": [
"Production deploy SHA was unavailable."
]
}Avoid generic advice. Every finding needs runtime evidence; every code-level cause needs a source path or call/import path. Label budgets as proposed targets unless they already exist in project policy.
Generate and verify the report
node "$AUDIT_SKILL_DIR/scripts/build-report.mjs" \
--input "$AUDIT_OUTPUT_DIR" \
--title "Page performance and memory audit"The report embeds screenshots for offline viewing but intentionally summarizes raw JSON without embedding request URLs. Full target URLs and device details are opt-in. Treat raw/ as sensitive even when the report is safe to share.
The report is also the executable coverage gate. It is PASS only when every target has at least two baseline samples plus weak-network, weak-cpu, and combined, at least one memory-retention run exists, screenshots exist, and no failed or invalid-auth sample remains. The HTML is still written for incomplete audits, but the command reports INCOMPLETE, lists every missing obligation, and exits non-zero.
Verify before handoff:
- Parse every raw JSON file.
- Confirm the report exists, closes with
</html>, and embeds the expected screenshot count. - Search the non-image HTML for
undefined,NaN,ENOENT, or missing-file placeholders. - Render the report in Chrome and visually inspect at least the first viewport and one screenshot section.
- Search the report for private hostnames, identifiers, account UI, and local paths before sharing it.
- Report excluded, failed, aborted, and non-settled samples explicitly.
Clean up
Always reset or remove only state created for the audit:
adb reverse --remove "tcp:$AUDIT_APP_PORT"
adb forward --remove "tcp:$AUDIT_CDP_PORT"Remove mappings only if this audit created them. Confirm unrelated tabs and workspace changes remain untouched. Do not delete the evidence directory unless the user asks.
Handoff
Lead with the HTML report link and the highest-impact diagnosis. Include:
- device, browser, scenarios, cache policy, and target URLs;
- representative baseline and worst observed values;
- failure/stall evidence and interpretation limits;
- ranked remediation with validation criteria;
- links to the report, raw evidence, screenshots, and collector;
- whether source files were changed.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

