MCPInstall

text-optimizer

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.

Installs
2.1K
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/kochetkov-ma/claude-brewcode --skill text-optimizer
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads text-optimizer automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Plugin: 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:

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

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
C.7Avoid ALL-CAPS emphasis (4.x)C.8Prompt format → output format
T.10Strip whitespace from code
L.1Critical info at START or ENDL.2Documents first, query last
L.3Explicitly request concisenessL.4Quote-first grounding
L.5Add WHY to instructionsL.6Reiterate constraint at END
L.7Prompt repetition (non-reasoning)L.8Preserve scope qualifiers
D.1Exact-duplicate mergeD.2Near-duplicate merge (keep specific)
D.3Cross-format duplicateD.4Emphasis cap (<=2/doc, echo @ END)
D.5Cross-file dedup (SSOT + pointer)D.6Wrong-merge guard
A.1Line fusion (loss-free merge)A.2Low-value word drop (gate-neutral)
A.3Aggressive paraphrase (preserved)A.4Common-knowledge elision (ledger)

Mode-to-Rules Mapping

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

Loss Budget per Mode

Content essence is untouchable at light/medium; small deliberate loss only at deep — explicitly reported. Dedup-merged facts count as preserved, never as loss.

ModeSemantic match targetAllowed loss
Light100%None — wording cleanup only
Medium100%None — self-check fact inventory, zero loss
Deep>= 95%Low-value connective detail; self-verify round required, warn with loss list if < 95%

Deduplication Pass (All Modes)

Runs during analysis, BEFORE compression:

  1. Build fact inventory: one atomic fact per line, numbered
  2. Flag facts appearing 2+ times (exact, reworded, or cross-format)
  3. Classify each repeat: intentional emphasis (marked critical/blockquote, or start+end sandwich) vs accidental
  4. Accidental -> merge to single MOST SPECIFIC statement (D.1-D.3), best position wins
  5. Intentional -> cap at 2: full form early + <=1-line echo at END (D.4)
  6. Wrong-merge guard (D.6): differing scope/numbers/conditions = NOT duplicates — keep both

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 3a. Dedup pass (D.1-D.6): fact inventory -> merge accidental dups -> cap intentional emphasis at 2/doc 3b. Deep only: aggressive lossy pass (A.1 fusion -> A.3 paraphrase -> A.2 word drop -> A.4 elision); A.2/A.4 drops -> loss ledger; A.4 counts as elided-known against the >=95% gate, A.2 is gate-neutral
  4. Apply rules by mode (see Mode-to-Rules Mapping)
  5. Edit file with optimized content 5a. Medium: self-check — re-check fact inventory against output, zero loss required 5b. Deep mode: self-verify — fact inventory original vs compressed, (kept + merged)/total >= 95%; merged = preserved; warn with loss list if below
  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.8 (Claude behavior)YesYesYes
T.6 (filler removal)YesYesYes
T.1-T.5, T.7-T.8 (token compression)-YesYes
T.10 (strip code whitespace)-YesYes
S.1-S.8 (structure/clarity)-YesYes
D.1 (exact dedup)YesYesYes
D.2-D.4, D.6 (smart dedup + emphasis cap)-YesYes
D.5 (cross-file dedup, folder runs)YesYesYes
R.1-R.3 (reference integrity)YesYesYes
P.1-P.4 (LLM perception)YesYesYes
P.5-P.6 (anchoring, default-over-options)-YesYes
L.1-L.8 (LLM comprehension)YesYesYes
A.1-A.4 (aggressive lossy)--Yes
Loss within mode budget100%100%>=95%

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)
Merge similar-looking facts blindlyDifferent scope/numbers/conditions = different facts (D.6)

FAQ

What does the text-optimizer skill do?

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.

How do I install text-optimizer?

Run npx skills add https://github.com/kochetkov-ma/claude-brewcode --skill text-optimizer in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/text-optimizer/ (personal) or .claude/skills/text-optimizer/ (project).

Which AI agents can use text-optimizer?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is text-optimizer safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains text-optimizer?

It is published by kochetkov-ma in kochetkov-ma/claude-brewcode. It has 2,137 recorded installs.

More from kochetkov-ma/claude-brewcode

View all →

memory-optimize

kochetkov-ma/claude-brewcode

Optimizes Claude Code memory files in 4 interactive steps: removes duplicates, migrates rules to CLAUDE.md/rules files, compresses remaining entries, validates with cleanup. Typical reduction: 30-50% on token count.

1.5K installs

brewpage-publish

kochetkov-ma/claude-brewcode

Publish content to brewpage.app — text, markdown, JSON, file, or multi-file site. Asks namespace and password, returns public URL. Triggers: publish, share link, upload to brewpage, host page, brewpage, publish site, upload site, upload directory, deploy site, сделай публичную ссылку, опубликуй.

DevOps & Cloud597 installs

Popular ai & agents skills

View category →

google-agents-cli-publish

google/agents-cli

This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).

AI & Agents513.9K installs

google-agents-cli-eval

google/agents-cli

This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).

AI & Agents513.5K installs

skill-creator

anthropics/skills

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

OfficialAI & Agents416.4K installs

codex-pet

prime-skills/runcomfy-agent-skills

Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.

AI & Agents402.1K installs

full-output-enforcement

leonxlnx/taste-skill

Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.

AI & Agents401K installs

executing-plans

obra/superpowers

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

AI & Agents245.7K installs