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.
npx agentmods add skills/chandrudp29/skillhub/performance-optimizernpx skills add chandrudp29/skillhub --skill performance-optimizergit clone --depth 1 https://github.com/chandrudp29/skillhubWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00026 | $0.01214 |
| Opus 5 | $0.00013 | $0.00607 |
| Sonnet 5 | $0.00005 | $0.00243 |
| Haiku 4.5 | $0.00003 | $0.00121 |
Grade A, and why
performance-optimizer 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.
How it starts
The opening of the file, as written. The whole thing — 149 lines — stays where its author put it; the contents beside it link to each section on GitHub.
When to Use
Apply when a system is slow, costs too much, or fails under load. Always measure before optimizing — guessing wastes time.
Core Rules
- Measure first, always. Never optimize without a profiler or benchmark showing the bottleneck
- Fix the biggest bottleneck first — fixing #2 before #1 gives partial gains at best
- Define a target before optimizing: "p99 < 200ms" not "faster"
- After every optimization, re-measure — sometimes fixes have side effects
The Loop
1. Measure → profiler, APM, benchmark (establish baseline)
2. Identify → find the hot path (usually 1-3 functions cause 80%+ of time)
3. Hypothesize → why is this slow? (N+1 query, GIL contention, memory copy, etc.)
4. Fix → smallest change that addresses root cause
5. Verify → re-run benchmark — is it faster? Regressions elsewhere?
6. Repeat → next bottleneck
Python Profiling
# cProfile — CPU profiling
import cProfile, pstats, io
pr = cProfile.Profile()
pr.enable()
# ... code to profile ...
pr.disable()
s = io.StringIO()
ps = pstats.Stats(pr, stream=s).sort_stats('cumulative')
ps.print_stats(20)
print(s.getvalue())
# line_profiler — line-by-line (use @profile decorator)
# pip install line_profiler
# kernprof -l -v script.py
# memory_profiler — memory usage line-by-line
# pip install memory_profiler
# @profile decorator, then: python -m memory_profiler script.py
# py-spy — sampling profiler, zero-code-change, attach to running process
# pip install py-spy
# py-spy top --pid 12345
# py-spy record -o profile.svg --pid 12345
Common Python Bottlenecks
# ❌ String concatenation in loop — O(n²) allocations
result = ""
for item in items:
result += str(item) # new string object each time
# ✓ join — one allocation
result = "".join(str(item) for item in items)
# ❌ Repeated dict/set lookup in hot loop
for item in items:
if item in some_list: # O(n) each time if it's a list
...
# ✓ Convert to set once
lookup = set(some_list) # O(1) lookup
for item in items:
if item in lookup:
...
# ❌ Unnecessary object creation in loop
for i in range(1_000_000):
temp = MyClass(i) # constructor overhead × 1M
# ✓ Reuse or use slots
class MyClass:
__slots__ = ['value'] # ~40% less memory, faster attribute access
# ❌ GIL-bound CPU work in threads
from threading import Thread # threads share GIL — no real parallelism for CPU
# ✓ Use ProcessPoolExecutor for CPU-bound work
from concurrent.futures import ProcessPoolExecutor
with ProcessPoolExecutor() as pool:
results = list(pool.map(cpu_intensive_fn, items))
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.
- 2d ago First seen · 149 lines · 26 tokens per session scan A c09d8220f25e
performance-optimizer is a skill published in the GitHub repository chandrudp29/skillhub (13 stars, last pushed 2mo ago), licensed MIT. It adds 26 tokens to every session and 1,214 once invoked, about $0.0001 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-30.
Other skills, from other repositories
performance-optimizer
Profile, diagnose, and fix performance bottlenecks in applications. Use when optimizing slow queries, reducing load times, improving runtime performance, or reducing memory usage.
performance-profiling
Performance Profiling & Optimization: Helps diagnose and fix performance issues including memory leaks, CPU bottlenecks, slow queries, high latency, and throughput problems. Covers profiling tools, flame graphs, load testing, caching strategies, and optimization techniques for Node.js, Java, Flutter, and web…
Performance Optimization
Full-stack performance analysis, optimization patterns, and monitoring strategies.
performance-analysis
Comprehensive performance analysis, bottleneck detection, and optimization recommendations for Claude Flow swarms.
ncu-cuda-profiling
Automated NCU (Nsight Compute) profiling workflow with full metrics collection and persistent storage.
performance-optimization
Optimizes application performance. Use when performance requirements exist, when you suspect performance regressions, or when Core Web Vitals or load times need improvement. Use when profiling reveals bottlenecks that need fixing.