/meta:context-optimization-report <plugin-or-skills-path> [--top N]from meta
Generate a context window optimization report for all skills in a directory
Ships in meta. Installing the plugin adds it to Claude Code.
Produce a detailed context-window optimization report for every skill under a plugin or skills directory. Identify large files, categorize by size, rank modularization priorities, and recommend concrete fixes.
Part of the meta plugin evaluation suite. Complements /meta:audit-skill
(quality checklist) and /meta:skills-eval (compliance). Focus here is token
footprint and progressive disclosure, not behavioral testing.
Apply this workflow when:
references/ or split into sibling skills/meta:context-optimization-report plugins/meta
/meta:context-optimization-report plugins/git/skills
/meta:context-optimization-report plugins/ruby-rails --top 10
Optional --top N limits the Largest files and Priority queue sections to
the top N offenders (default: show all files over the moderate threshold).
When invoked:
Resolve scope — Parse $ARGUMENTS (strip --top N flags first):
.claude-plugin/plugin.json) → all skills/*//skills → each immediate subdirectory with SKILL.md**/SKILL.md skill rootsplugins/meta or ask the userApply standards — Load modular-skill-framework (especially
references/token-efficiency.md) and the skill quality checklist sizing targets:
SKILL.md body: under 500 lines; ~1,500 words for core workflowdescription frontmatter: focused triggers, not an encyclopediaDiscover skills — Glob skills/*/SKILL.md for plugin scope, or
immediate subdirectories with SKILL.md for a flat skills folder.
Measure each skill — For every skill directory, collect metrics with
Bash (wc -l, wc -c) on:
SKILL.mdreferences/, scripts/, assets/ (if present)Optionally estimate words: wc -w on SKILL.md when flagging verbosity.
Categorize files by size (lines)
| Tier | Lines | Label |
|---|---|---|
| S | 1–80 | compact |
| M | 81–150 | moderate |
| L | 151–300 | large |
| XL | 301–500 | very-large |
| XXL | >500 | oversized |
SKILL.md severity overrides:
| Lines | Status |
|---|---|
| ≤150 | OK for trigger load |
| 151–300 | warning — lean body or move detail to references |
| 301–500 | warning — likely hurts trigger context |
| >500 | critical — violates the skill sizing target |
Portfolio analysis — Compute aggregates:
SKILL.md and XL+ reference filesreferences/ but SKILL.md over 150 linesSKILL.md (healthy split vs bloat)description length outliers (grep frontmatter between --- blocks; flag >80 words)Cross-skill signals — Light Grep pass when feasible:
SKILL.md files in scopereferences/ (possible duplication)Recommendations — Per finding, map to an action from modular-skill-framework:
| Signal | Recommendation |
|---|---|
Oversized SKILL.md | Move checklists/schemas/examples to references/; link with when-to-load |
| Very-large reference | Split reference by concern or split skill if triggers differ |
| No references, large body | Introduce references/; keep procedural core in SKILL.md |
Bloated description | Narrow triggers; split sibling skill if tasks differ |
| High total footprint, single skill | Consider modular-skill-framework split heuristics |
| Duplicate reference names | Consolidate canonical doc; link from other skills |
Pre-publish gate — End with Release readiness:
SKILL.md issues; ≤1 very-large file per skill on averageSKILL.mdSKILL.md >500 lines or >2 critical footprint issuesReport — Use the output format below. Do not modify files unless the user explicitly asks to apply fixes.
# Context Optimization Report: <scope>
**Skills analyzed:** N
**Total measured lines:** N
**Release readiness:** READY | REVIEW | BLOCKED
## Executive Summary
<one paragraph: portfolio health, top risk, recommended first action>
## Portfolio Overview
| Metric | Value |
| --- | --- |
| Skills | N |
| Files measured | N |
| Total lines | N |
| Oversized SKILL.md (>500) | N |
| Skills with no references/ | N |
| Largest skill (by total lines) | name (N lines) |
## Skills by Total Footprint
| Rank | Skill | SKILL.md | References | Scripts | Assets | Total | Status |
| --- | --- | --- | --- | --- | --- | --- | --- |
Status: OK | REVIEW | CRITICAL (based on SKILL.md tier and total size)
## Size Distribution
| Tier | Files | % of files |
| --- | --- | --- |
| compact (1–80) | N | N% |
| moderate (81–150) | N | N% |
| large (151–300) | N | N% |
| very-large (301–500) | N | N% |
| oversized (>500) | N | N% |
## Largest Files
| File | Lines | Tier | Skill |
| --- | --- | --- | --- |
<respect --top N if set>
## Per-Skill Detail
### <skill-name>
**Trigger load (SKILL.md):** N lines — OK | warning | critical
**Worst-case load (all bundled text):** N lines
**References:** N files, N lines
| File | Lines | Tier |
| --- | --- | --- |
**Issues**
- ...
**Recommendations**
- ...
## Modularization Priority Queue
| Priority | Skill | Action | Impact |
| --- | --- | --- | --- |
| P0 | ... | ... | high |
| P1 | ... | ... | medium |
| P2 | ... | ... | low |
<respect --top N if set; always include all P0>
## Cross-Skill Observations
- duplication, missing reference dirs, description bloat
## Suggested Follow-ups
- `/meta:audit-skill <path>` for checklist compliance on critical skills
- `/meta:skills-eval <plugin>` for quality + overlap
- **skill-auditor** agent for scored token-efficiency dimension
| Command | Focus |
|---|---|
/meta:context-optimization-report | Token footprint, size tiers, modularization plan |
/meta:audit-skill | Single-skill quality checklist |
/meta:skills-eval | Batch quality and optional behavioral probes |
/meta:validate-plugin | Plugin layout and README inventory |
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub meaganewaller/marketplace --plugin meta9 commands in this plugin
/audit-skillAudit SkillAudit a Claude Code skill for structure, triggers, and quality best practices/create-commandCreate CommandScaffold a new slash command in a Claude Code plugin using meta conventions/hooks-evalHooks EvalEvaluate plugin hooks statically and run companion test scripts when present