Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
kochetkov-ma avatar

Brewtools:Text Optimize

  • 7 installs
  • 29 repo stars
  • Updated August 2, 2026
  • kochetkov-ma/claude-brewcode

Helps with ai & agent building tasks.

About

brewtools:text-optimize is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.

  • brewtools:text-optimize
  • AI & Agent Building
  • AI-coding skill

Brewtools:Text Optimize by the numbers

  • 7 all-time installs (skills.sh)
  • +1 installs in the week ending Aug 2, 2026 (Skillselion tracking)
  • Ranked #12,545 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 3, 2026 (Skillselion catalog sync)
npx skills add https://github.com/kochetkov-ma/claude-brewcode --skill brewtoolstext-optimize

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs7
repo stars29
Last updatedAugust 2, 2026
Repositorykochetkov-ma/claude-brewcode

What it does

Helps with ai & agent building tasks.

Files

SKILL.mdMarkdownGitHub ↗

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 | -s/--standard | -d/--deep | no flag -> medium (default) or auto-detect.

ModeFlagTargetCompressionHuman-readableVerification
Light-l, --lightAnyMinimalYesNone
Medium_(default)_AnyModerateYesNone
Standard-s, --standardDocs, README30-50%Yes1 round
Deep-d, --deepCLAUDE.md, system prompts, agent/skill defs, KNOWLEDGE2-3xNo (LLM-only)1-2 rounds

Smart Auto-Detection

When no flag provided AND input suggests compression (not just optimization):

1. Parse file path + content header 2. Classify:

  • LLM-only files (CLAUDE.md, .claude/rules/*.md, .claude/agents/*.md, .claude/skills/**/SKILL.md, KNOWLEDGE.*, system prompts) → deep candidate
  • README.md, docs/, API references, user-facing docs → standard candidate
  • Unknown / mixed → ask user via AskUserQuestion

3. If confident → tell user: "Selected mode: {mode} for {file} because {reason}" 4. If ambiguous → AskUserQuestion with mode options 5. User can override via flags regardless of auto-detection

Context Hints from Prompt Text

HintMode
"compress for CLAUDE.md / for context / for prompt / for LLM"deep
"deep compress / deep encode / super compress / maximum"deep
"compress / slim / tighten" (generic)standard
"safe compress / human readable"standard
Explicit target (e.g., "reduce by 70%")adjust aggressiveness

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
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.7Critical info position, documents-first, conciseness, quote-first, add WHY, reiterate constraint, prompt repetition

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)

Mode-to-Rules Mapping

ModeAppliesNotes
LightC.1-C.8, T.6, R.1-R.3, P.1-P.4, L.1-L.7Text cleanup only — no restructuring
MediumAll rules (C + T + S + R + P + L)Balanced transformations
StandardAll rules (C + T + S + R + P + L) + references/standard-compression.md30-50% compression, human-readable, 1 verification round
DeepAll rules (C + T + S + R + P + L) + references/deep-compression.mdDICT header, symbol substitutions, 1-2 verification rounds (conditional)

Usage Examples

CommandDescription
/brewtools:text-optimizeOptimize ALL: CLAUDE.md, .claude/agents/*.md, .claude/skills/**/SKILL.md
/brewtools:text-optimize file.mdSingle file (medium mode)
/brewtools:text-optimize -l file.mdLight mode — text cleanup only, structure untouched
/brewtools:text-optimize -d file.mdDeep mode — max compression, review diff after
/brewtools:text-optimize path1.md, path2.mdMultiple files — parallel processing
/brewtools:text-optimize -d agents/Directory — all .md files with specified mode
/brewtools:text-optimize -s README.mdStandard mode — 30-50% compression, human-readable
/brewtools:text-optimize -d CLAUDE.mdDeep mode — dictionary compression, LLM-only output
/brewtools:text-optimize CLAUDE.mdAuto-detect → selects deep for CLAUDE.md
/brewtools:text-optimize README.mdAuto-detect → selects standard for README
/brewtools:text-optimize "super compress" file.mdPrompt hint → deep mode

File Processing

Input Parsing

InputAction
No argsOptimize ALL: CLAUDE.md, .claude/agents/*.md, .claude/skills/**/SKILL.md
Single pathProcess directly
path1, path2Parallel processing

2-Phase Execution

Orchestration: Phase 1+2 are executed by the SKILL in the main conversation (manager level). The text-optimizer agent handles single-file optimization only — it cannot spawn sub-agents.

Phase 1: Analysis — Parallel Explore agents

Task(subagent_type: "Explore", prompt: "Analyze {file}: structure, dependencies, cross-refs, redundancies")

Phase 2: Optimization — Parallel text-optimizer agents

Context: BT_PLUGIN_ROOT is available in your context (injected by pre-task.mjs hook). Use it to access plugin resources.
Task(subagent_type: "text-optimizer", prompt: "FIRST: Read $BT_PLUGIN_ROOT/skills/text-optimize/references/rules-review.md for validation rules. FOR STANDARD MODE: Also read $BT_PLUGIN_ROOT/skills/text-optimize/references/standard-compression.md. FOR DEEP MODE: Also read $BT_PLUGIN_ROOT/skills/text-optimize/references/deep-compression.md. THEN optimize {file} using {mode} mode. Apply transformations, verify refs, output report with metrics.")
Spawn parallel: For multiple files, spawn ALL agents in ONE message for speed.

Quality Checklist

Before

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

During — Apply by Mode

CheckLightMedStdDeep
C.1-C.8 (Claude behavior)YesYesYesYes
T.6 (filler removal)YesYesYesYes
T.1-T.5, T.7-T.8 (token compression)-YesYesYes
S.1-S.8 (structure/clarity)-YesYesYes
R.1-R.3 (reference integrity)YesYesYesYes
P.1-P.4 (LLM perception)YesYesYesYes
L.1-L.7 (LLM comprehension)YesYesYesYes
Standard compression ref--Yes-
Deep compression ref + DICT---Yes
Aggressive rephrasing---Yes
Verification round(s)--12
No information lossYesYesYesYes

Deep Mode Pipeline

Phase 1: Compress

  • Load references/deep-compression.md for symbol/abbreviation tables
  • Scan text for terms occurring 3+ times → build DICT header
  • Apply symbol substitutions, filler removal, structural compression
  • Apply existing rules (C, T, S, R, P) in addition to deep techniques

Phase 2: Verify Round 1

  • Spawn verification agent with ORIGINAL + COMPRESSED text
  • Agent reads both, lists all lost/distorted facts
  • Calculate semantic match %
  • If >= 95% → done
  • If < 95% → return loss list for patching

Phase 3: Patch + Verify Round 2

  • Apply patches for missing facts
  • Re-verify
  • If still < 95% → warn user with loss list
  • Output final result + statistics

Standard Mode Pipeline

Phase 1: Compress

  • Load references/standard-compression.md
  • Remove filler words/constructions
  • Merge repeated ideas
  • Convert paragraphs to bullets/tables where appropriate
  • Apply existing rules (C, T, S, R, P)

Phase 2: Verify

  • Compare compressed vs original
  • List any lost facts → patch
  • One round only

Iron Rules (All Modes)

RuleDetail
PreserveNames, numbers, dates, URLs, file paths, versions, ports, sizes
PreserveNegative rule semantics (!= notation in deep mode)
PreserveAt least one example per rule with examples
Deep onlyDICT header at document start
OutputStatistics: original (chars/words/~tokens), compressed (chars/words/~tokens), ratio, semantic match %

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)

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

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.