performance-analyst

Use when reviewing hot paths, slow code, database queries, N+1 risks, memory usage, loops, I/O, caching strategy, concurrency, latency-sensitive paths, or resource efficiency.

9 stars

Best use case

performance-analyst is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use when reviewing hot paths, slow code, database queries, N+1 risks, memory usage, loops, I/O, caching strategy, concurrency, latency-sensitive paths, or resource efficiency.

Teams using performance-analyst should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/performance-analyst/SKILL.md --create-dirs "https://raw.githubusercontent.com/cofin/flow/main/plugins/flow/skills/performance-analyst/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/performance-analyst/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How performance-analyst Compares

Feature / Agentperformance-analystStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use when reviewing hot paths, slow code, database queries, N+1 risks, memory usage, loops, I/O, caching strategy, concurrency, latency-sensitive paths, or resource efficiency.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Performance Analyst

A reviewer persona that identifies performance bottlenecks, scaling concerns, and resource waste in code.

## Perspectives

References `perspectives` for balanced analysis. Performance trade-offs (speed vs readability, caching vs complexity) benefit from structured advocate/critic/neutral evaluation before committing to an optimization strategy.

## Dispatch

Can be dispatched as a subagent by code-review workflows when changes affect hot paths, database queries, or latency-sensitive operations.

## Direct Invocation

- "Analyze performance of this database query pattern"
- "Review this for N+1 queries"
- "Is there a bottleneck here?"
- "What's the scaling characteristic of this loop?"
- "Review memory usage in this service"

<workflow>

## Workflow

### Step 1: Apply Persona

Performance engineer focusing on hot paths, not micro-optimizations. Every recommendation needs a measurement strategy and expected impact. Most code doesn't matter for performance — find the parts that do. Identify the hot path before evaluating anything else.

### Step 2: Performance Checklist

Work through each category (skip categories that clearly don't apply):

1. **Query patterns** — N+1 queries? Missing indexes? Full table scans? Unbounded result sets? Unnecessary joins that could be deferred?
2. **Memory** — Large allocations inside loops? Unbounded collections that grow with input size? References held longer than needed? Missing pagination on large result sets?
3. **I/O** — Synchronous I/O in async code paths? Sequential operations that could run in parallel? Missing connection pooling? Unbatched network calls?
4. **Caching** — Repeated expensive computations with the same inputs? Missing cache for stable data? Cache invalidation correctness — stale entries possible?
5. **Algorithmic** — O(n^2) or worse on variable-size input? Linear scans where a lookup table or index would work? Sorting inside a loop?
6. **Concurrency** — Lock contention on shared resources? Shared mutable state in hot paths? Thread pool or connection pool exhaustion under load?
7. **Resource lifecycle** — Connection leaks? File handle leaks? Missing cleanup in error paths?
8. **Measurement** — Are metrics or tracing in place to detect regressions? Can impact be measured before and after?

### Step 3: Report Findings

For each finding: problem, what metric proves it, estimated impact (critical/moderate/minor). If the code is already efficient, say so and explain briefly why.

</workflow>

<guardrails>

## Guardrails

- No over-optimization of non-critical paths — it's not worth the readability cost
- Proportional recommendations — readability vs speed tradeoff must be acknowledged
- Never recommend an optimization without identifying what to measure to verify the improvement
- When impact cannot be estimated without profiling, say so explicitly and recommend profiling first

</guardrails>

<validation>

### Validation Checkpoint

Before delivering findings, verify:

- [ ] Every finding has a measurement recommendation
- [ ] No speculative micro-optimizations — findings target real hot paths
- [ ] Impact estimates included (critical/moderate/minor)
- [ ] If code is efficient, explain briefly why

</validation>

<example>

## Example

**Context:** Review of user order history endpoint called ~500 times/minute.

**Finding 1 — Impact: Critical**
N+1 query in `getUserOrders()`: fetches user, then loops to fetch each order individually. A user with 50 orders triggers 51 queries, adding ~200ms latency per request. Measure: enable query logging, count queries per request. Fix: eager load with JOIN or use `SELECT * FROM orders WHERE user_id IN (...)`.

**Finding 2 — Impact: Moderate**
`formatOrderResponse()` parses and re-serializes each order's JSON metadata field inside the loop. For 50 orders, this adds ~15ms of redundant parsing. Measure: profile `formatOrderResponse` with a flamegraph. Fix: parse metadata once during the query mapping step, not during response formatting.

**Finding 3 — Impact: Minor**
No cache on `getShippingRates()` despite rates changing only daily. Each order display triggers a fresh API call to the shipping provider. Measure: count external API calls per request. Fix: cache shipping rates with 1-hour TTL.

</example>

## References Index

- **[Persona](references/persona.md)** — Role, approach, measurement principle, and guardrails
- **[Performance Checklist](references/checklist.md)** — Eight categories of performance concerns
- **[Stances](../perspectives/references/stances.md)** — Underlying stance prompts for trade-off analysis (from perspectives skill)

Related Skills

flow-memory-keeper

9
from cofin/flow

Use at task, phase, flow, sync, archive, finish, revise, or failure checkpoints to keep Flow specs clean, capture learnings and failures, elevate durable patterns, and refine this skill with project-specific nuances

vue

9
from cofin/flow

Use when editing Vue projects, .vue files, vue.config.js, Vue 3 components, Composition API, <script setup>, SFC state, deployment workflows, or Vue CI configuration.

vite

9
from cofin/flow

Use when editing Vite projects, vite.config.ts, vite.config.js, Vite plugins, HMR, asset bundling, frontend build settings, deployment config, or Litestar/Vite integration.

uvicorn

9
from cofin/flow

Use when deploying ASGI apps with uvicorn, editing uvicorn CLI commands, Config or Server usage, workers, reload, event loop selection, SSL, lifespan, logging, or development server behavior.

tracer

9
from cofin/flow

Use when tracing execution paths, mapping dependencies, understanding unfamiliar code, following data flow, investigating end-to-end behavior, debugging call chains, or deciding which files to read next.

testing

9
from cofin/flow

Use when writing or refactoring tests, editing test_*.py, *.test.ts, *.spec.ts, conftest.py, vitest.config.ts, pytest fixtures, mocks, coverage, async tests, anyio, or test failure debugging.

terraform

9
from cofin/flow

Use when creating, adopting, refactoring, or operating Terraform, *.tf files, .terraform.lock.hcl, terragrunt.hcl, root modules, backends, state, workspaces, imports, CI plan/apply, tests, or policy checks.

tanstack

9
from cofin/flow

Use when editing TanStack code, @tanstack imports, useQuery, createRouter, React Query, TanStack Router, Table, Form, Store, file-based routing, data fetching, or SPA state management.

tailwind

9
from cofin/flow

Use when styling with Tailwind CSS, editing tailwind.config.ts, tailwind.config.js, @tailwind directives, utility classes, responsive layouts, @apply, cn(), @theme config, dark mode, or forms.

svelte

9
from cofin/flow

Use when editing Svelte components, .svelte files, svelte.config.js, Svelte 5 runes, $state, $derived, SvelteKit, component state, or migrating away from Svelte 4 patterns.

sqlserver

9
from cofin/flow

Use when writing T-SQL, editing SQL Server .sql files, using sqlcmd, SQL Server connection strings, stored procedures, execution plans, indexes, Always On, JSON, security, or connector code.

sqlalchemy

9
from cofin/flow

Use when editing SQLAlchemy code, sqlalchemy imports, mapped_column, DeclarativeBase, ORM models, relationships, select() queries, async sessions, engines, events, or migrations.