happier-profile-and-optimize

Profiles and optimizes measured performance costs across app, device, server, and database workloads.

1.6k|141|Updated Dec 16, 2025
One-click install
npx skills add https://github.com/happier-dev/happier --skill happier-profile-and-optimize
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: happier-profile-and-optimize
Source: https://github.com/happier-dev/happier/tree/main/skills/happier-profile-and-optimize
Command: npx skills add https://github.com/happier-dev/happier --skill happier-profile-and-optimize

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Performance work often fails because teams fix the wrong thing: they profile the wrong phase, trust an instrument that cannot see the real cost, or build a fix before falsifying the hypothesis. This Skill provides a disciplined investigation method for any work whose success is a measured cost — slowness, jank, startup time, blocked JS, memory, render churn, or a slow query.

Core Features & Use Cases

  • Cost framing and instrument routing: Define the phase, metric, workload, and symptom first, then route to the right instrument — React profiler, native CPU profiler (xctrace/Perfetto), React DevTools, Metro debugger, or SQL query planners (EXPLAIN QUERY PLAN, EXPLAIN).
  • Waste labeling and hypothesis falsification: Classify waste as TOO EARLY, TOO OFTEN, TOO MUCH, TOO SERIAL, WRONG SHAPE, N+1, RENDER CHURN, or CACHE HAZARD, then build a cheap falsifying control before writing any fix.
  • Measured proof and honest reporting: Replay the same flow with paired measurements, revert fixes that cost UX, and report [blocked] instead of inferred numbers when measurement is impossible.
  • Use Case: A React Native app takes 12 seconds to open. Instead of assuming module loading, you arm a drift sampler, discover the JS thread is blocked outside React, run a second-open control to retire the lazy-loading hypothesis, and fix the actual hotspot with before/after blocked-ms proof.

Quick Start

Ask the AI to investigate why a specific screen, query, or startup phase is slow using the profile-and-optimize method, naming the phase and metric you care about.

Frequently Asked Questions about happier-profile-and-optimize

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I profile a slow React Native app startup?

Frame the phase (cold open vs warm foreground), get a total blocked-time number first, then route to the right instrument: React profiler for render counts, native profiler (xctrace/Perfetto) for CPU hotspots outside React. Arm the probe before performing the flow, then reconcile attributed time against the total.

How to diagnose a slow SQL query with EXPLAIN?

Read the query plan for its shape, not its cost number: which index was chosen, which columns the index condition binds, and what predicate landed in Filter. Run EXPLAIN QUERY PLAN on SQLite and EXPLAIN on PostgreSQL on a seeded table after ANALYZE, since the engines can choose different plans for the same query.

Why does the React profiler show less time than the actual hang?

The React profiler only sees render and commit work inside React; CPU work elsewhere on the JS thread is invisible to it. In one documented case it reported 1.4 seconds while the thread was blocked for 12 seconds, so always reconcile instrument totals against the real phase total.

When should I not use this profiling method?

Route elsewhere when the incident is a failure rather than a cost — errors, crashes, or broken sessions belong in diagnosis first. Write-time UI performance invariants like referential stability and narrow subscriptions live in package-level instructions, not in this investigation method.

What is a falsifying control in performance optimization?

A falsifying control is the cheapest observation that could prove your hypothesis wrong, run before building any fix. Examples include comparing cold versus warm opens, emptying one input, or short-circuiting the suspect path — a minutes-long control can retire days of planned work.