optimize

optimize is a command for Claude Code from FlorianBruniaux/claude-code-plugins. It costs 15 tokens per session (1,445 once invoked), scanned A, original, MIT.

A performance-analysis procedure that looks for ways to make code, database queries, or larger systems use less time, memory, or downloaded data.

In plain words
What is it for?
Use it to examine a function, module, database query, frontend bundle, or system architecture and receive suggested performance improvements.
Why use it?
It helps locate slow operations, inefficient queries, oversized frontend bundles, risky algorithms, and possible memory leaks before changing them.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the code-quality plugin — 7 skills, 8 commands, 6 agents shipped together

Good fit Use it to examine a function, module, database query, frontend bundle, or system architecture and receive suggested performance improvements.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/florianbruniaux/claude-code-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.

Clone the repo
git clone --depth 1 https://github.com/FlorianBruniaux/claude-code-plugins

Made for: Claude Code.

Or install code-quality, the plugin that ships this one along with the rest of its 7 skills, 8 commands, 6 agents.

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/commands/florianbruniaux/claude-code-plugins/optimize/github.svg)](https://agentmods.dev/commands/florianbruniaux/claude-code-plugins/optimize)
Your own site
<a href="https://agentmods.dev/commands/florianbruniaux/claude-code-plugins/optimize"><img src="https://agentmods.dev/badge/commands/florianbruniaux/claude-code-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/commands/florianbruniaux/claude-code-plugins/optimize"><img src="https://agentmods.dev/badge/commands/florianbruniaux/claude-code-plugins/optimize.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,445 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00015 $0.01445
Opus 5.5 $0.00006 $0.00578
Sonnet 5.5 $0.00003 $0.00289
Haiku 4.5 $0.00002 $0.00145

Measured 1mo ago against content hash 784e2bedc265, 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 1 finding 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.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

grep -rn "readFileSync\|writeFileSync\|execSync" --include="*.{ts,js}" . | head -10
plugins/code-quality/commands/optimize.md · 224 lines

How it starts

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

Performance Optimizer

Analyze and suggest performance improvements for code, queries, or systems.

Purpose

Identify optimization opportunities:

  • Runtime performance bottlenecks
  • Memory usage issues
  • Database query inefficiencies
  • Bundle size problems
  • Algorithm complexity

Instructions

Step 1: Scope Identification

Determine optimization target:

  • Function: Single function performance
  • Module: Related functions/classes
  • Query: Database query optimization
  • Bundle: Frontend bundle analysis
  • System: Architecture-level optimization

Step 2: Performance Analysis

Runtime Analysis
# Find potentially slow patterns
grep -rn "forEach\|\.map\|\.filter\|\.reduce" --include="*.{ts,js}" . | head -20

# Find nested loops (O(n²) potential)
grep -rn "for.*for\|\.forEach.*\.forEach\|\.map.*\.map" --include="*.{ts,js}" . | head -10

# Find sync operations that could be async
grep -rn "readFileSync\|writeFileSync\|execSync" --include="*.{ts,js}" . | head -10
Memory Analysis
# Large array operations
grep -rn "new Array\|Array\.from\|\.concat\|spread" --include="*.{ts,js}" . | head -10

# Potential memory leaks (event listeners, intervals)
grep -rn "addEventListener\|setInterval\|setTimeout" --include="*.{ts,js}" . | head -10
Database Query Analysis
# N+1 query patterns
grep -rn "await.*find\|await.*query" --include="*.{ts,js}" . | head -15

# Missing indexes hints
grep -rn "WHERE\|ORDER BY\|GROUP BY" --include="*.{ts,js,sql}" . | head -15
Bundle Analysis
# Check bundle size (if applicable)
[ -f "package.json" ] && npm run build 2>/dev/null && ls -lh dist/*.js 2>/dev/null

# Large dependencies
[ -f "package.json" ] && cat package.json | jq '.dependencies | keys[]' | head -20

Step 3: Prioritization

Rank findings by:

  1. Impact: How much will this improve performance?
  2. Effort: How hard is the fix?
  3. Risk: What could break?

Output Format


Read the full file on GitHub · 224 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. 1mo ago First seen · 224 lines · 15 tokens per session scan A 784e2bedc265

Subscribe to this mod's changes

optimize is a command published in the GitHub repository FlorianBruniaux/claude-code-plugins (42 stars, last pushed 1mo ago), licensed MIT. It adds 15 tokens to every session and 1,445 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.