/nexus-agents:performance-optimizationfrom nexus-agents
Measure-first optimization for code with evidence of slowness. Applies MIFVG cycle (Measure, Identify, Fix, Verify, Guard) and targets specific bottlenecks like N+1 queries.
Ships in nexus-agents. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Skip when:
"Premature optimization is the root of all evil." Don't optimize before you have evidence. The cost of complexity is permanent; the cost of waiting for evidence is one more profile run.
node --prof, clinic.js, browser DevTools Performance, pprof for memory.| Pattern | Symptom | Fix |
|---|---|---|
| N+1 queries | One query per record in a loop | Single batched query with IN clause or proper join |
| Unbounded data | Fetching all rows when 50 would do | Pagination + cursor-based limits |
| Synchronous I/O in hot path | readFileSync, execSync per request | Async + worker pool, or cache the result |
| Unnecessary serialization | JSON-parse-and-stringify the same blob multiple times | Pass through, or hash-cache by input |
| Cache miss patterns | Read-only data fetched on every render/request | TTL cache or memoization (with size bound) |
| Bundle size growth | First-paint regression after a feature add | Dynamic import for heavy features, code splitting at route boundaries |
| Re-render storms (React/Svelte/etc.) | Component renders 100x for one state change | Stable references, key-based memoization, lift state up |
| Excuse | Counter |
|---|---|
| "I'll add the optimization while I'm in here" | Optimization without a profile is gambling. The added complexity is permanent; the win may be zero or negative. |
| "Big-O says it's faster" | Big-O is asymptotic. For your actual n, the constant factors and cache effects often dominate. Measure. |
| "JavaScript engines optimize this" | Modern engines optimize hot loops, not your data flow. Don't assume — profile. |
| "It's a tiny win but free" | Free in code, expensive in review and bisect. Many "tiny wins" together obscure the actual hot path. |
| "Premature optimization is fine if it's clean" | The dichotomy isn't "messy vs clean optimization." It's "with evidence vs without." Without evidence, even clean optimization is premature. |
| "We'll measure in production" | You won't. Production has too much noise. Build a representative reproduction first. |
useMemo / React.memo / signal() everywhere as a precautionpnpm lint && pnpm typecheck && pnpm testWhat SKILL.md sets; muted values are Claude Code's defaults
Claude Code installs this plugin but refuses to load it
hooks/hooks.json: hooks.PreToolUse.0: Hook matcher "hooks" must be an array of hook entries; received undefined; hooks.PreToolUse.1: Hook matcher "hooks" must be an array of hook entries; received undefined — a PreToolUse/PermissionRequest hook that cannot be loaded may be what guards the permissions declared beside it, so nothing it sits in is applied until the entry is fixed or removed
hooks/hooks.json: hooks.PreToolUse.0: Hook matcher "hooks" must be an array of hook entries; received undefined; hooks.PreToolUse.1: Hook matcher "hooks" must be an array of hook entries; received undefined — a PreToolUse/PermissionRequest hook that cannot be loaded may be what guards the permissions declared beside it, so nothing it sits in is applied until the entry is fixed or removed
Checked against Claude Code 2.1.332. The listing below is what the repository ships; Claude Code doesn't load it as published.
34 skills in this plugin
/api-and-interface-designDesign stable, hard-to-misuse interfaces — REST endpoints, MCP tool
schemas, module boundaries, type contracts. Apply when defining new
surfaces or evolving public ones. Triggers on "API design", "interface",
"schema", "contract", "module boundary", "type design".
/browser-testing-with-devtoolsTest UI in real browsers via Chrome DevTools MCP. Apply when debugging
rendering issues, console errors, network behavior, performance, or
accessibility — anywhere static code analysis can't see runtime state.
Triggers on "browser test", "DOM inspect", "console errors",
"network trace", "core web vitals in browser", "ui bug repro".
/bug-fixFix a bug following project standards.
Use when fixing defects, debugging issues, or resolving reported problems.
Triggers on "fix bug", "debug", "fix issue", "resolve bug".
/code-simplificationReduce nesting, extract names, eliminate redundancy without changing
behavior. Apply after features work and tests pass — never as a
drive-by during feature work. Triggers on "simplify", "refactor for clarity",
"this is hard to read", "code review flagged complexity".
/codex-delegatorDelegate code generation tasks to Codex CLI for optimal performance.
Use when implementing features, generating tests, refactoring code, or
making bulk code changes. Triggers on "delegate to codex", "route to codex",
"use codex", "code generation".
/context-engineeringCurate what the agent sees, when, and how it's structured. Apply when
starting a session, when output quality drifts, when fanning out
subagents, or when configuring rules files. Triggers on
"context engineering", "rules file", "agent context",
"subagent fan-out", "context budget".
Other plugins' skills for the same job