text-optimize
БесплатноЗапускает вложенные скриптыНе проверенOptimizes text, docs and LLM prompts (CLAUDE.md, rules, agent/skill files) for token efficiency in place, snapshot-backed, without losing facts. Use when…
от kochetkov-ma★ 41 звезда на GitHubОб этом скилле
Text & File Optimizer
Prompt contract
$ARGUMENTS is one free-form RU/EN prompt; depth flags and paths may sit anywhere in it. The depth flags are the Modes below.
- Mode: an explicit flag (
-l,-s,-d,-x,--light,--standard,--deep,--max) wins without scoring; else the most distinct whole-word hits from Modes/Context Hints, ties use the earliest keyword. No hit ->mediumbefore Smart Auto-Detection; empty ->mediumor per-file auto-detection. Max is opt-in: explicit-x/--maxor maximum/extreme compress hint only. - Scope: take paths from the remaining prose; never treat sentence-first words as positional paths. Fired by Claude mid-task (
Skilltool),argsis the prompt and names the target path(s): empty there stops with "no target", never the ALL set an empty user-typed prompt selects.--allow-dirtyin the prompt is the explicit authorization Phase 0 needs for uncommitted targets. - Ask: ambiguity -> ONE scoping
AskUserQuestion; unanswered or headless ->mediumon the named targets only, nothing blocks.
Print once, after resolving mode/targets and before Phase 1 Analysis (labels literal, INPUT verbatim, authored values follow the active work-artifact language policy, otherwise conversation language). SCOPE MUST name resolved target paths and depth:
PLAN — brewtools:text-optimize
INPUT: <arguments verbatim, or "(empty)">
MODE: <resolved depth> — <explicit flag | matched keyword: X | auto-detected | default>
SCOPE: <resolved target paths, resolved depth>
DO: <2-5 imperative bullets>
RESULT: <what the user ends up holding>
Step 0: Load Rules
REQUIRED: Read
references/rules-review.mdbefore ANY optimization. If file not found -> ERROR + STOP. Do not proceed without rules reference.
Modes
| Mode | Flag / EN keywords | RU keywords | Target | Compression | Human-readable | Verification | Mutates? |
|---|---|---|---|---|---|---|---|
| Light | -l, --light, light, quick clean |
лёгкая, лёгкий, почисти текст | Any | Minimal | Yes | Phase 3 sub-gate only | yes |
| Medium | (default), medium, balanced | средняя, сбалансируй | Any | Moderate | Yes | Self-check (fact inventory) | yes |
| Standard | -s, --standard, compress, slim, tighten, safe compress, human readable |
стандарт, сожми, для людей | Docs, README | 30-50% | Yes | 1 round (>=98%) | yes |
| Deep | -d, --deep, compress for CLAUDE.md, for context, for prompt, for LLM, deep compress, super compress, maximum |
глубокая, для контекста, максимально | CLAUDE.md, system prompts, agent/skill defs, KNOWLEDGE | 2-3x | No (LLM-only) | 1-2 rounds (>=95%) | yes |
| Max | -x, --max, max compress, extreme, maximum density, atomic |
максимум, предельно, атомарно | CLAUDE.md, system prompts, KNOWLEDGE | 3-4x | No (LLM-only) | 2 mandatory (>=95% + 100% sub-gate) | yes |
Loss Budget per Mode
Content essence is untouchable at light/medium/standard; small deliberate loss is allowed only at deep/max, explicitly reported. Dedup-merged facts count as preserved, never as loss. Every mode mutates in place: Phase 0 snapshot and Phase 3 sub-gate apply to all.
| Mode | Semantic match target | Allowed loss |
|---|---|---|
| Light | 100% | None — wording cleanup only |
| Medium | 100% | None — restructure, zero fact loss (self-check) |
| Standard | >= 98% | None intended; verification patches any slip |
| Deep | >= 95% + 100% sub-gate (numbers/names/negations/scope) | Word-level drops (A.2, ledgered, gate-neutral) + generic known-facts (A.4, elided-known, consumes gate), listed in report |
| Max | >= 95% + 100% sub-gate (numbers/names/negations/scope) | Small, explicit, user-reviewed loss list |
The 100% semantic sub-gate is a REFUSAL, not a warning: patch confirmed loss or refuse acceptance under Safe recovery. The
>= 95%budget never permits losing a number, path, version, name, negation or scope qualifier. Explicitly authorized replacements are reported as requested changes, not compression loss.
Smart Auto-Detection
When no flag provided AND input suggests compression (not just optimization):
- Parse file path + content header
- 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 with mode options
- LLM-only files (
- Confident → tell user: "Selected mode: {mode} for {file} because {reason}"
- Flags override auto-detection; the Max opt-in rule in Prompt contract applies.
Context Hints from Prompt Text
Beyond the Modes keyword columns:
| Hint | Mode |
|---|---|
| "deep encode" | deep |
| Explicit target (e.g., "reduce by 70%") | adjust aggressiveness |
Rule ID Quick Reference
Defined in `references/rules-revi
Установить text-optimize в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadBash(bash ${CLAUDE_SKILL_DIR}/scripts/text-guard.sh *)GrepGlobAgentAskUserQuestionВложенные файлы
FAQ
Что делает скилл text-optimize?
Optimizes text, docs and LLM prompts (CLAUDE.md, rules, agent/skill files) for token efficiency in place, snapshot-backed, without losing facts. Use when asked to optimize, compress or cut tokens of named files. Triggers - optimize, reduce tokens, compress, deep compress, сожми, оптимизируй.
Как установить скилл text-optimize?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл text-optimize запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic