I strongly prefer TypeScript with strict mode enabled for all new code. Please don't use the `any` type unless there is genuinely no way around it, and if you do, make sure to leave a comment explaining the reasoning behind it. I find that taking the time to properly type things catches a lot of bugs before they ever make it to runtime.
When you are writing React components, it would be good to use function components with hooks rather than class components. You should also try to keep each component in its own file under `src/components/`, because it really makes it a lot easier to find things later on.
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 the tests with:
```bash pnpm test --run ```
If a test is flaky, please don't just skip it. Instead, open an issue on https://github.com/acme/web-app/issues and add the `flaky` label so that we can actually track it down.
- Please use Conventional Commits for all of your commit messages.
- It would be great if you could keep pull requests small, ideally under about 400 lines of changes.
- Make sure to always update `CHANGELOG.md` whenever you change any user-facing behavior.
Strongly prefer TypeScript, strict mode on, all new code. No `any` type unless truly no way around — if used, leave comment explaining why. Proper typing catches many bugs before runtime.
React components: function components with hooks, not class components. One component per file under `src/components/` — easier to find later.
Always run test suite before pushing to main branch. Catches bugs early, prevents broken builds deploying to production. Run tests with:
```bash pnpm test --run ```
Flaky test? Don't skip. Open issue on https://github.com/acme/web-app/issues and add `flaky` label so it can be tracked down.
- Use Conventional Commits for all commit messages.
- Keep PRs small, ideally under ~400 lines changed.
- Always update `CHANGELOG.md` when changing user-facing behavior.
Real run recorded with claude-code / claude-opus-5-5. Prompt: "Compress docs/preferences.md so it costs fewer tokens when the agent loads it, but keep a backup of the original." The skill ran its bundled script (python3 -m scripts), which calls the claude CLI to do the compression. The first validation found a stray comma after a URL, and the script fixed it automatically before passing. The left and right columns are the file's exact contents before and after, unmodified, only split into headings, paragraphs and lists for display. The original was backed up to preferences.original.md in the tool's data directory.
它做什麼
將 CLAUDE.md、專案筆記、待辦清單、偏好設定這類自然語言檔案改寫成精簡的表達,讓代理每次載入時消耗更少的 token。標題、程式碼區塊、行內程式碼、URL 與檔案路徑必須保持不變。
運作方式
- 輸入 /caveman-compress <檔案>,或要求壓縮某個記憶檔時觸發。
- 執行內附的 Python 腳本:先檢查檔案類型、大小(上限 500 KB)與檔名,再將文字傳給 Claude 壓縮。程式碼區塊會先被遮蔽,模型無法改動。
- 在本機校驗結果;校驗不通過就請 Claude 只修正出錯之處,最多 2 次,仍失敗則原檔不動。
- 原地寫入壓縮後的檔案,並將原文以
<檔名>.original.md存到獨立的資料目錄,避免代理重複載入。
適合情境
每次工作階段都會載入的大型專案記憶檔。
需要了解
只壓縮純文字檔(.md、.mdc、.txt、.rst、.typ、.tex 與無副檔名檔案),程式碼與設定檔會略過。需要 Python 3.10 以上版本。我們試用時,一個 1,391 位元組的偏好檔壓縮到 881 位元組,標題、程式碼區塊、行內程式碼與 URL 全部維持原樣。
含 Python 腳本,由代理執行。腳本會將你指定的檔案內容傳送給 Anthropic:設定了 ANTHROPIC_API_KEY 時透過 Anthropic Python SDK,否則呼叫你已登入的 `claude` 命令列,用量計入你的 Anthropic 帳戶。腳本會覆寫目標檔案,並在 ~/.local/share/caveman-compress(Windows 為 %LOCALAPPDATA%)下寫入備份與鎖定檔;檔名看似憑證或金鑰的檔案會被拒絕。我們逐一讀過腳本,未發現其他連網或檔案存取行為。不想傳給 Anthropic 的內容,請勿用它壓縮。