canon-bundle-size

canon-bundle-size is a skill for Claude Code, Codex from Dragoon0x/canon. It costs 64 tokens per session (770 once invoked), scanned A, original, MIT.

A guide for measuring and reducing the JavaScript and CSS files sent to a browser, including the code needed only for the current page.

In plain words
What is it for?
Use it to set size budgets, remove unused code, choose lighter libraries, split code by route, load below-the-fold features later, and compress assets.
Why use it?
Smaller files download, parse, and run faster, while large CSS files can delay what users see.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to set size budgets, remove unused code, choose lighter libraries, split code by route, load below-the-fold features later, and compress assets.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dragoon0x/canon/canon-bundle-size
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 Dragoon0x/canon --skill canon-bundle-size
Clone the repo
git clone --depth 1 https://github.com/Dragoon0x/canon

Made for: Claude Code, Codex.

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 canon-bundle-size

README.md
[![agentmods](https://agentmods.dev/badge/skills/dragoon0x/canon/canon-bundle-size/github.svg)](https://agentmods.dev/skills/dragoon0x/canon/canon-bundle-size)
Your own site
<a href="https://agentmods.dev/skills/dragoon0x/canon/canon-bundle-size"><img src="https://agentmods.dev/badge/skills/dragoon0x/canon/canon-bundle-size/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 canon-bundle-size

Your own site · 80×15
<a href="https://agentmods.dev/skills/dragoon0x/canon/canon-bundle-size"><img src="https://agentmods.dev/badge/skills/dragoon0x/canon/canon-bundle-size.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 770 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.00064 $0.00770
Opus 5.5 $0.00026 $0.00308
Sonnet 5.5 $0.00013 $0.00154
Haiku 4.5 $0.00006 $0.00077

Measured 2mo ago against content hash a639e412e829, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

canon-bundle-size 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 2mo 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/skills/canon-bundle-size/SKILL.md · 82 lines

How it starts

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

CANON · Bundle Size

Every kilobyte of JavaScript costs twice: once to download, once to parse and execute. CSS blocks render. Both have budgets.

Budgets

Asset Budget (gzipped)
Initial JS (critical path) ≤ 200KB
Total JS (all routes) ≤ 500KB
CSS (total) ≤ 60KB
Total page weight (first load) ≤ 1.5MB

These are starting points. Rich apps (maps, editors) may exceed them with justification. Simple marketing pages should come in far under.

Strategies (ordered by impact)

  1. Don't ship what you don't use. Audit imports. Remove dead code. Tree shake.
  2. Replace heavy libraries with lighter alternatives. moment → date-fns. lodash → per-function imports or native. chart.js → uPlot.
  3. Code-split by route. React.lazy() + Suspense, or dynamic import(). Every route loads only its code.
  4. Lazy-load below-the-fold components. Image galleries, comments, maps — load when the user scrolls near.
  5. Externalize large deps. CDN-hosted React/Vue/Angular with proper cache headers.
  6. Compress. Brotli > gzip. 15–20% smaller.

Measuring

# Webpack
npx webpack --profile --json > stats.json
npx webpack-bundle-analyzer stats.json

# Vite
npx vite build --report

# Per-package
npx bundlephobia <package-name>

Track sizes in CI. Alert on regressions.

Common heavy dependencies

Package Size (minified) Alternative
moment 300KB date-fns (tree-shakeable), dayjs (2KB)
lodash (full) 70KB lodash-es (per-function), native
chart.js 200KB uPlot (35KB), lightweight D3
Ant Design (full) 1MB+ Cherry-pick components
Three.js 600KB Only if you need 3D

Anti-patterns

Anti-pattern Why it fails
Importing full lodash for one function 70KB for _.debounce
No code splitting (single bundle) Every route pays for every other route
Polyfilling for IE11 in 2026 Dead weight for 99.9% of users
Source maps in production bundle Inflates download (serve separately)
No tree shaking (CommonJS imports) Dead code shipped

Read the full file on GitHub · 82 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. 2mo ago First seen · 82 lines · 64 tokens per session scan A a639e412e829

Subscribe to this mod's changes

canon-bundle-size is a skill published in the GitHub repository Dragoon0x/canon (6 stars, last pushed 6mo ago), licensed MIT. It adds 64 tokens to every session and 770 once invoked, about $0.0003 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

canon-bundle-size compared with skills from other repositories

canon-bundle-size next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
canon-bundle-sizeDragoon0x/canonSkill66mo agoMITA64Claude Code, Codex
accessibilityericrisco/rsc-harnessSkill5032d agoMITA86Claude Code, Codex
accessibility-auditNickCrew/Claude-CortexSkill664mo agoMITA31Claude Code, Codex
swiftui-layout-componentsdpearson2699/swift-ios-skillsSkill1.3k3mo agononeA101Claude Code
color-contrast-auditorcuriositech/windags-skillsSkill186d agononeA117Claude Code
accessibilitydiegosouzapw/awesome-omni-skillsSkill1704mo agoMITC119Claude Code, Codex
lagannOldiiik/Design-LagannSkill218d agononeA0Claude Code, Codex