performance

A set of guidelines for finding and fixing slow code. It says to measure the actual bottleneck first, then improve algorithms, database queries, and input/output in order.

In plain words
What is it for?
Use it when investigating slowness, planning optimizations, or reviewing a frequently used part of an application. It covers profiling, query plans, indexes, batching, connection pools, and request-path input/output.
Why use it?
It helps avoid guessing, premature caching, and changes that make little difference. It also highlights common database problems such as N+1 queries, where one request causes many smaller queries.

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/hautc-it/cil/performance
Any agent
npx skills add hautc-it/cil --skill performance
Clone the repo
git clone --depth 1 https://github.com/hautc-it/cil

Made for: Claude Code, Codex.

Per session 60 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 366 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00060 $0.00366
Opus 5 $0.00030 $0.00183
Sonnet 5 $0.00012 $0.00073
Haiku 4.5 $0.00006 $0.00037

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

Security

Grade A, and why

performance scanned grade A with 0 findings 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 2d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

templates/skills/performance/SKILL.md · 42 lines

What it actually says

Skill: Performance

Measure first. Optimize the right thing.

Protocol

  1. Profile — Identify the actual bottleneck. Don't guess. Use profiler, metrics, or timing.
  2. One change — Change one variable at a time. Otherwise you can't tell what helped.
  3. Algorithm first — O(n log n) beats O(n²) regardless of constants. Fix the algorithm.
  4. I/O second — Reduce round trips. Batch reads/writes. Use connection pools.
  5. Cache last — Caching hides problems. Fix the underlying query/computation first.

Database

  • EXPLAIN the query plan before optimizing.
  • Index on columns in WHERE, JOIN ON, ORDER BY.
  • SELECT only the columns you need.
  • Avoid N+1: use JOIN or batch fetch, never query in a loop.
  • Paginate large result sets. Never SELECT *.
  • Use read replicas for read-heavy workloads.

Application

  • Avoid synchronous I/O in request paths.
  • Pool connections (DB, HTTP, Redis).
  • Lazy-load what isn't needed on startup.
  • Avoid holding locks across I/O.
  • Profile memory, not just CPU.

Anti-patterns

  • Premature optimization (before measuring)
  • Optimizing cold paths (measure which path is hot first)
  • Cache without invalidation strategy
  • Adding indexes without analyzing query plans
  • Treating all latency as CPU (often it's I/O waiting)
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. 2d ago First seen · 42 lines · 60 tokens per session scan A 67f58c22f794

Subscribe to this mod's changes

performance is a skill published in the GitHub repository hautc-it/cil (1 stars, last pushed 1mo ago), licensed MIT. It adds 60 tokens to every session and 366 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.