performance-optimizer

performance-optimizer is a skill for Claude Code, Codex from asgarovf/locusai. It costs 36 tokens per session (1,378 once invoked), scanned A, original, MIT.

A guide for finding and fixing application performance bottlenecks, such as slow code, database queries, page loads, or excessive memory use. It requires measuring performance before changing the code.

In plain words
What is it for?
Use it to profile backend code, inspect database queries, measure HTTP endpoints, investigate frontend loading, reduce memory use, and improve build or CI/CD times.
Why use it?
It helps focus optimization on the part that is actually slow instead of making unverified changes.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/asgarovf/locusai/performance-optimizer
Any agent
npx skills add asgarovf/locusai --skill performance-optimizer
Clone the repo
git clone --depth 1 https://github.com/asgarovf/locusai

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for performance-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/skills/asgarovf/locusai/performance-optimizer.svg)](https://agentmods.dev/skills/asgarovf/locusai/performance-optimizer)
Your own site
<a href="https://agentmods.dev/skills/asgarovf/locusai/performance-optimizer"><img src="https://agentmods.dev/badge/skills/asgarovf/locusai/performance-optimizer.svg" alt="Measured on agentmods" height="20"></a>
Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,378 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00036 $0.01378
Opus 5 $0.00018 $0.00689
Sonnet 5 $0.00007 $0.00276
Haiku 4.5 $0.00004 $0.00138

Measured 3d ago against content hash 2bd774bbb483, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

performance-optimizer scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -w "@curl-format.txt" -o /dev/null -s http://localhost:3000/api/users
skills/performance-optimizer/SKILL.md · 203 lines

How it starts

The opening of the file, as written. The whole thing — 203 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Performance Optimizer

When to use this skill

  • Application or endpoint is slow
  • Database queries taking too long
  • High memory usage or memory leaks
  • Frontend load times need improvement
  • Need to handle higher throughput
  • Optimizing build or CI/CD times

Step 1: Measure first

Never optimize without measuring. Identify the actual bottleneck.

Backend profiling

# Node.js — CPU profile
node --prof app.js
node --prof-process isolate-*.log > processed.txt

# Node.js — built-in profiler
node --inspect app.js  # Then open chrome://inspect

# Python — cProfile
python -m cProfile -s cumtime app.py
python -m cProfile -o output.prof app.py  # Save for analysis

# HTTP endpoint timing
curl -w "@curl-format.txt" -o /dev/null -s http://localhost:3000/api/users
# curl-format.txt contains: time_total, time_connect, time_starttransfer

Database profiling

-- PostgreSQL: Identify slow queries
SELECT query, mean_exec_time, calls, total_exec_time
FROM pg_stat_statements
ORDER BY mean_exec_time DESC
LIMIT 20;

-- Explain a slow query
EXPLAIN ANALYZE SELECT * FROM orders
WHERE user_id = 123 AND status = 'active'
ORDER BY created_at DESC;

Frontend profiling

# Lighthouse CLI
npx lighthouse http://localhost:3000 --output=json --output-path=./report.json

# Bundle size analysis
npx webpack-bundle-analyzer stats.json
npx vite-bundle-visualizer

Step 2: Common bottlenecks and fixes

N+1 queries

// BAD: N+1 — one query per user
const users = await db.query('SELECT * FROM users');
for (const user of users) {
  user.orders = await db.query('SELECT * FROM orders WHERE user_id = $1', [user.id]);
}

// GOOD: 2 queries total
const users = await db.query('SELECT * FROM users');
const userIds = users.map(u => u.id);
const orders = await db.query('SELECT * FROM orders WHERE user_id = ANY($1)', [userIds]);
const ordersByUser = groupBy(orders, 'user_id');
users.forEach(u => u.orders = ordersByUser[u.id] ?? []);

Read the full file on GitHub · 203 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 203 lines · 36 tokens per session scan A 2bd774bbb483

Subscribe to this mod's changes

performance-optimizer is a skill published in the GitHub repository asgarovf/locusai (23 stars, last pushed 5mo ago), licensed MIT. It adds 36 tokens to every session and 1,378 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.