Skip to content
Back to skills

Caveman Compress

ASecurity

把自然语言的记忆文件(CLAUDE.md、待办、偏好设置)压缩成 caveman 格式,省下 input token。 完整保留所有技术内容、代码、URL 与结构。 压缩版会覆写原文件,人类可读的备份存成 FILE.original.md。 Trigger: /caveman-compress FILEPATH or "compress memory file"

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 23, 2026
ai-agentspythongosqlnodedockergitapi

Works with

  • cli
  • api

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 10 files and shows the line behind each finding

Scanned September 23, 2026

npx -y skills add Hayatelin/caveman-zh-CN --skill caveman-compress --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Caveman Compress?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Caveman Compress
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/hayatelin-caveman-compress/badge)](https://www.skillsdirectory.com/skills/hayatelin-caveman-compress)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: caveman-compress
description: >
  把自然语言的记忆文件(CLAUDE.md、待办、偏好设置)压缩成 caveman 格式,省下 input token。
  完整保留所有技术内容、代码、URL 与结构。
  压缩版会覆写原文件,人类可读的备份存成 FILE.original.md。
  Trigger: /caveman-compress FILEPATH or "compress memory file"
---

# Caveman Compress

## 目的

把自然语言文件(CLAUDE.md、待办、偏好设置)压缩成 caveman 语体,减少 input token。压缩版覆写原文件。人类可读的备份存成 `<filename>.original.md`。

## 触发

`/caveman-compress <filepath>`,或用户要求压缩记忆文件时。

## 流程

1. 压缩脚本放在 `scripts/`(与这份 SKILL.md 同层)。如果路径不是立刻可得,就在这份 SKILL.md 旁边找 `scripts/__main__.py`。

2. 从包含这份 SKILL.md 的目录运行:

python3 -m scripts <absolute_filepath>

3. CLI 会做这些事:
- 判断文件类型(不耗 token)
- 调用 Claude 进行压缩
- 验证输出(不耗 token)
- 若有错误:找 Claude 做定点修正(只修有问题的地方,不重压)
- 最多重试 2 次
- 重试 2 次后仍失败:反馈错误给用户,原文件保持不动

4. 把结果反馈给用户

## 压缩规则

### 删除
- 冠词: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"

### 完全照抄(绝不修改)
- 代码区块(``` 围住的与缩进的)
- 行内代码(`反引号内容`)
- URL 与链接(完整 URL、markdown 链接)
- 文件路径(`/src/components/...`、`./config.yaml`)
- 指令(`npm install`、`git commit`、`docker build`)
- 技术术语(函数库名称、API 名称、通信协定、算法)
- 专有名词(项目名、人名、公司名)
- 日期、版本号、数值
- 环境变量(`$HOME`、`NODE_ENV`)

### 保留结构
- 所有 markdown 标题(标题文本完全不动,只压下面的内文)
- 项目符号阶层(保留嵌套层级)
- 编号清单(保留编号)
- 表格(压缩保存格文本,结构不动)
- markdown 文件的 frontmatter/YAML 标头

### 压缩
- 用短同义词:"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"——直接讲动作
- 把换句话说但意思相同的项目合并
- 多个范例展示同一种模式时,只留一个

关键规则:
凡是 ``` ... ``` 里的任何东西都必须完全照抄。
不可以:
- 删注释
- 删空白
- 重排行序
- 缩短指令
- 简化任何东西

行内代码(`...`)必须完全保留。
反引号里的任何东西都不可修改。

若文件含代码区块:
- 把代码区块视为唯读区域
- 只压缩区块外的文本
- 不要把代码前后的段落合并

## 范式

原文:
> 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.

## 界线

- 只压缩自然语言文件(.md、.txt、.typ、.typst、.tex、无扩展名)
- 绝不修改:.py、.js、.ts、.json、.yaml、.yml、.toml、.env、.lock、.css、.html、.xml、.sql、.sh
- 若文件内容混杂(散文+代码),只压缩散文段落
- 若无法判断是代码还是散文,就不要动它
- 覆写前,原文件会备份为 FILE.original.md
- 绝不压缩 FILE.original.md(直接跳过)

Files in this skill

  • README.md5.4 KB
  • SECURITY.md1.5 KB
  • SKILL.md4.4 KB
  • scripts/__init__.py224 B
  • scripts/__main__.py30 B
  • scripts/benchmark.py2.4 KB
  • scripts/cli.py2 KB
  • scripts/compress.py12.8 KB
  • scripts/detect.py4.6 KB
  • scripts/validate.py5.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…