Skip to content
Backend Profiler cover
PerformanceFree · MIT

Backend Profiler

Find the one dominant cost — N+1, blocking I/O, hot path — with evidence, fix by leverage, verify under real load.

v1.0.0 · ~560 tokens · ⬇ 0 · Updated July 6, 2026

What it does

Profiles a slow endpoint/job to the dominant cost (time the phases; the DB is the usual suspect — N+1 first, then slow queries, then round trips; blocking I/O on the hot path; accidental O(n²)/unbounded memory), fixes by highest leverage (remove work, parallelize, batch, then micro-optimize) and re-measures under realistic data. N+1 and blocking I/O checked first — they're that common.

Example uses

Profile a slow API endpoint

One route takes seconds under production data and you refuse to guess at fixes.

GET /api/orders takes 4.2 seconds in production but 300ms locally. Instrument the phases (auth, DB, serialization), check for an N+1 first — each order seems to trigger a separate customer and line-items lookup — and show me the query-log evidence before proposing a fix. Then verify the fix against a production-sized dataset, not my 50-row dev table.

Fix an N+1 query

Your ORM loads a list and then fires one query per row, so latency grows linearly with data.

Our Django view lists 200 invoices and the debug toolbar shows 401 queries — a classic N+1 on invoice.customer and invoice.line_items. Rewrite it with select_related and prefetch_related, show the before and after query counts and latency, and run EXPLAIN on any query that stays slow to see if it needs an index.

Speed up a nightly job

A batch job has crept from minutes to hours as data grew, and nobody knows where the time goes.

Our nightly reporting job now takes 3 hours. Profile where the time actually goes — I suspect it awaits an external enrichment API serially for 40,000 rows and recomputes the same aggregates for every row. Fix by leverage: batch or parallelize the API calls, precompute the aggregates once, and give me before and after runtime with any trade-offs.

Install

# 1. Create the skill folder in your Claude setup
mkdir -p ~/.claude/skills/backend-profiler

# 2. Download SKILL.md into it (or move the file you just downloaded)
#    → ~/.claude/skills/backend-profiler/SKILL.md

# 3. Claude Code auto-discovers it on next launch.

Inside the skill

SKILL.md
---
name: backend-profiler
description: Find why a backend endpoint or job is slow — the hot path, N+1 queries, blocking I/O — with evidence. Use when an API is slow, a job takes too long, CPU/latency is high, or asked "why is this slow", "profile this endpoint", "reduce latency". Measure, find the dominant cost, fix that.
---

# Backend Profiler

Backend slowness is almost always one dominant cost, not a thousand small ones. Find it with
evidence (timing, query logs, a profiler), fix that one, verify. Don't guess.

## Locate the dominant cost

- **Time the phases**: where does the request actually spend its time? DB, an external call,
  serialization, CPU compute? Instrument the boundaries or use an APM/profiler. The 80% is usually one phase.
- **The DB is the usual suspect**:
  - **N+1**: a query inside a loop (one query per row). → one join or `WHERE id IN (...)`.
    This is the single most common backend perf bug. Look for it first.
  - Slow query → hand to the `sql-query-optimizer` skill (EXPLAIN-driven: missing index,
    seq scan, bad plan).
  - Too many round trips → batch them.
- **Blocking I/O on the hot path**: a synchronous external call, disk, or lock the request
  waits on. → make it async/parallel, move it off the request, or cache it.
- **CPU**: an accidental O(n²), unbounded data loaded into memory, re-computing per request
  what could be cached.

## Fix by leverage

- Remove the work (cache, precompute, paginate so you don't load everything).
- Parallelize independent I/O instead of awaiting serially.
- Batch N calls into one.
- Only then micro-optimize code — usually the smallest lever.

## Verify

Re-measure under realistic load/data. A fix that helps on 10 rows and dies on 10k didn't fix
it. Confirm the dominant cost actually dropped.

## Rules

- Measure before touching anything; the bottleneck is rarely where it feels like it is.
- N+1 and blocking I/O on the hot path are the first two things to check — they're that common.
- Realistic data volume matters; don't optimize a query that only runs on tiny tables.

## Output

The measured hot path (with numbers), the dominant cost, the fix by highest leverage,
before→after latency, and any trade-off (memory for cache, staleness).

Changelog

  • v1.0.02026-07-03Initial clean-room write.

Frequently asked questions

Is Backend Profiler free?

Yes. Backend Profiler is free to download and MIT-licensed.

Where do I install Backend Profiler?

Place the SKILL.md file in ~/.claude/skills/backend-profiler/ and Claude Code auto-discovers it on next launch.

How many tokens does Backend Profiler use?

About 560 tokens — it is designed to be token-lean.

Anthony M. — Founder & Lead Reviewer
Anthony M.Verified Builder

We're developers and SaaS builders who use these tools daily in production. Every review comes from hands-on experience building real products — DealPropFirm, ThePlanetIndicator, PropFirmsCodes, and many more. We don't just review tools — we build and ship with them every day.

Written and tested by developers who build with these tools daily.