.claude/skills/profile-browsing/SKILL.md
Profile app performance while browsing, collecting Web Vitals and React rerender data via react-scan. Orchestrates parallel profiler subagents via playwright-cli to capture navigation timing, long tasks, layout shifts, LCP, React commit counts, render bursts, and per-component render data. Use when profiling browsing performance, finding bottlenecks, diagnosing excessive rerenders, or auditing page performance.
npx skillsauth add bitsocialnet/bitsocial-web profile-browsingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Two-layer profiling: browser-level symptoms (Web Vitals, long tasks, scroll jank) and React-level diagnosis (commit counts, render bursts, per-component render data from react-scan). Each profiler subagent runs in its own browser session and context window.
http://bitsocial.localhost:1355 (yarn start via Portless)playwright-cli installed (npm install -g @playwright/cli@latest)IMPORTANT: The orchestrator (you) is responsible for ensuring exactly one dev server is running. Profiler subagents must never start a dev server themselves.
The app exposes performance and source-inspection helpers in about/src/lib/react-scan.ts. In dev mode it:
react-scanwindow.__getReactScanReport() for programmatic render datawindow.__ELEMENT_SOURCE__ for DOM-to-source resolutionThe profiler's addInitScript sets window.__PROFILING__ = true before the app loads, which tells react-scan to disable its toolbar and sounds during automated runs.
Before spawning any profiler subagents, verify exactly one dev server is available:
curl -sf http://bitsocial.localhost:1355 -o /dev/null && echo "OK" || echo "NOT RUNNING"
OK: proceed to Step 1.NOT RUNNING: start one instance with yarn start in the background, then poll until it responds. Do not start more than one.Split routes into batches of 2 to 4 for parallel profiling.
Default batches for this app:
| Batch | Session | Routes | Focus |
| ----- | -------- | ----------------- | --------------------------------- |
| 1 | prof-1 | /, /docs | Home page plus docs content |
| 2 | prof-2 | /apps, /about | App directory plus about page |
| 3 | prof-3 | /blog, /stats | Secondary content plus stats page |
Adjust batches to match the routes relevant to the change under investigation.
Read the profiler subagent definition at .claude/agents/profiler.md. Then spawn one profiler subagent per batch in parallel using Cursor's current delegation tool.
For each batch, include:
agent: "profiler"prof-NSpawn up to 4 subagents simultaneously. Each one opens its own browser session, navigates routes, scrolls, collects both Web Vitals and react-scan data per route, and returns a structured issues list.
Parallel is faster but can skew timing results under heavy machine load. For precise measurements, run the batches sequentially.
Collect structured output from each subagent and merge:
Critical, Warning, React Rerenders, Scroll Jank, and Info items.react-scan component data across routes.Critical first.## Performance Profile Results
### Critical
- [metric]: [value] at [route] — [what likely needs fixing]
### Warning
- [metric]: [value] at [route] — [what likely needs fixing]
### React Rerenders
- [route]: [N] commits during load, [M] during scroll — [likely cause]
- Render bursts detected at [routes] — suggests cascading state updates
- Top rerendering components (react-scan):
- [ComponentName]: [total count] renders across [routes], [time]ms total
- [ComponentName]: [total count] renders across [routes], [time]ms total
### Scroll Jank
- [route]: [N] long tasks during scroll (max [X]ms), [M] React commits — [likely cause]
### Info
- [observations]
### Per-View Summary
| View | Nav (ms) | Long Tasks | CLS | LCP (ms) | Commits | Scroll Commits | Bursts | Top Component |
|------|----------|-----------|-----|-----------|---------|----------------|--------|---------------|
| / | ... | ... | ... | ... | ... | ... | ... | ... |
| Signal | Likely cause | Fix direction |
| ---------------------------------------- | ------------------------------------------------------- | ------------------------------------------- |
| High commits, no long tasks | Frequent cheap rerenders | React.memo, stabilize props |
| High commits + long tasks | Expensive rerenders | Profile render cost, split components |
| High scroll commits | Scroll or intersection observer work triggering renders | Throttle handlers, memoize heavy list items |
| Render bursts (>5 in 100ms) | Cascading state updates | Batch updates, remove derived-state effects |
| react-scan: component with >30 renders | Missing memoization or unstable references | Stabilize props and parent renders |
| react-scan: component with >50ms time | Expensive render function | Split component, move work out of render |
When react-scan identifies a rerender hotspot but you still need the exact file behind a concrete DOM node, hand off to $inspect-elements.
playwright-cli -s=prof-followup eval "async el => JSON.stringify(await window.__ELEMENT_SOURCE__.resolve(el))" e7
Use source.filePath as the direct edit target and stack to understand which parent components own the node.
After profiling is complete and the report is delivered, verify no orphaned processes were left behind:
playwright-cli -s=prof-1 close 2>/dev/null
playwright-cli -s=prof-2 close 2>/dev/null
playwright-cli -s=prof-3 close 2>/dev/null
If the orchestrator started the dev server in Step 0, stop it now. If it was already running, leave it alone.
playwright-cli session.goto, so collect before navigating away.trace.zip viewable in Trace Viewer.__getReactScanReport returns null, the profiler still provides useful commit counts and render bursts.development
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
data-ai
Add or update i18next translation keys across all language files by spawning translator subagents. Use when the user asks to add a new translation, update existing translations, translate text, or work with i18n keys. Triggers on "translate", "add translation", "translation key", "i18n", "localization".
development
Test and debug Android wrapper features for Bitsocial Web using a local Android emulator or attached device. Manages emulator lifecycle, builds and installs the wrapper when commands are provided, runs focused checks, captures logcat diagnostics, and debugs WebView or TWA behavior. Use when the user asks to test Android, debug WebView behavior, run emulator tests, or says "test-apk".
testing
Review an open GitHub pull request, inspect bot and human feedback, decide which findings are valid, implement fixes on the PR branch, and merge the PR into master when it is ready. Use when the user says "check the PR", "address review comments", "review PR feedback", or "merge this PR".