optimize

optimize is a skill for Claude Code from v0idOS/performance-deity. It costs 34 tokens per session (492 once invoked), scanned A, original, MIT.

A procedure for measuring and improving a function’s execution time. It records a warmed-up baseline, examines the algorithm and memory use, applies a change, and compares the results.

In plain words
What is it for?
Use it to investigate slow functions, compare alternative algorithms or data structures, and document average and high-percentile execution times.
Why use it?
It prevents claiming an optimization is faster without measurements. It also makes the source of the slowdown and the before-and-after timing clear.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the performance-deity plugin — 17 skills shipped together

Good fit Use it to investigate slow functions, compare alternative algorithms or data structures, and document average and high-percentile execution times.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/v0idos/performance-deity/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 v0idOS/performance-deity --skill optimize
Clone the repo
git clone --depth 1 https://github.com/v0idOS/performance-deity

Made for: Claude Code.

Or install performance-deity, the plugin that ships this one along with the rest of its 17 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/v0idos/performance-deity/optimize/github.svg)](https://agentmods.dev/skills/v0idos/performance-deity/optimize)
Your own site
<a href="https://agentmods.dev/skills/v0idos/performance-deity/optimize"><img src="https://agentmods.dev/badge/skills/v0idos/performance-deity/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/v0idos/performance-deity/optimize"><img src="https://agentmods.dev/badge/skills/v0idos/performance-deity/optimize.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 492 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.00034 $0.00492
Opus 5.5 $0.00014 $0.00197
Sonnet 5.5 $0.00007 $0.00098
Haiku 4.5 $0.00003 $0.00049

Measured 1mo ago against content hash 770ca1afa7c0, 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 1mo 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.

skills/optimize/SKILL.md · 50 lines

What it actually says

Execute all four phases in order. Do not skip any phase.

Phase 1 — Establish Baseline

  1. Identify the exact code to optimize.
  2. Run a micro-benchmark:
    • Write a temporary micro-benchmark script in the user's workspace.
    • The script MUST contain a warm-up phase (discard ≥10 iterations).
    • The script MUST run ≥100 iterations and output the Average and P95 execution time.
    • Run the script using the terminal.
    • Delete the temporary script after recording the results.
    • Note: If the script fails due to missing imports or dependencies, skip it and use the bash time command as a fallback.
  3. Record P95 and Average. Do not proceed until the benchmark runs without error.
  4. Report baseline numbers before writing any new code.

Phase 2 — Algorithmic Analysis

  1. State the current Time Complexity (Big-O) explicitly.
  2. State the current Space Complexity and identify the primary allocation sites.
  3. Name the bottleneck precisely:
    • "Nested loops causing O(n²) scaling"
    • "Repeated string concatenation causing N heap allocations per call"
    • "Full table scan caused by missing index on user_id"

Phase 3 — Refactoring

  1. Rewrite using a more efficient algorithm or data structure (apply in priority order):
    • Replace Array/List lookups with Hash Sets/Dictionaries: O(N) → O(1)
    • Vectorization or batching instead of per-item iteration
    • Caching/memoization of expensive pure computations
    • Zero-allocation patterns and buffer reuse to reduce GC pressure
    • Bitwise operations where mathematically equivalent
  2. Run the benchmark on the new code.
  3. If the new code is not measurably faster: discard it, select a different approach, repeat.

Phase 4 — Report

Present a Performance Report table:

Metric Baseline Optimized Δ
Average Xms Yms -Z%
P95 Xms Yms -Z%

Follow with a one-paragraph explanation grounded in CPU/memory theory.

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. 1mo ago First seen · 50 lines · 34 tokens per session scan A 770ca1afa7c0

Subscribe to this mod's changes

optimize is a skill published in the GitHub repository v0idOS/performance-deity (2 stars, last pushed 5mo ago), licensed MIT. It adds 34 tokens to every session and 492 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-08-31.

Related

Other skills, from other repositories

audit

Project health audit and health check — architecture, performance, tests, dependencies, code quality. Use when assessing overall project health, before releases, or after refactors.

oliver-kriska/claude-elixir-phoenix · 35 tokens

shiny-py-optimize

Diagnose and fix performance problems in Shiny for Python apps — slow startup, sluggish interactions, blocking operations, and apps that struggle beyond a handful of concurrent users. Use when a Shiny for Python app is slow, hangs, recomputes too much, times out, or must support more users; when the user asks to…

posit-dev/skills · 105 tokens

shiny-r-optimize

Diagnose and fix performance problems in Shiny for R apps — slow startup, sluggish interactions, long-running blocking operations, and apps that struggle beyond a handful of concurrent users. Use when a Shiny app is slow, hangs, recomputes too much, times out, or needs to support more users; when the user asks to…

posit-dev/skills · 105 tokens

investigate

Find the root cause of Elixir/Phoenix bugs — crashes, exceptions, stack traces, compile errors, LiveView that won't update, silent failures. Use when something is broken or misbehaves. --parallel for 4 tracks.

oliver-kriska/claude-elixir-phoenix · 51 tokens

narrow-bare-rescue

Narrow bare rescue in Elixir so real errors like KeyError and typos propagate instead of being swallowed. Use to audit rescues and refactor error handling.

oliver-kriska/claude-elixir-phoenix · 40 tokens

tidewave-integration

Tidewave MCP runtime tools — debugging, smoke testing, live state inspection, SQL queries, hex docs. Use when evaluating code in a running Phoenix app.

oliver-kriska/claude-elixir-phoenix · 38 tokens