aifolimizer: Skill for Claude Code

.claude/skills/perf-optimizer/SKILL.md

perf-optimizer is a skill for Claude Code from tusharagg1/aifolimizer. It costs 99 tokens per session (1,938 once invoked), scanned A, original, MIT.

A performance-optimization guide for backend code such as FastAPI request handlers, MCP tools, services, and cache layers. It requires measuring a slow path before changing code and focuses on latency, memory use, throughput, concurrency, and data handling.

In plain words
What is it for?
Investigating slow endpoints or tools, measuring cache behavior, reducing repeated work, improving asynchronous processing, and optimizing backend data structures.
Why use it?
It helps locate the actual bottleneck instead of making speculative rewrites that may not improve performance.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md.

This is tusharagg1/aifolimizer's own configuration. It tells Claude Code how to work on aifolimizer itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything aifolimizer configures →

Part of the aifolimizer plugin — 28 skills, 2 agents shipped together

Reuse

Borrowing it

Nothing to install: this file belongs to tusharagg1/aifolimizer. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/tusharagg1/aifolimizer/master/.claude/skills/perf-optimizer/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/tusharagg1/aifolimizer

Made for: Claude Code.

Or install aifolimizer, the plugin that ships this one along with the rest of its 28 skills, 2 agents.

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 perf-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/skills/tusharagg1/aifolimizer/perf-optimizer.svg)](https://agentmods.dev/skills/tusharagg1/aifolimizer/perf-optimizer)
Your own site
<a href="https://agentmods.dev/skills/tusharagg1/aifolimizer/perf-optimizer"><img src="https://agentmods.dev/badge/skills/tusharagg1/aifolimizer/perf-optimizer.svg" alt="Measured on agentmods" height="20"></a>
Per session 99 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,938 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.1 $0.00099 $0.01938
Opus 5 $0.00049 $0.00969
Sonnet 5 $0.00020 $0.00388
Haiku 4.5 $0.00010 $0.00194

Measured 6d ago against content hash f85bac4fa1ca, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

perf-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 6d 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.

- **Blocking sync calls inside async** - `requests.get` in async route, `time.sleep`
.claude/skills/perf-optimizer/SKILL.md · 128 lines

How it starts

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

Performance Optimizer

Senior performance engineer mode. Backend hotpath focus - FastAPI routes (app/api/ws.py), MCP tools (mcp_server.py), service modules (app/services/*), cache layers (L1 dict + L2 diskcache). Hard rule: replace existing code only when measurably better. No speculative rewrites.

Scope

In-scope:

  • FastAPI handlers and MCP tools - request latency, payload size, serialization cost
  • Service-layer functions - yfinance/FRED/CoinGecko fetches, technicals computation, portfolio enrichment
  • Caching - L1 (in-process dict) and L2 (diskcache) hit rates, TTL tuning, key design
  • Concurrency - asyncio.gather batching, blocking-call detection, thread/process pool usage
  • Data structures - pandas vs dict, repeated iterrows, dict copies, list comprehensions vs generators

Out-of-scope (refuse):

  • Frontend perf (project is backend-only as of bac7241)
  • Algorithmic rewrites of financial logic (technical indicators, risk math) - correctness first, not perf
  • Infra changes (deploy, k8s, containers) - single-user local app

How to run

Stage 0 - Identify hotpath (measure, never guess)

  1. Ask user: which path is slow? (endpoint, MCP tool name, script, batch job). Refuse to "audit everything for perf" - too broad, low signal.
  2. Confirm reproduction: how to trigger, expected latency, observed latency. If user has no measurement, ask them to time it first.
  3. Use graph tools to map the hotpath:
    • semantic_search_nodes for entry function
    • query_graph with pattern=callees_of to follow downstream calls
    • get_impact_radius to scope changed-code blast radius
  4. Read the actual files only after graph reveals the call tree. Do NOT pre-read files.

Stage 1 - Profile (real numbers, not vibes)

For Python hotpath, instrument with one of:

  • time.perf_counter() around suspected slow blocks (cheapest, surgical)
  • cProfile for full function profile: python -m cProfile -o out.prof script.py then snakeviz out.prof
  • tracemalloc for memory: tracemalloc.start(); ... ; tracemalloc.get_traced_memory()
  • py-spy top --pid <pid> for live sampling against running uvicorn (no code change)

Read the full file on GitHub · 128 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. 6d ago First seen · 128 lines · 99 tokens per session scan A f85bac4fa1ca

Subscribe to this mod's changes

perf-optimizer is a skill published in the GitHub repository tusharagg1/aifolimizer (2 stars, last pushed 4d ago), licensed MIT. It adds 99 tokens to every session and 1,938 once invoked, about $0.0005 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-31.

Related

Other skills, from other repositories