debug-performance

A workflow for finding and fixing slow code by measuring performance before and after changes.

In plain words
What is it for?
Use it to investigate slow execution or high memory use, locate bottlenecks, analyze dependencies and functions, optimize them, and rerun the same benchmark.
Why use it?
It replaces guesses with baselines, call paths, complexity checks, and measured confirmation of the improvement.

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

Made for: Claude Code, Codex.

Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 624 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.00055 $0.00624
Opus 5 $0.00028 $0.00312
Sonnet 5 $0.00011 $0.00125
Haiku 4.5 $0.00006 $0.00062

Measured yesterday against content hash bbee5abe74d4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

debug-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 yesterday.

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.

skills/claude/debug-performance/SKILL.md · 96 lines

How it starts

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

Debug Performance

Find and fix performance bottlenecks by measuring, not guessing.

Workflow

Measure → Identify → Analyze → Optimize → Confirm

1. Measure

Establish a baseline before touching anything:

tl parallel \
  "baseline=tl run '<benchmark or timed command>'" \
  "complexity=tl complexity <file>" \
  "hotspots=tl hotspots"

2. Identify

Find the actual bottleneck:

tl parallel \
  "flow=tl flow <function> <file>" \
  "deps=tl deps <file>" \
  "symbols=tl symbols <file>"

3. Analyze

Understand why it's slow:

tl parallel \
  "snippet=tl snippet <function> <file>" \
  "related=tl related <file>" \
  "scope=tl scope <function> <file>"

4. Optimize

Apply the fix based on the bottleneck type:

# Algorithmic change
tl flow <function> <file>     # Verify new path is simpler

# Caching opportunity
tl impact <file>              # How many callers benefit?

# Reducing I/O
tl deps <file>                # Identify unnecessary imports

# Parallelization
tl flow <function> <file>     # Confirm no shared state

5. Confirm

tl run "<same benchmark>"     # Measure improvement — no numbers, no claim

Decision tree

"It's slow" → Do you have a measurement?
  ├─ Yes (specific operation) → tl flow on that operation
  │   → tl snippet on each function in chain
  │   → Find the O(n^2) or blocking I/O
  ├─ Vague ("app is slow") → tl hotspots + tl complexity
  │   → Profile top 3 complex files
  │   → tl flow on entry points to find hot paths
  └─ Memory issue → tl deps on entry point
      → Look for large imports, circular refs
      → tl guard for circular deps

Tips

  • Always benchmark before AND after — optimizations without numbers are guesses
  • tl complexity > 10 on a function is a red flag for performance problems
  • Check tl deps for heavy imports that could be lazy-loaded
  • Don't optimize cold paths — use tl flow to confirm the function is on the hot path
  • Use tl parallel for all context-gathering steps — they're independent

Read the full file on GitHub · 96 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. yesterday First seen · 96 lines · 55 tokens per session scan A bbee5abe74d4

Subscribe to this mod's changes

debug-performance is a skill published in the GitHub repository edimuj/tokenlean (11 stars, last pushed 1mo ago), licensed MIT. It adds 55 tokens to every session and 624 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-30.

Related

Other skills, from other repositories

zerodust

Sweep 100% of native gas tokens (ETH, BNB, MATIC, etc.) from EVM chains via ZeroDust, leaving exactly zero balance. Use when: user wants to exit a chain completely, consolidate dust balances, clean up wallets, or bridge remaining native tokens cross-chain. Supports 25 mainnet chains including Ethereum, Base, Arbitrum…

andresdefi/zerodust · 93 tokens

ctx2img

Cut context tokens by rendering it as images. ctx2img paint turns any text-shaped input (a repo, a directory, a file, markdown, stdin) into dense images that carry the full text at 60-75% fewer tokens, with stable handles and a verbatim factsheet; ctx2img read recovers guaranteed-exact text. Use before ingesting any…

Koukyosyumei/h5i-ctx2img · 103 tokens

r3f-animation

React Three Fiber animation - useFrame, useAnimations, spring physics, keyframes. Use when animating objects, playing GLTF animations, creating procedural motion, or implementing physics-based movement.

zebbern/claude-code-guide · 43 tokens

r3f-best-practices

React Three Fiber (R3F) and Poimandres ecosystem best practices. Use when writing, reviewing, or optimizing R3F code. Triggers on tasks involving @react-three/fiber, @react-three/drei, zustand, @react-three/postprocessing, @react-three/rapier, or leva.

zebbern/claude-code-guide · 74 tokens

log-error-digest

Analyze log files to troubleshoot errors, identify peak error periods, and produce error clustering, frequency statistics, and time distribution reports. Supports JSON, syslog, and Nginx formats with automatic detection. Use when a user uploads a .log file and asks to analyze errors, find patterns, debug issues, or…

zebbern/claude-code-guide · 71 tokens

vs-search

Search runtime and scene management: verify queries, inspect scenes, debug app readiness, and diagnose recall or scene-config issues.

volcengine/SearchCLI · 27 tokens