agentleFS
imbue-aiimbue-ai/sculptor/.claude/skills/measure-react-renders/SKILL.md

measure-react-renders

Skill246 starsChanged 5 months agoMITView on GitHub

Compare React component render counts between origin/main and the current branch during a user-defined UI scenario (e.g. panel resize, navigation). Use when verifying that performance changes actually reduced re-renders.

  • Installs packages

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If the user provides one, use it.

    line 22
  2. Very specific:

    Use --skip-build if frontends are already built.

    line 44

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Render Performance Comparison

Step 1: Create the baseline worktree

git fetch origin main
git worktree add /tmp/sculptor_baseline origin/main
cd /tmp/sculptor_baseline/sculptor/frontend && npm install --silent

Step 2: Write the scenario file

If the user provides one, use it. Otherwise write a Python file exporting:

  • DESCRIPTION: str — what is being measured
  • TARGET_COMPONENTS: list[str] — component names to highlight
  • setup(page, base_url, workspace_id, task_id) — navigate + wait
  • action(page) — perform the action to measure

Component names must be unminified source names (e.g. SplittableSectionComponent for the memo-wrapped SplittableSection export, AlphaChatInterface if not wrapped).

See scenarios/panel_resize.py for an example.

Step 3: Run the comparison

uv run --project sculptor python \
  .claude/skills/measure-react-renders/scripts/perf_compare.py \
  --baseline-dir /tmp/sculptor_baseline \
  --current-dir "$(pwd)" \
  --scenario path/to/scenario.py

Use --skip-build if frontends are already built.

The script builds both frontends with --minify false (preserves component names), starts two isolated backends, injects __REACT_DEVTOOLS_GLOBAL_HOOK__ via Playwright's addInitScript before React loads, runs the scenario, and prints a comparison table.

Step 4: Cleanup

git worktree remove /tmp/sculptor_baseline

Scenario example

import time

DESCRIPTION = "Section resize render cascade"
TARGET_COMPONENTS = ["AlphaChatInterface", "SectionGrid", "SplittableSectionComponent"]

def setup(page, base_url, workspace_id, task_id):
    page.goto(f"{base_url}/#/ws/{workspace_id}/agent/{task_id}")
    page.wait_for_load_state("networkidle")
    time.sleep(5)

def action(page):
    handles = page.locator('[role="separator"]').all()
    handle = handles[-1]
    handle.focus()
    time.sleep(0.3)
    for _ in range(5):
        page.keyboard.press("ArrowLeft")
        time.sleep(0.15)
    for _ in range(5):
        page.keyboard.press("ArrowRight")
        time.sleep(0.15)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.