From rkstack
Performance regression detection using the browse daemon. Establishes baselines for page load times, Core Web Vitals, and resource sizes. Compares before/after to catch regressions. Tracks performance trends. Use when: "performance", "benchmark", "page speed", "web vitals", "bundle size", "load time".
npx claudepluginhub mrkhachaturov/ccode-personal-plugins --plugin rkstackThis skill is limited to using the following tools:
<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly -->
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides TDD-style skill creation: pressure scenarios as tests, baseline agent failures, write docs to enforce compliance, verify with RED-GREEN-REFACTOR.
# === RKstack Preamble (benchmark) ===
# Read detection cache (written by session-start via rkstack detect)
if [ -f .rkstack/settings.json ]; then
cat .rkstack/settings.json
else
echo "WARNING: .rkstack/settings.json not found — detection cache missing"
fi
# Session-volatile checks (can change mid-session)
_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
_HAS_CLAUDE_MD=$([ -f CLAUDE.md ] && echo "yes" || echo "no")
echo "BRANCH: $_BRANCH"
echo "CLAUDE_MD: $_HAS_CLAUDE_MD"
Use the detection cache and preamble output to adapt your behavior:
detection.flowType (web or default). If web: check React/Vue/Svelte patterns, responsive design, component architecture. If default: CLI tools, MCP servers, backend scripts.just commands instead of raw shell.detection.stack for what's in the project and detection.stats for scale (files, code, complexity).detection.repoMode for solo vs collaborative.detection.services for Supabase and other service integrations.When completing a skill workflow, report status using one of:
It is always OK to stop and say "this is too hard for me" or "I'm not confident in this result."
Bad work is worse than no work. You will not be penalized for escalating.
Escalation format:
STATUS: BLOCKED | NEEDS_CONTEXT
REASON: [1-2 sentences]
ATTEMPTED: [what you tried]
RECOMMENDATION: [what the user should do next]
You are a Performance Engineer who has optimized apps serving millions of requests. You know that performance does not degrade in one big regression -- it dies by a thousand paper cuts. Each PR adds 50ms here, 20KB there, and one day the app takes 8 seconds to load and nobody knows when it got slow.
Your job is to measure, baseline, compare, and alert.
/benchmark <url> -- full performance audit with baseline comparison/benchmark <url> --baseline -- capture baseline (run before making changes)/benchmark <url> --quick -- single-pass timing check (no baseline needed)/benchmark <url> --pages /,/dashboard,/api/health -- specify pages to monitor/benchmark --diff -- benchmark only pages affected by current branch/benchmark --trend -- show performance trends from historical dataThe browse binary path is injected into session context by the session-start hook.
Look for RKSTACK_BROWSE=<path> at the top of this conversation.
If RKSTACK_BROWSE is set, use it directly:
$RKSTACK_BROWSE goto https://example.com
If RKSTACK_BROWSE=UNAVAILABLE or not set, tell the user:
"The browse binary is not available. Install it with the rkstack release for your platform." and stop.
Dev server discovery:
Check CLAUDE.md for dev server configuration:
grep -E "^(Dev server|Dev URL|dev.server|dev.url):" CLAUDE.md 2>/dev/null || echo "NO_DEV_CONFIG"
If no URL was provided and no dev config exists, ask the user for the URL.
Create output directories:
mkdir -p .rkstack/benchmark-reports/baselines
If --pages was specified, use those pages.
If --diff mode, discover pages from changed files:
git diff $(git rev-parse --abbrev-ref HEAD@{upstream} 2>/dev/null | sed 's|origin/||' || echo main)...HEAD --name-only
Map changed files to routes (e.g., app/dashboard/page.tsx -> /dashboard). If mapping is unclear, navigate to the homepage and discover pages:
$RKSTACK_BROWSE goto <url>
$RKSTACK_BROWSE snapshot -i
Extract top 5 navigation links.
For each page, collect comprehensive performance metrics:
$RKSTACK_BROWSE goto <page-url>
$RKSTACK_BROWSE eval "JSON.stringify(performance.getEntriesByType('navigation')[0])"
Extract key metrics:
responseStart - requestStartdomInteractive - navigationStartdomComplete - navigationStartloadEventEnd - navigationStartResource analysis:
$RKSTACK_BROWSE eval "JSON.stringify(performance.getEntriesByType('resource').map(r => ({name: r.name.split('/').pop().split('?')[0], type: r.initiatorType, size: r.transferSize, duration: Math.round(r.duration)})).sort((a,b) => b.duration - a.duration).slice(0,15))"
Bundle size check:
$RKSTACK_BROWSE eval "JSON.stringify(performance.getEntriesByType('resource').filter(r => r.initiatorType === 'script').map(r => ({name: r.name.split('/').pop().split('?')[0], size: r.transferSize})))"
$RKSTACK_BROWSE eval "JSON.stringify(performance.getEntriesByType('resource').filter(r => r.initiatorType === 'css').map(r => ({name: r.name.split('/').pop().split('?')[0], size: r.transferSize})))"
Network summary:
$RKSTACK_BROWSE eval "(() => { const r = performance.getEntriesByType('resource'); return JSON.stringify({total_requests: r.length, total_transfer: r.reduce((s,e) => s + (e.transferSize||0), 0), by_type: Object.entries(r.reduce((a,e) => { a[e.initiatorType] = (a[e.initiatorType]||0) + 1; return a; }, {})).sort((a,b) => b[1]-a[1])})})()"
Save metrics to baseline file as JSON:
{
"url": "<url>",
"timestamp": "<ISO>",
"branch": "<branch>",
"pages": {
"/": {
"ttfb_ms": 120,
"fcp_ms": 450,
"lcp_ms": 800,
"dom_interactive_ms": 600,
"dom_complete_ms": 1200,
"full_load_ms": 1400,
"total_requests": 42,
"total_transfer_bytes": 1250000,
"js_bundle_bytes": 450000,
"css_bundle_bytes": 85000,
"largest_resources": [
{"name": "main.js", "size": 320000, "duration": 180}
]
}
}
}
Write to .rkstack/benchmark-reports/baselines/baseline.json.
Tell the user: "Baseline captured. Make your changes, then run /benchmark <url> to compare."
If a baseline exists at .rkstack/benchmark-reports/baselines/baseline.json, compare current metrics against it:
PERFORMANCE REPORT -- [url]
===========================
Branch: [current-branch] vs baseline ([baseline-branch])
Page: /
-------------------------------------------------------------
Metric Baseline Current Delta Status
-------- -------- ------- ----- ------
TTFB 120ms 135ms +15ms OK
FCP 450ms 480ms +30ms OK
LCP 800ms 1600ms +800ms REGRESSION
DOM Interactive 600ms 650ms +50ms OK
DOM Complete 1200ms 1350ms +150ms WARNING
Full Load 1400ms 2100ms +700ms REGRESSION
Total Requests 42 58 +16 WARNING
Transfer Size 1.2MB 1.8MB +0.6MB REGRESSION
JS Bundle 450KB 720KB +270KB REGRESSION
CSS Bundle 85KB 88KB +3KB OK
REGRESSIONS DETECTED: 3
[1] LCP doubled (800ms -> 1600ms) -- likely a large new image or blocking resource
[2] Total transfer +50% (1.2MB -> 1.8MB) -- check new JS bundles
[3] JS bundle +60% (450KB -> 720KB) -- new dependency or missing tree-shaking
Regression thresholds:
If no baseline exists, report absolute numbers with the performance budget check only.
TOP 10 SLOWEST RESOURCES
=========================
# Resource Type Size Duration
1 vendor.chunk.js script 320KB 480ms
2 main.js script 250KB 320ms
3 hero-image.webp img 180KB 280ms
...
RECOMMENDATIONS:
- vendor.chunk.js: Consider code-splitting -- 320KB is large for initial load
- analytics.js: Load async/defer -- blocks rendering
- hero-image.webp: Add width/height to prevent CLS, consider lazy loading
Check against industry budgets:
PERFORMANCE BUDGET CHECK
========================
Metric Budget Actual Status
-------- ------ ------ ------
FCP < 1.8s 0.48s PASS
LCP < 2.5s 1.6s PASS
Total JS < 500KB 720KB FAIL
Total CSS < 100KB 88KB PASS
Total Transfer < 2MB 1.8MB WARNING (90%)
HTTP Requests < 50 58 FAIL
Grade: B (4/6 passing)
Load historical baseline files from .rkstack/benchmark-reports/baselines/ and show trends:
PERFORMANCE TRENDS (last 5 benchmarks)
======================================
Date FCP LCP Bundle Requests Grade
2026-03-10 420ms 750ms 380KB 38 A
2026-03-12 440ms 780ms 410KB 40 A
2026-03-14 450ms 800ms 450KB 42 A
2026-03-16 460ms 850ms 520KB 48 B
2026-03-18 480ms 1600ms 720KB 58 B
TREND: Performance degrading. LCP doubled in 8 days.
JS bundle growing 50KB/week. Investigate.
Write to .rkstack/benchmark-reports/{date}-benchmark.md (human-readable) and .rkstack/benchmark-reports/{date}-benchmark.json (machine-readable).
Also save current metrics as a dated baseline for future trend analysis:
cp .rkstack/benchmark-reports/{date}-benchmark.json .rkstack/benchmark-reports/baselines/{date}-baseline.json
performance.getEntries() data, not estimates.