Skill detail

text-optimizer

Optimizes text, prompts, and documentation for LLM token efficiency using 52 research-backed rules across categories like token efficiency, structure, deduplication, and LLM comprehension.

Why we recommend it: Optimizes prompts and docs for LLM token efficiency with research-backed rules — core token optimization.

MatchDirectRecommended for Token Optimization
Sourcekochetkov-ma/​claude-brewcodeExternal source
Reported installs2,132Popularity signal only

Inspect before use

Read the source instructions and check the requirements before you install this skill.

Saved source preview

SKILL.md

The saved excerpt is a snapshot from when this skill was listed. The external source remains the complete and most current version.

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

> Plugin: [kochetkov-ma/claude-brewcode](https://github.com/kochetkov-ma/claude-brewcode)

## Text Optimizer

Reduces token count in prompts, docs, and agent instructions by **20–40%** without losing meaning.
Applies **52 research-backed rules** across 8 categories: Claude behavior, token efficiency, structure, deduplication, reference integrity, perception, LLM comprehension, aggressive lossy (deep only).

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

**Examples:**
```bash
/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.8 | Literal following, avoid "think", positive framing, match style, descriptive instructions, overengineering, avoid ALL-CAPS, prompt format |
| Token efficiency | T.1-T.8, T.10 | Tables, bullets, one-liners, inline code, abbreviations, filler, comma lists, arrows, strip whitespace |
| Structure | S.1-S.8 | XML tags, imperative, single source, context/motivation, blockquotes, progressive disclosure, consistent terminology, ref depth |
| Deduplication | D.1-D.6 | Exact/near/cross-format merge, emphasis cap <=2, cross-file SSOT, wrong-merge guard |
| 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 |
| LLM Comprehension | L.1-L.8 | Critical info position, documents-first, conciseness, quote-first, add WHY, reiterate constraint, prompt repetition, preserve scope qualifiers |
| Aggressive lossy (deep only) | A.1-A.4 | Line fusion, low-value word drop, aggressive paraphrase, common-knowledge elision |

### 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
Read the full source on GitHub (opens external page)
Context

Related work