ホーム / Skills / 開発効率化 / Caveman Compress メモリファイル圧縮
開発効率化

Caveman Compress メモリファイル圧縮

Julius BrusseeApache-2.0Skill の言語: 英語
ライセンス確認済みスクリプトを含む外部サービスが必要
デモ実行記録 · claude-opus-5-5 · 2026年10月
docs/preferences.md (before, 1,391 bytes)
Project Preferences
Code Style

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.

Testing

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.

Commits and Pull Requests
  • 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.
docs/preferences.md (after /caveman-compress, 881 bytes)
Project Preferences
Code Style

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.

Testing

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.

Commits and Pull Requests
  • 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、プロジェクトメモ、ToDo リスト、好みの設定などの自然言語ファイルを簡潔な文章に書き換え、エージェントが読み込むたびのトークン消費を減らします。見出し、コードブロック、インラインコード、URL、ファイルパスは変えてはいけないルールです。

仕組み

  1. /caveman-compress <ファイル>、またはメモリファイルの圧縮を頼むと起動します。
  2. 同梱の Python スクリプトを実行します。ファイルの種類、サイズ(最大 500 KB)、名前を確認してから、テキストを Claude に送って圧縮します。コードブロックは先に伏せられるため、モデルは変更できません。
  3. 結果をローカルで検証します。チェックに通らなければ、問題箇所だけの修正を Claude に最大 2 回依頼し、それでも失敗したら元のファイルには手を付けません。
  4. 圧縮したファイルをその場に書き込み、原本は <名前>.original.md として別のデータフォルダに保存します。エージェントが二重に読み込まないためです。

向いている場面

毎回のセッションで読み込まれる、大きなプロジェクトのメモリファイル。

知っておきたいこと

圧縮するのは文章のファイル(.md、.mdc、.txt、.rst、.typ、.tex、拡張子なし)だけで、コードや設定ファイルはスキップします。Python 3.10 以上が必要です。私たちの試用では、1,391 バイトの設定ファイルが 881 バイトになり、見出し、コードブロック、インラインコード、URL はすべてそのまま残りました。

補足とリスク

エージェントが実行する Python スクリプトを含みます。指定したファイルの内容を Anthropic に送信します。ANTHROPIC_API_KEY が設定されていれば Anthropic Python SDK を、なければログイン済みの `claude` CLI を使うため、利用量はご自身の Anthropic アカウントに計上されます。対象ファイルを上書きし、~/.local/share/caveman-compress(Windows では %LOCALAPPDATA%)にバックアップとロックファイルを書き込みます。認証情報や鍵らしい名前のファイルは処理を拒否します。スクリプトはすべて読み、ほかの通信やファイルアクセスがないことを確認しました。Anthropic に送りたくない内容のファイルには使わないでください。

SKILL.md 原文パッケージ内 12 ファイル