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).
| Mode |
Flag |
Scope |
| Light |
-l, --light |
Text cleanup only — structure, lists, flow untouched |
| Medium |
(default) |
Balanced restructuring — all standard transformations |
| Deep |
-d, --deep |
Max density — rephrase, merge, compress aggressively |
Rule ID Quick Reference
| Category |
Rule IDs |
Scope |
| Claude behavior |
C.1-C.6 |
Literal following, avoid "think", positive framing, match style, descriptive instructions, overengineering |
| Token efficiency |
T.1-T.8 |
Tables, bullets, one-liners, inline code, abbreviations, filler, comma lists, arrows |
| Structure |
S.1-S.8 |
XML tags, imperative, single source, context/motivation, blockquotes, progressive disclosure, consistent terminology, ref depth |
| Reference integrity |
R.1-R.3 |
Verify file paths, check URLs, linearize circular refs |
| Perception |
P.1-P.6 |
Examples near rules, hierarchy, bold keywords, standard symbols, instruction order, default over options |
ID-to-Rule Mapping
| ID |
Rule |
ID |
Rule |
| C.1 |
Literal instruction following |
C.2 |
Avoid "think" word |
| C.3 |
Positive framing (do Y not don't X) |
C.4 |
Match prompt style to output |
| C.5 |
Descriptive over emphatic instructions |
C.6 |
Overengineering prevention |
| T.1 |
Tables over prose (multi-column) |
T.2 |
Bullets over numbered (~5-10%) |
| T.3 |
One-liners for rules |
T.4 |
Inline code over blocks |
| T.5 |
Standard abbreviations (tables only) |
T.6 |
Remove filler words |
| T.7 |
Comma-separated inline lists |
T.8 |
Arrows for flow notation |
| S.1 |
XML tags for sections |
S.2 |
Imperative form |
| S.3 |
Single source of truth |
S.4 |
Add context/motivation |
| S.5 |
Blockquotes for critical |
S.6 |
Progressive disclosure |
| R.1 |
Verify file paths |
R.2 |
Check URLs |
| R.3 |
Linearize circular refs |
P.1 |
Examples near rules |
| P.2 |
Hierarchy via headers (max 3-4) |
P.3 |
Bold for keywords (max 2-3/100 lines) |
| P.4 |
Standard symbols (→ + / ✅❌⚠️) |
|
|
| S.7 |
Consistent terminology |
S.8 |
One-level reference depth |
| P.5 |
Instruction order (anchoring) |
P.6 |
Default over options |
Mode-to-Rules Mapping
| Mode |
Applies |
Notes |
| Light |
C.1-C.6, T.6, R.1-R.3, P.1-P.4 |
Text cleanup only — no restructuring |
| Medium |
All rules (C + T + S + R + P) |
Balanced transformations |
| Deep |
All rules + aggressive rephrasing |
Merge sections, max compression |
Usage
| Input |
Action |
| No args |
Prompt user for file or folder path |
| Single path |
Process file directly |
path1, path2 |
Process files sequentially |
-l file.md |
Light mode — text cleanup only |
-d file.md |
Deep mode — max compression |
folder/ |
All .md files in directory |
File Processing
Input Parsing
| Input |
Action |
| No args |
Prompt user for file or folder path |
| Single path |
Process directly |
path1, path2 |
Process files sequentially |
Execution Flow
- Read
references/rules-review.md — load all optimization rules
- Read target file(s)
- Analyze: identify type (prompt, docs, agent, skill), note critical info and cross-references
- Apply rules by mode (see Mode-to-Rules Mapping)
- Edit file with optimized content
- Generate optimization report
Quality Checklist
Before
During — Apply by Mode
| Check |
Light |
Med |
Deep |
| C.1-C.6 (Claude behavior) |
Yes |
Yes |
Yes |
| T.6 (filler removal) |
Yes |
Yes |
Yes |
| T.1-T.5, T.7-T.8 (token compression) |
- |
Yes |
Yes |
| S.1-S.8 (structure/clarity) |
- |
Yes |
Yes |
| R.1-R.3 (reference integrity) |
Yes |
Yes |
Yes |
| P.1-P.4 (LLM perception) |
Yes |
Yes |
Yes |
| Aggressive rephrasing |
- |
- |
Yes |
| No information loss |
Yes |
Yes |
Yes |
After
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
| Avoid |
Why |
| Remove all examples |
Hurts generalization (P.1) |
| Over-abbreviate |
Reduces readability (T.5 caveat) |
| Generic compression |
Domain terms matter |
| Over-aggressive language |
Opus 4.5 overtriggers (C.5) |
| Flatten hierarchy |
Loses structure (P.2) |
| "Don't do X" framing |
Less effective than "Do Y" (C.3) |
| Overengineer prompts |
Opus 4.5 follows literally (C.6) |
| Overload single prompts |
Divided attention, hallucinations (S.3) |
| Over-focus on wording |
Structure > word choice (T.1) |
1---2name: text-optimizer3description: 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.4license: MIT5---67> Plugin: [kochetkov-ma/claude-brewcode](https://github.com/kochetkov-ma/claude-brewcode)89## Text Optimizer1011Reduces token count in prompts, docs, and agent instructions by **20–40%** without losing meaning.12Applies **41 research-backed rules** across 6 categories: Claude behavior, token efficiency, structure, reference integrity, perception, LLM comprehension.1314**Benefits:** cheaper API calls · faster model responses · clearer LLM instructions · fewer hallucinations1516**Examples:**17```bash18/text-optimize prompt.md # single file, medium mode (default)19/text-optimize -d agents/ # deep mode — all .md files in directory20```2122> _Skill text is written for LLM consumption and optimized for token efficiency._2324---2526# Text & File Optimizer2728## Step 0: Load Rules2930> **REQUIRED:** Read `references/rules-review.md` before ANY optimization.31> If file not found -> ERROR + STOP. Do not proceed without rules reference.3233## Modes3435Parse `$ARGUMENTS`: `-l`/`--light` | `-d`/`--deep` | no flag -> medium (default).3637| Mode | Flag | Scope |38|------|------|-------|39| Light | `-l`, `--light` | Text cleanup only — structure, lists, flow untouched |40| Medium | _(default)_ | Balanced restructuring — all standard transformations |41| Deep | `-d`, `--deep` | Max density — rephrase, merge, compress aggressively |4243## Rule ID Quick Reference4445| Category | Rule IDs | Scope |46|----------|----------|-------|47| Claude behavior | C.1-C.6 | Literal following, avoid "think", positive framing, match style, descriptive instructions, overengineering |48| Token efficiency | T.1-T.8 | Tables, bullets, one-liners, inline code, abbreviations, filler, comma lists, arrows |49| Structure | S.1-S.8 | XML tags, imperative, single source, context/motivation, blockquotes, progressive disclosure, consistent terminology, ref depth |50| Reference integrity | R.1-R.3 | Verify file paths, check URLs, linearize circular refs |51| Perception | P.1-P.6 | Examples near rules, hierarchy, bold keywords, standard symbols, instruction order, default over options |5253### ID-to-Rule Mapping5455| ID | Rule | ID | Rule |56|----|------|----|------|57| C.1 | Literal instruction following | C.2 | Avoid "think" word |58| C.3 | Positive framing (do Y not don't X) | C.4 | Match prompt style to output |59| C.5 | Descriptive over emphatic instructions | C.6 | Overengineering prevention |60| T.1 | Tables over prose (multi-column) | T.2 | Bullets over numbered (~5-10%) |61| T.3 | One-liners for rules | T.4 | Inline code over blocks |62| T.5 | Standard abbreviations (tables only) | T.6 | Remove filler words |63| T.7 | Comma-separated inline lists | T.8 | Arrows for flow notation |64| S.1 | XML tags for sections | S.2 | Imperative form |65| S.3 | Single source of truth | S.4 | Add context/motivation |66| S.5 | Blockquotes for critical | S.6 | Progressive disclosure |67| R.1 | Verify file paths | R.2 | Check URLs |68| R.3 | Linearize circular refs | P.1 | Examples near rules |69| P.2 | Hierarchy via headers (max 3-4) | P.3 | Bold for keywords (max 2-3/100 lines) |70| P.4 | Standard symbols (→ + / ✅❌⚠️) | | |71| S.7 | Consistent terminology | S.8 | One-level reference depth |72| P.5 | Instruction order (anchoring) | P.6 | Default over options |7374## Mode-to-Rules Mapping7576| Mode | Applies | Notes |77|------|---------|-------|78| Light | C.1-C.6, T.6, R.1-R.3, P.1-P.4 | Text cleanup only — no restructuring |79| Medium | All rules (C + T + S + R + P) | Balanced transformations |80| Deep | All rules + aggressive rephrasing | Merge sections, max compression |8182## Usage8384| Input | Action |85|-------|--------|86| No args | Prompt user for file or folder path |87| Single path | Process file directly |88| `path1, path2` | Process files sequentially |89| `-l file.md` | Light mode — text cleanup only |90| `-d file.md` | Deep mode — max compression |91| `folder/` | All `.md` files in directory |9293## File Processing9495### Input Parsing9697| Input | Action |98|-------|--------|99| No args | Prompt user for file or folder path |100| Single path | Process directly |101| `path1, path2` | Process files sequentially |102103### Execution Flow1041051. Read `references/rules-review.md` — load all optimization rules1062. Read target file(s)1073. Analyze: identify type (prompt, docs, agent, skill), note critical info and cross-references1084. Apply rules by mode (see Mode-to-Rules Mapping)1095. Edit file with optimized content1106. Generate optimization report111112## Quality Checklist113114### Before115- [ ] Read entire text116- [ ] Identify type (prompt, docs, agent, skill)117- [ ] Note critical info and cross-references118119### During — Apply by Mode120121| Check | Light | Med | Deep |122|-------|-------|-----|------|123| C.1-C.6 (Claude behavior) | Yes | Yes | Yes |124| T.6 (filler removal) | Yes | Yes | Yes |125| T.1-T.5, T.7-T.8 (token compression) | - | Yes | Yes |126| S.1-S.8 (structure/clarity) | - | Yes | Yes |127| R.1-R.3 (reference integrity) | Yes | Yes | Yes |128| P.1-P.4 (LLM perception) | Yes | Yes | Yes |129| Aggressive rephrasing | - | - | Yes |130| No information loss | Yes | Yes | Yes |131132### After133- [ ] All facts preserved134- [ ] Logic consistent135- [ ] References valid (R.1-R.3)136- [ ] Tokens reduced137138## Output Format139140```markdown141## Optimization Report: [filename]142143| Metric | Before | After | Change |144|--------|--------|-------|--------|145| Lines | X | Y | -Z% |146| Tokens | ~X | ~Y | -Z% |147148### Rules Applied149- [Rule IDs]: [Description of changes]150151### Issues Found & Fixed152- [Issue]: [Resolution]153154### Cross-Reference Verification155- [x] All file refs valid (R.1)156- [x] All URLs checked (R.2)157- [x] No circular refs (R.3)158159---160161**Full development platform:** [brewcode](https://github.com/kochetkov-ma/claude-brewcode) — infinite focus tasks, 16 agents, quorum reviews, knowledge persistence.162Install: `claude plugin marketplace add https://github.com/kochetkov-ma/claude-brewcode && claude plugin install brewcode@claude-brewcode`163```164165## Anti-Patterns166167| Avoid | Why |168|-------|-----|169| Remove all examples | Hurts generalization (P.1) |170| Over-abbreviate | Reduces readability (T.5 caveat) |171| Generic compression | Domain terms matter |172| Over-aggressive language | Opus 4.5 overtriggers (C.5) |173| Flatten hierarchy | Loses structure (P.2) |174| "Don't do X" framing | Less effective than "Do Y" (C.3) |175| Overengineer prompts | Opus 4.5 follows literally (C.6) |176| Overload single prompts | Divided attention, hallucinations (S.3) |177| Over-focus on wording | Structure > word choice (T.1) |