optimize

optimize is a skill for Claude Code from wenhaochai/claude-plugins. It costs 35 tokens per session (1,688 once invoked), scanned A, original, MIT.

An automated workflow for improving the performance of a PyTorch job defined in a contract. It repeatedly profiles the job, edits code, checks correctness, and returns one optimized branch.

In plain words
What is it for?
Use it to establish a baseline, try changes, compare speed, memory, and correctness, and finish with a clean branch containing the accepted optimization.
Why use it?
It turns performance tuning into a measured loop rather than relying on guesses or accepting a speed change that breaks the result.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: mentions Claude Code; mentions Codex.

Part of the who-ate-my-flops plugin — 9 skills shipped together

Good fit Use it to establish a baseline, try changes, compare speed, memory, and correctness, and finish with a clean branch containing the accepted optimization.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/wenhaochai/claude-plugins/optimize
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.

Any agent
npx skills add wenhaochai/claude-plugins --skill optimize
Clone the repo
git clone --depth 1 https://github.com/wenhaochai/claude-plugins

Made for: Claude Code.

Or install who-ate-my-flops, the plugin that ships this one along with the rest of its 9 skills.

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 optimize

README.md
[![agentmods](https://agentmods.dev/badge/skills/wenhaochai/claude-plugins/optimize/github.svg)](https://agentmods.dev/skills/wenhaochai/claude-plugins/optimize)
Your own site
<a href="https://agentmods.dev/skills/wenhaochai/claude-plugins/optimize"><img src="https://agentmods.dev/badge/skills/wenhaochai/claude-plugins/optimize/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for optimize

Your own site · 80×15
<a href="https://agentmods.dev/skills/wenhaochai/claude-plugins/optimize"><img src="https://agentmods.dev/badge/skills/wenhaochai/claude-plugins/optimize.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,688 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00035 $0.01688
Opus 5.5 $0.00014 $0.00675
Sonnet 5.5 $0.00007 $0.00338
Haiku 4.5 $0.00003 $0.00169

Measured 17d ago against content hash 9ffd4b6c13be, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

optimize 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 17d 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.

who-ate-my-flops/skills/optimize/SKILL.md · 146 lines

How it starts

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

optimize is a sequence of steps. Work through them one at a time and mark each one done as you go.

Step 1: setup

Use the setup-baseline skill. It builds the worktree and the workspace, has extract-computation-graph write records/computation_graph.json and records/execution_schedule.json, then measures the base commit for speed, memory and correctness, profiles it in full with torch-profile, and records it with workspace.py add --verdict base. diagnose begins the same way, which is why that work lives in one skill and not in this one.

Setup can fail in a way worth handing back, and setup-baseline says so when it does. Stop there rather than arming a campaign on a baseline that did not hold.

Step 2: arm the loop

Arm once setup has passed, and from there the campaign runs until finish says it is over.

python <plugin root>/tools/workspace.py arm <ws>

That records which session owns the campaign, read from CODEX_THREAD_ID or CLAUDE_CODE_SESSION_ID. What keeps the loop turning depends on the client you are in:

  • Claude Code. Call the CronCreate tool with cron */2 * * * * and this prompt, with the plugin root and <ws> filled in as absolute paths:

    Campaign watchdog. Run `python <plugin root>/tools/workspace.py finish <ws>`.
    If it exits non-zero, pick the optimization loop up where it stopped and
    keep going. If it passes, delete this job with CronDelete and stop.
    

    The job fires whenever the session is idle, so a turn that ends before the campaign is finished is picked up again within a couple of minutes. It lives in this session only, on no disk, invisible to every other session, and it expires after seven days.

  • Codex. Continue the optimization loop in the current turn. Before stopping, run python <plugin root>/tools/workspace.py finish <ws>. If it reports outstanding work, address it and continue; do not stop merely to summarize progress. Stop when it passes, the user asks you to stop, or a blocker requires user input or an unavailable external resource. In that case, report what is blocked and what is needed to resume. No Stop hook is installed.

Read the full file on GitHub · 146 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. 17d ago First seen · 146 lines · 35 tokens per session scan A 9ffd4b6c13be

Subscribe to this mod's changes

optimize is a skill published in the GitHub repository wenhaochai/claude-plugins (17 stars, last pushed 2d ago), licensed MIT. It adds 35 tokens to every session and 1,688 once invoked, about $0.0001 per session on Opus 5.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-10-01.

Related

Other skills, from other repositories

trace

Evidence-driven tracing lane that orchestrates competing tracer hypotheses in Claude built-in team mode.

Yeachan-Heo/oh-my-claudecode · 18 tokens

smiles-validation

Strict SMILES validation, structural comparison, and modification verification. Catches invalid LLM-generated molecules.

synthetic-sciences/openscience · 24 tokens

nonlinear-solvers

Select and configure nonlinear solvers for f(x)=0 or min F(x). Use for Newton methods, quasi-Newton (BFGS, L-BFGS), Broyden, Anderson acceleration, diagnosing convergence issues, choosing line search vs trust region, and analyzing Jacobian quality.

beita6969/ScienceClaw · 63 tokens

linear-solvers

Select and configure linear solvers for systems Ax=b in dense and sparse problems. Use when choosing direct vs iterative methods, diagnosing convergence issues, estimating conditioning, selecting preconditioners, or debugging stagnation in GMRES/CG/BiCGSTAB.

beita6969/ScienceClaw · 55 tokens

numerical-stability

Analyze and enforce numerical stability for time-dependent PDE simulations. Use when selecting time steps, choosing explicit/implicit schemes, diagnosing numerical blow-up, checking CFL/Fourier criteria, von Neumann analysis, matrix conditioning, or detecting stiffness in advection/diffusion/reaction problems.

beita6969/ScienceClaw · 61 tokens

social-physics-filter

Unified boundary enforcement, interpersonal diagnostic, and relational audit engine. Absorbs 40 psychology + 2 social protocols and all relationship case studies.

winstonkoh87/Athena-Public · 34 tokens