compress
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCaveman Compress
穴居人压缩工具
Purpose
用途
Compress natural language files (CLAUDE.md, todos, preferences) into caveman-speak to reduce input tokens. Compressed version overwrites original. Human-readable backup saved as .
<filename>.original.md将自然语言文件(CLAUDE.md、待办事项、偏好设置)压缩为穴居人表述风格以减少输入token。压缩版本会覆盖原文件,人类可读的备份将保存为 。
<filename>.original.mdTrigger
触发方式
/caveman:compress <filepath>/caveman:compress <文件路径>Process
执行流程
-
This SKILL.md lives alongsidein the same directory. Find that directory.
scripts/ -
Run:
cd <directory_containing_this_SKILL.md> && python3 -m scripts <absolute_filepath>
- The CLI will:
- detect file type (no tokens)
- call Claude to compress
- validate output (no tokens)
- if errors: cherry-pick fix with Claude (targeted fixes only, no recompression)
- retry up to 2 times
- Return result to user
-
此SKILL.md文件与目录位于同一路径下,先找到该目录。
scripts/ -
运行命令:
cd <包含此SKILL.md的目录> && python3 -m scripts <文件绝对路径>
- CLI会执行以下操作:
- 检测文件类型(无token消耗)
- 调用Claude执行压缩
- 验证输出(无token消耗)
- 若出现错误:调用Claude针对性修复(仅定向修复,不重新压缩)
- 最多重试2次
- 向用户返回结果
Compression Rules
压缩规则
Remove
需移除的内容
- Articles: a, an, the
- Filler: just, really, basically, actually, simply, essentially, generally
- Pleasantries: "sure", "certainly", "of course", "happy to", "I'd recommend"
- Hedging: "it might be worth", "you could consider", "it would be good to"
- Redundant phrasing: "in order to" → "to", "make sure to" → "ensure", "the reason is because" → "because"
- Connective fluff: "however", "furthermore", "additionally", "in addition"
- 冠词:a, an, the
- 填充词:just, really, basically, actually, simply, essentially, generally
- 礼貌用语:"sure", "certainly", "of course", "happy to", "I'd recommend"
- 模糊表述:"it might be worth", "you could consider", "it would be good to"
- 冗余表述:"in order to" → "to", "make sure to" → "ensure", "the reason is because" → "because"
- 冗余连接词:"however", "furthermore", "additionally", "in addition"
Preserve EXACTLY (never modify)
需精确保留(不得修改)
- Code blocks (fenced ``` and indented)
- Inline code ()
backtick content - URLs and links (full URLs, markdown links)
- File paths (,
/src/components/...)./config.yaml - Commands (,
npm install,git commit)docker build - Technical terms (library names, API names, protocols, algorithms)
- Proper nouns (project names, people, companies)
- Dates, version numbers, numeric values
- Environment variables (,
$HOME)NODE_ENV
- 代码块(```包裹的围栏代码块和缩进代码块)
- 行内代码(反引号`包裹的内容)
- URL和链接(完整URL、markdown链接)
- 文件路径(,
/src/components/...)./config.yaml - 命令(,
npm install,git commit)docker build - 技术术语(库名、API名、协议、算法)
- 专有名词(项目名、人名、公司名)
- 日期、版本号、数值
- 环境变量(,
$HOME)NODE_ENV
Preserve Structure
需保留的结构
- All markdown headings (keep exact heading text, compress body below)
- Bullet point hierarchy (keep nesting level)
- Numbered lists (keep numbering)
- Tables (compress cell text, keep structure)
- Frontmatter/YAML headers in markdown files
- 所有markdown标题(保留标题原文,仅压缩下方正文)
- 项目符号层级(保留嵌套级别)
- 有序列表(保留编号)
- 表格(压缩单元格文本,保留结构)
- markdown文件的前言/YAML头部
Compress
压缩规则
- Use short synonyms: "big" not "extensive", "fix" not "implement a solution for", "use" not "utilize"
- Fragments OK: "Run tests before commit" not "You should always run tests before committing"
- Drop "you should", "make sure to", "remember to" — just state the action
- Merge redundant bullets that say the same thing differently
- Keep one example where multiple examples show the same pattern
CRITICAL RULE:
Anything inside must be copied EXACTLY.
Do not:
...- remove comments
- remove spacing
- reorder lines
- shorten commands
- simplify anything
Inline code () must be preserved EXACTLY.
Do not modify anything inside backticks.
...If file contains code blocks:
- Treat code blocks as read-only regions
- Only compress text outside them
- Do not merge sections around code
- 使用短同义词:用"big"不用"extensive",用"fix"不用"implement a solution for",用"use"不用"utilize"
- 允许使用短句碎片:用"Run tests before commit"不用"You should always run tests before committing"
- 去掉"you should"、"make sure to"、"remember to" —— 直接陈述动作
- 合并表述重复的项目符号
- 同一模式的多个示例仅保留一个
关键规则:
内的所有内容必须完全原样复制。
禁止以下操作:
...- 删除注释
- 删除空格
- 调整行顺序
- 缩短命令
- 简化任何内容
行内代码()必须完全保留。不得修改反引号内的任何内容。
...如果文件包含代码块:
- 将代码块视为只读区域
- 仅压缩代码块外的文本
- 不得合并代码块周边的章节
Pattern
示例
Original:
You should always make sure to run the test suite before pushing any changes to the main branch. This is important because it helps catch bugs early and prevents broken builds from being deployed to production.
Compressed:
Run tests before push to main. Catch bugs early, prevent broken prod deploys.
Original:
The application uses a microservices architecture with the following components. The API gateway handles all incoming requests and routes them to the appropriate service. The authentication service is responsible for managing user sessions and JWT tokens.
Compressed:
Microservices architecture. API gateway route all requests to services. Auth service manage user sessions + JWT tokens.
原文:
You should always make sure to run the test suite before pushing any changes to the main branch. This is important because it helps catch bugs early and prevents broken builds from being deployed to production.
压缩后:
Run tests before push to main. Catch bugs early, prevent broken prod deploys.
原文:
The application uses a microservices architecture with the following components. The API gateway handles all incoming requests and routes them to the appropriate service. The authentication service is responsible for managing user sessions and JWT tokens.
压缩后:
Microservices architecture. API gateway route all requests to services. Auth service manage user sessions + JWT tokens.
Boundaries
使用边界
- ONLY compress natural language files (.md, .txt, extensionless)
- NEVER modify: .py, .js, .ts, .json, .yaml, .yml, .toml, .env, .lock, .css, .html, .xml, .sql, .sh
- If file has mixed content (prose + code), compress ONLY the prose sections
- If unsure whether something is code or prose, leave it unchanged
- Original file is backed up as FILE.original.md before overwriting
- Never compress FILE.original.md (skip it)
- 仅压缩自然语言文件(.md、.txt、无后缀文件)
- 绝对不得修改:.py、.js、.ts、.json、.yaml、.yml、.toml、.env、.lock、.css、.html、.xml、.sql、.sh
- 如果文件包含混合内容(散文+代码),仅压缩散文部分
- 不确定内容是代码还是散文时,保持原样
- 覆盖原文件前会将原文件备份为 FILE.original.md
- 永远不要压缩 FILE.original.md(直接跳过)