AGENT SKILL

extension-profiling

Compare browser extension performance between branches using WDYR, React DevTools Profiler, and E2E benchmarks with statistical rigor.

License 许可
MIT
所属仓库
MetaMask/skills
最近更新
2026-11-14
Stars
★ 25
Forks
11

01 前言 Front Matter

name
extension-profiling
maturity
experimental
description
Compare browser extension performance between branches using WDYR, React DevTools Profiler, and E2E benchmarks with statistical rigor.

02 资源文件 4

03 SKILL.md 正文

Browser Extension Profiling

Methodology for profiling and comparing extension performance across branches or commits.

When To Use

  • Validating that a refactor reduces unnecessary re-renders (needs before/after comparison)
  • Establishing baseline metrics for a performance initiative
  • Investigating a reported UI slowdown in the extension

Do Not Use When

  • Single-run comparisons — statistical significance requires ≥10 runs per scenario
  • The change touches only non-render paths (background scripts, network with no UI impact)
  • Target behavior is server-side latency, not UI rendering

Workflow

  1. Build both branches on the same machine and Chrome version: yarn build:test for the E2E benchmarks, and a development build (yarn start or yarn build:test:dev) for the React DevTools Profiler. For a PR, build the PR's merge-base as the baseline, not main's tip. The merge-base is the build the PR actually changed.

  2. WDYR profiling (unnecessary re-render counts)

    ENABLE_WHY_DID_YOU_RENDER=true yarn start
    

    Flags to watch:

    • different objects that are equal by value → object recreation
    • different functions with the same name → callback recreation
    • props object itself changed but values equal → parent cascade
  3. React DevTools Profiler for flame graphs and commit timings, on a development build. yarn build:test passes --mode production, which sets NODE_ENV=production, and React's production build records no profiling data.

    yarn devtools:react
    
  4. E2E benchmarks for scenario durations

    yarn test:e2e:benchmark
    
  5. Collect ≥10 runs per scenario. Discard top/bottom 10%. Report mean, median, stddev, p75, p95.

  6. Effect size: report the difference in the metric's own units alongside Cohen's d. Cohen's d is the difference divided by the benchmark's own spread, so the difference worth acting on comes from product impact, fixed before the runs.

Common Pitfalls

Mistake Correct Approach
Running branches on different machines or Chrome versions Same machine, same Chrome, no other apps running
Pooling all runs including noisy late-session ones Fix the primary analysis, and any rule for dropping a round, before the runs. Report per-round stats as sensitivity, with explicit round attribution
Reporting absolute re-render counts without scenario context Normalize per-action; cascade fixes show multiplied impact at root
Skipping cache and state reset between runs Clear browser cache, reset extension state for each run

Pre-Profiling Checklist

  • [ ] Both branches built with yarn build:test (benchmarks) and a development build (React DevTools Profiler)
  • [ ] Same machine, same Chrome version
  • [ ] No other tabs or applications running
  • [ ] WDYR enabled: ENABLE_WHY_DID_YOU_RENDER=true
  • [ ] Cache and extension state cleared between runs
  • [ ] Wallet state sized for the scenario: yarn start:with-state runs yarn start with a generated fixture wallet (30 accounts by default). A null on an empty wallet is a fact about the fixture, not the code

04 同仓库更多 Skills

MetaMask
MetaMask/skills

recipe-performance

Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.

★ 25
MetaMask
MetaMask/skills

x402-payments

Build x402 payment flows using MetaMask Smart Accounts Kit, machine to machine payments over HTTP with ERC-7710 delegations and ERC-7715 Advanced Permissions

★ 25
MetaMask
MetaMask/skills

smart-accounts-kit

Build dApps with MetaMask Smart Accounts Kit — ERC-4337 smart accounts, delegations, and Advanced Permissions (ERC-7715)

★ 25
MetaMask
MetaMask/skills

oh-my-opencode

Multi-agent orchestration plugin for OpenCode. Use when the user wants to install, configure, or operate oh-my-opencode — including agent delegation, ultrawork mode, Prometheus planning, background tasks, category-based task routing, model resolution, tmux integration, or any oh-my-opencode feature. Covers installation, configuration, all agents (Sisyphus, Oracle, Librarian, Explore, Atlas, Prometheus, Metis, Momus), all categories, slash commands, hooks, skills, MCPs, and troubleshooting.

Skill与智能体开发
★ 25
MetaMask
MetaMask/skills

gator-cli

Use when you need to operate the @metamask/gator-cli to initialize profiles, upgrade EOA to EIP-7702, grant, redeem, and revoke ERC-7710 delegations, or inspect balances and delegations. Covers commands, required flags, grant scopes, redeem action types, configuration locations, and common usage flows.

★ 25
MetaMask
MetaMask/skills

ui-development

UI component development standards for MetaMask clients: the strict design-system-first component hierarchy, availability checks before building custom components, styling with design tokens, and required imports. Use when building, restyling, or reviewing any UI component, or when choosing between a design-system, component-library, or custom component.

设计师
★ 25