Performance · Claude Prompt

Performance Optimizer

Analyzes your code for performance bottlenecks and suggests concrete optimizations.

What it does

The Performance Optimizer prompt refuses to optimize blind. It forms hypotheses about the bottleneck, names the exact measurement to take, narrows to the real cause after you share numbers, and then proposes 2-3 ordered optimizations with expected improvements.

What it solves

Premature optimization wastes weeks. This prompt ensures every change has a measured reason and a measurable expected outcome — no more "rewrote everything to Rust" without knowing the baseline.

How to install

Which tool are you using?

Not sure? Claude.ai is the website. Claude Code is the command-line tool you install separately. Cursor is a code editor that reads .cursorrules.

  1. 01

    Copy the prompt

    Click the Copy button on the code block below to grab the full prompt text.

  2. 02

    Paste into a new Claude chat

    Open claude.ai or Claude Code and paste the prompt as the first message.

  3. 03

    Fill in the bracketed placeholder

    Replace [PASTE YOUR ... HERE] with your actual input before sending.

  4. 04

    Iterate on the output

    Claude's first response is usually 80% there. Ask for specific refinements — "make section 4 more concrete", "shorten section 7" — instead of regenerating from scratch.

The claude prompt file

Copy the full contents below, or download the file directly.

performance-optimizer.txt
performance-optimizer.txt
You are a performance engineer who measures before optimizing. When I paste code or describe a slow system: 1. Identify the likely hot path based on the code / description2. List 5 measurable hypotheses for the bottleneck3. For each hypothesis, name the exact measurement to take (tool + metric)4. After I share measurements, narrow to the real bottleneck5. Propose 2-3 concrete optimizations, ordered by effort vs impact Rules:- Never suggest an optimization without a hypothesis- Always state the expected improvement- Warn about optimizations that hurt readability or increase risk- Prefer algorithmic wins over micro-optimizations Code or system to analyze:[PASTE CODE OR DESCRIPTION HERE]

Example output

What Claude does before and after you install this claude prompt.

Without this claude prompt

Claude suggests memoizing everything and adding a cache. You implement it. Nothing gets faster because the real bottleneck was a database index.

With this claude prompt

Claude names 4 hypotheses. Measurement points to an N+1 query. Claude proposes an eager load, estimates 10x speedup, warns about memory impact. Fix ships, measurement confirms 12x.

Customization tips

Add a step 0 requiring Claude to ask for the current baseline metric if not provided — ensures comparisons are always meaningful. For frontend work, extend the measurement step to cover Web Vitals specifically. For backend, add p95 and p99 latency as default metrics.

Related resources

Frequently asked questions

Will it just tell me to memoize?

No. Every suggestion requires a measured reason.

Does it work for frontend?

Yes — React, Flutter web, any UI stack.

Does it work for databases?

Yes, especially for query optimization.

Does it cover infrastructure?

Partially. For infra-level perf, pair with the Tech Stack Advisor.

Can it benchmark for me?

It tells you what to measure and how. You run the benchmarks.

Want more like this?

Browse the full RohanKit library — free resources for Claude and Cursor.

Back to RohanKit