PluginBench
Skill
Review
Audit score 70

text-optimizer

kochetkov-ma/claude-brewcode

Reduce prompt and documentation tokens by 20–40% using 41 research-backed optimization rules.

What is text-optimizer?

Text Optimizer applies 41 research-backed rules across 6 categories (Claude behavior, token efficiency, structure, reference integrity, perception, LLM comprehension) to compress prompts, docs, and agent instructions without losing meaning. Use it when optimizing for API cost, response speed, instruction clarity, or reducing hallucinations.

  • Compresses text 20–40% via structured rule application across 6 categories
  • Offers three modes: Light (cleanup only), Medium (balanced restructuring), Deep (aggressive compression)
  • Verifies reference integrity—file paths, URLs, circular references—before and after optimization
  • Generates detailed optimization reports with token/line metrics and rule application details
  • Preserves critical information and domain terminology while eliminating filler and redundancy
  • Applies Claude-specific behavior rules to improve instruction following and reduce overtriggering

How to install text-optimizer

npx skills add https://github.com/kochetkov-ma/claude-brewcode --skill text-optimizer
Prerequisites
  • Access to `references/rules-review.md` file (required before any optimization)
  • Target file(s) in Markdown format (.md)
  • Read/Write/Edit permissions on target files
Claude Code
Cursor
Windsurf
Cline

How to use text-optimizer

  1. 1.Install the skill via: npx skills add https://github.com/kochetkov-ma/claude-brewcode --skill text-optimizer
  2. 2.Ensure `references/rules-review.md` is available in your project (skill will error if missing)
  3. 3.Run `/text-optimize [file.md]` for medium mode (default balanced optimization)
  4. 4.Run `/text-optimize -l [file.md]` for light mode (text cleanup only, no restructuring)
  5. 5.Run `/text-optimize -d [folder/]` for deep mode (aggressive compression on all .md files in directory)
  6. 6.Review the generated optimization report showing token reduction, rules applied, and any issues fixed

Use cases

Good for
  • Optimize system prompts and agent instructions to reduce API costs and latency
  • Compress verbose documentation and knowledge bases while maintaining clarity
  • Restructure multi-section prompts to improve LLM focus and reduce hallucinations
  • Prepare skill definitions and reference materials for token-efficient LLM consumption
  • Audit existing prompts for anti-patterns and apply research-backed improvements
Who it's for
  • Prompt engineers optimizing for cost and performance
  • AI agent developers building efficient instruction sets
  • Technical writers compressing documentation for LLM consumption
  • Teams using Claude API at scale seeking cost reduction
  • Developers building skills and plugins for coding agents

text-optimizer FAQ

What's the difference between Light, Medium, and Deep modes?

Light mode applies only text cleanup rules (C.1-C.6, T.6, R.1-R.3, P.1-P.4) without restructuring. Medium mode applies all 41 rules for balanced optimization. Deep mode applies all rules plus aggressive rephrasing and section merging for maximum compression.

Will optimization lose important information?

No. The quality checklist explicitly requires 'no information loss' across all modes. Critical info and cross-references are identified before optimization and preserved throughout.

How much can I expect to reduce tokens?

Typical reduction is 20–40% depending on input verbosity and mode. The optimization report shows exact before/after metrics for your specific file.

What if my file has broken references?

The skill verifies file paths (R.1), URLs (R.2), and circular references (R.3) before and after optimization. Issues are flagged in the report and must be resolved.

Can I optimize multiple files at once?

Yes. Pass a folder path with `-d` flag to process all .md files in that directory sequentially, or list multiple files separated by commas.

Full instructions (SKILL.md)

Source of truth, from kochetkov-ma/claude-brewcode.


name: text-optimizer description: "Optimizes text, prompts, and documentation for LLM token efficiency. Applies 41 research-backed rules across 6 categories: Claude behavior, token efficiency, structure, reference integrity, perception, and LLM comprehension. Use when optimizing prompts, reducing tokens, compressing verbose docs, or improving LLM instruction quality." license: MIT metadata: author: "kochetkov-ma" version: "2.15.6" source: "claude-brewcode" allowed-tools: Read Write Edit Grep Glob

Plugin: kochetkov-ma/claude-brewcode

Text Optimizer

Reduces token count in prompts, docs, and agent instructions by 20–40% without losing meaning. Applies 41 research-backed rules across 6 categories: Claude behavior, token efficiency, structure, reference integrity, perception, LLM comprehension.

Benefits: cheaper API calls · faster model responses · clearer LLM instructions · fewer hallucinations

Examples:

/text-optimize prompt.md          # single file, medium mode (default)
/text-optimize -d agents/         # deep mode — all .md files in directory

Skill text is written for LLM consumption and optimized for token efficiency.


Text & File Optimizer

Step 0: Load Rules

REQUIRED: Read references/rules-review.md before ANY optimization. If file not found -> ERROR + STOP. Do not proceed without rules reference.

Modes

Parse $ARGUMENTS: -l/--light | -d/--deep | no flag -> medium (default).

ModeFlagScope
Light-l, --lightText cleanup only — structure, lists, flow untouched
Medium(default)Balanced restructuring — all standard transformations
Deep-d, --deepMax density — rephrase, merge, compress aggressively

Rule ID Quick Reference

CategoryRule IDsScope
Claude behaviorC.1-C.6Literal following, avoid "think", positive framing, match style, descriptive instructions, overengineering
Token efficiencyT.1-T.8Tables, bullets, one-liners, inline code, abbreviations, filler, comma lists, arrows
StructureS.1-S.8XML tags, imperative, single source, context/motivation, blockquotes, progressive disclosure, consistent terminology, ref depth
Reference integrityR.1-R.3Verify file paths, check URLs, linearize circular refs
PerceptionP.1-P.6Examples near rules, hierarchy, bold keywords, standard symbols, instruction order, default over options

ID-to-Rule Mapping

IDRuleIDRule
C.1Literal instruction followingC.2Avoid "think" word
C.3Positive framing (do Y not don't X)C.4Match prompt style to output
C.5Descriptive over emphatic instructionsC.6Overengineering prevention
T.1Tables over prose (multi-column)T.2Bullets over numbered (~5-10%)
T.3One-liners for rulesT.4Inline code over blocks
T.5Standard abbreviations (tables only)T.6Remove filler words
T.7Comma-separated inline listsT.8Arrows for flow notation
S.1XML tags for sectionsS.2Imperative form
S.3Single source of truthS.4Add context/motivation
S.5Blockquotes for criticalS.6Progressive disclosure
R.1Verify file pathsR.2Check URLs
R.3Linearize circular refsP.1Examples near rules
P.2Hierarchy via headers (max 3-4)P.3Bold for keywords (max 2-3/100 lines)
P.4Standard symbols (→ + / ✅❌⚠️)
S.7Consistent terminologyS.8One-level reference depth
P.5Instruction order (anchoring)P.6Default over options

Mode-to-Rules Mapping

ModeAppliesNotes
LightC.1-C.6, T.6, R.1-R.3, P.1-P.4Text cleanup only — no restructuring
MediumAll rules (C + T + S + R + P)Balanced transformations
DeepAll rules + aggressive rephrasingMerge sections, max compression

Usage

InputAction
No argsPrompt user for file or folder path
Single pathProcess file directly
path1, path2Process files sequentially
-l file.mdLight mode — text cleanup only
-d file.mdDeep mode — max compression
folder/All .md files in directory

File Processing

Input Parsing

InputAction
No argsPrompt user for file or folder path
Single pathProcess directly
path1, path2Process files sequentially

Execution Flow

  1. Read references/rules-review.md — load all optimization rules
  2. Read target file(s)
  3. Analyze: identify type (prompt, docs, agent, skill), note critical info and cross-references
  4. Apply rules by mode (see Mode-to-Rules Mapping)
  5. Edit file with optimized content
  6. Generate optimization report

Quality Checklist

Before

  • Read entire text
  • Identify type (prompt, docs, agent, skill)
  • Note critical info and cross-references

During — Apply by Mode

CheckLightMedDeep
C.1-C.6 (Claude behavior)YesYesYes
T.6 (filler removal)YesYesYes
T.1-T.5, T.7-T.8 (token compression)-YesYes
S.1-S.8 (structure/clarity)-YesYes
R.1-R.3 (reference integrity)YesYesYes
P.1-P.4 (LLM perception)YesYesYes
Aggressive rephrasing--Yes
No information lossYesYesYes

After

  • All facts preserved
  • Logic consistent
  • References valid (R.1-R.3)
  • Tokens reduced

Output Format

## Optimization Report: [filename]

| Metric | Before | After | Change |
|--------|--------|-------|--------|
| Lines  | X      | Y     | -Z%    |
| Tokens | ~X     | ~Y    | -Z%    |

### Rules Applied
- [Rule IDs]: [Description of changes]

### Issues Found & Fixed
- [Issue]: [Resolution]

### Cross-Reference Verification
- [x] All file refs valid (R.1)
- [x] All URLs checked (R.2)
- [x] No circular refs (R.3)

---

**Full development platform:** [brewcode](https://github.com/kochetkov-ma/claude-brewcode) — infinite focus tasks, 16 agents, quorum reviews, knowledge persistence.
Install: `claude plugin marketplace add https://github.com/kochetkov-ma/claude-brewcode && claude plugin install brewcode@claude-brewcode`

Anti-Patterns

AvoidWhy
Remove all examplesHurts generalization (P.1)
Over-abbreviateReduces readability (T.5 caveat)
Generic compressionDomain terms matter
Over-aggressive languageOpus 4.5 overtriggers (C.5)
Flatten hierarchyLoses structure (P.2)
"Don't do X" framingLess effective than "Do Y" (C.3)
Overengineer promptsOpus 4.5 follows literally (C.6)
Overload single promptsDivided attention, hallucinations (S.3)
Over-focus on wordingStructure > word choice (T.1)

Related skills

More from kochetkov-ma/claude-brewcode and the wider catalog.

MEmemory-optimize logo

memory-optimize

kochetkov-ma/claude-brewcode

Optimize Claude Code memory files in 4 interactive steps, reducing token count by 30-50%.

1.4k installs
FIfinlab logo

finlab

koreal6803/finlab-ai

Quantitative trading package for global stock markets with backtesting, factor analysis, and strategy development.

1.5k installs
40404-page-generator logo

404-page-generator

kostja94/marketing-skills

When the user wants to create, optimize, or audit 404 error pages. Also use when the user mentions "404 page," "404 error," "error page," "page not found," "broken link page," "404 design," "custom 404," "404 redirect," "404 page UX," or "404 recovery." For sitewide page planning, use website-structure.

768 installsAudited
ABabout-page-generator logo

about-page-generator

kostja94/marketing-skills

When the user wants to create, optimize, or audit About page content. Also use when the user mentions "about page," "about us," "company story," "our team," "about section," "company overview," "brand story," "team page," or "who we are." For sitewide page planning, use website-structure.

787 installsAudited
AFaffiliate-marketing logo

affiliate-marketing

kostja94/marketing-skills

When the user wants to plan, implement, or optimize affiliate marketing strategy. Also use when the user mentions "affiliate marketing," "affiliate program strategy," "CPS model," "affiliate recruitment," "commission structure," "affiliate partners," "affiliate network," "affiliate tracking," "affiliate commission," or "partner marketing." For affiliate page, use affiliate-page-generator.

900 installsAudited
AFaffiliate-page-generator logo

affiliate-page-generator

kostja94/marketing-skills

When the user wants to create, optimize, or audit affiliate program page content. Also use when the user mentions "affiliate program," "affiliate page," "partner program," "referral program page," "affiliate landing," "partner landing," "commission page," or "affiliate signup." For affiliate program strategy, use affiliate-marketing.

803 installsAudited