optimize

optimize is a command for Claude Code from Dragoon0x/canon. It costs 22 tokens per session (523 once invoked), scanned A, original, MIT.

A performance-review command for websites and web applications. It measures loading, responsiveness, layout movement, code size, images, fonts, and third-party scripts against stated limits.

In plain words
What is it for?
Use it to review Core Web Vitals—standard measures of loading speed, interaction delay, and visual stability—then find opportunities to reduce JavaScript, CSS, image, font, and script costs.
Why use it?
It replaces guesses about slowness with measurements and points to common sources of slow loads, delayed interactions, and shifting page layouts.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

Good fit Use it to review Core Web Vitals—standard measures of loading speed, interaction delay, and visual stability—then find opportunities to reduce JavaScript, CSS, image, font, and script costs.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/dragoon0x/canon/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/Dragoon0x/canon

Made for: Claude Code.

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/dragoon0x/canon/optimize/github.svg)](https://agentmods.dev/commands/dragoon0x/canon/optimize)
Your own site
<a href="https://agentmods.dev/commands/dragoon0x/canon/optimize"><img src="https://agentmods.dev/badge/commands/dragoon0x/canon/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/dragoon0x/canon/optimize"><img src="https://agentmods.dev/badge/commands/dragoon0x/canon/optimize.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 22 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 523 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.00022 $0.00523
Opus 5.5 $0.00009 $0.00209
Sonnet 5.5 $0.00004 $0.00105
Haiku 4.5 $0.00002 $0.00052

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

source/commands/optimize.md · 45 lines

What it actually says

/optimize

Measure, then cut. Not vibes-based "it feels slow" — concrete targets from canon-performance.

Targets (Core Web Vitals, "Good" thresholds)

  • LCP: ≤ 2.5s
  • INP: ≤ 200ms
  • CLS: ≤ 0.1
  • TTFB: ≤ 800ms

Budgets

  • Initial JS (parsed+compiled): ≤ 200KB gzipped for most apps, ≤ 350KB for complex.
  • CSS: ≤ 60KB gzipped.
  • Hero/LCP image: ≤ 200KB, served at correct dimensions, fetchpriority="high", no lazy.
  • Total page weight (first load): ≤ 1.5MB.

Checklist

  1. LCP image: identified, preloaded, fetchpriority="high", not loading="lazy", served at rendered size.
  2. Fonts: font-display: swap, 1–2 families max, subset if possible, preload the critical weight.
  3. CLS: width and height attributes on every <img>, reserved space for ads and embeds, no layout-shifting web fonts without proper fallbacks.
  4. JS: code-split by route, lazy-load below-the-fold interactive components, tree-shake dead imports, replace heavy libs (moment → date-fns, lodash-full → per-function).
  5. Third parties: audit. Every third-party script pays rent or leaves.
  6. Images: modern formats (AVIF with WebP fallback), srcset for responsive, no raw PNG/JPG where a vector works.
  7. Caching: long cache for hashed assets, short/no cache for HTML, service worker only if you own the consequences.
  8. INP: keep long tasks ≤ 50ms, debounce input handlers, defer non-critical work with requestIdleCallback or scheduler.postTask.

Output

  • Current vs target table for each metric.
  • Top 5 interventions ranked by impact.
  • Before/after bundle report if applicable.
  • Specific code changes, not "consider optimizing".

Success criteria

Hits all four CWV "Good" thresholds on a median mobile device over 4G. Bundle under budget. No single task over 50ms on the critical path.

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 · 45 lines · 22 tokens per session scan A 4b229f2830a5

Subscribe to this mod's changes

optimize is a command published in the GitHub repository Dragoon0x/canon (6 stars, last pushed 6mo ago), licensed MIT. It adds 22 tokens to every session and 523 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.