genshijin-compress

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

genshijin-compress

genshijin-compress

目的

Purpose

自然言語ファイル(CLAUDE.md, todos, 設定)を原始人モード化して入力トークン削減。圧縮版が原ファイル上書き、人間可読版は
<filename>.original.md
で保存。
Compress natural language files (CLAUDE.md, todos, settings) into primitive human mode to reduce input tokens. The compressed version overwrites the original file, and the human-readable version is saved as
<filename>.original.md
.

トリガー

Triggers

/genshijin-compress <filepath>
または「メモリファイル圧縮」等の依頼。
Trigger with
/genshijin-compress <filepath>
or requests like "memory file compression".

処理フロー

Processing Flow

  1. この SKILL.md と同ディレクトリの
    scripts/
    を検出
  2. 実行:
    cd <SKILL.md を含むディレクトリ> && python3 -m scripts <絶対ファイルパス>
  3. CLI 処理内容:
    • ファイル種別検出(トークン消費なし)
    • Claude API/CLI で圧縮
    • 出力検証(トークン消費なし)
    • エラー時: Claude で該当箇所のみピンポイント修正(再圧縮せず)
    • 最大2回リトライ
    • 失敗時: ユーザーにエラー報告、原ファイルは無変更
  4. 結果をユーザーに返却
  1. Detect the
    scripts/
    directory in the same location as this SKILL.md
  2. Execute:
    cd <directory containing SKILL.md> && python3 -m scripts <absolute file path>
  3. CLI Processing Details:
    • File type detection (no token consumption)
    • Compression via Claude API/CLI
    • Output verification (no token consumption)
    • On error: Pinpoint correction of the relevant part only with Claude (no re-compression)
    • Max 2 retries
    • On failure: Report error to user, original file remains unchanged
  4. Return results to user

圧縮ルール

Compression Rules

削除

Delete

  • 敬語・丁寧語(です/ます/ございます)
  • クッション言葉(えーと/まあ/ちなみに/一応/とりあえず/基本的に/ざっくり言うと)
  • 前置き(ご質問ありがとうございます/お力になれれば幸いです)
  • ぼかし(〜かもしれません/〜と思われます/おそらく)
  • 冗長表現(〜することができる→〜できる、〜というものは→〜は)
  • 冗長接続(〜ということになりますので→だから、〜させていただく→する)
  • 自明な助詞(が/の/を/に/で/は/と/も)
  • 形容動詞活用語尾(な/に/で/だ)→ 語幹止め
  • 形式名詞(こと/もの/ため)→ 名詞化 or 省略
  • 補助動詞(ている/ておく/てしまう)→ 状態表現
  • Honorifics/polite forms (desu/masu/gozaimasu)
  • Filler words (eeto/maa/chinami ni/ittou/toriaezu/kihonteki ni/zakkuri iu to)
  • Preambles ("Thank you for your question"/"I hope I can be of help")
  • Vague expressions ("might be"/"is thought to be"/"perhaps")
  • Redundant expressions ("is able to do" → "can do"; "the thing that is" → "is")
  • Redundant connectors ("Therefore" → "So"; "I would like to do" → "do")
  • Obvious particles (ga/no/o/ni/de/wa/to/mo)
  • Adjectival verb endings (na/ni/de/da) → Stop at the stem
  • Formal nouns (koto/mono/tame) → Nominalize or omit
  • Auxiliary verbs (te iru/te oku/te shimau) → State expressions

完全保持(絶対変更しない)

Fully Retain (Never Modify)

  • コードブロック(fenced ``` and indented)
  • インラインコード(
    backtick
  • URL・リンク(完全URL、Markdownリンク)
  • ファイルパス(
    /src/components/...
    ,
    ./config.yaml
  • コマンド(
    npm install
    ,
    git commit
    ,
    docker build
  • 技術用語(ライブラリ名、API名、プロトコル、アルゴリズム)
  • 固有名詞(プロジェクト名、人名、企業名)
  • 日付、バージョン番号、数値
  • 環境変数(
    $HOME
    ,
    NODE_ENV
  • エラーメッセージ原文
  • Code blocks (fenced ``` and indented)
  • Inline code (
    backtick
    )
  • URLs/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, personal names, company names)
  • Dates, version numbers, numerical values
  • Environment variables (
    $HOME
    ,
    NODE_ENV
    )
  • Original error messages

構造保持

Retain Structure

  • Markdown見出し全て(見出しテキストは完全保持、下の本文のみ圧縮)
  • 箇条書き階層(ネストレベル維持)
  • 番号付きリスト(番号維持)
  • テーブル(構造維持、セル内テキストのみ圧縮)
  • Frontmatter/YAMLヘッダ
  • All Markdown headings (heading text fully retained, only the body below is compressed)
  • List hierarchy (maintain nesting levels)
  • Numbered lists (maintain numbering)
  • Tables (maintain structure, only compress text within cells)
  • Frontmatter/YAML headers

圧縮

Compression

  • 体言止め・用言止め
  • 漢字連結で助詞吸収(「高負荷時に高速」→「高負荷時高速」)
  • 和語→漢語化(「速く動作」→「高速動作」)
  • 断片OK: 「コミット前テスト実行」不可「コミット前に必ずテストを実行してください」
  • 「〜してください」「〜することを忘れずに」削除 → 動作のみ記述
  • 重複箇条書きを統合
  • 同パターン複数例は1例のみ残す
重要ルール:
...
内は 完全コピー。 禁止:
  • コメント削除
  • スペース削除
  • 行順変更
  • コマンド短縮
  • 簡略化一切
インラインコード(
...
)は完全保持。バッククォート内は一切変更しない。
コードブロック含むファイル:
  • コードブロックは読取専用領域として扱う
  • 外側のテキストのみ圧縮
  • コード周辺セクションの結合禁止
  • End with nouns/verbs
  • Absorb particles by connecting kanji (e.g., "koufuka ji ni kousoku" → "koufuka ji kousoku")
  • Replace native Japanese words with Sino-Japanese words (e.g., "hayaku dousa" → "kousoku dousa")
  • Fragments are allowed: "Commit pre-test execution" is acceptable; "Please be sure to run tests before committing" is not
  • Delete "please do" and "don't forget to" → Only describe the action
  • Consolidate duplicate list items
  • Keep only one example for multiple instances of the same pattern
Important Rules: Copy exactly the content inside
...
. Prohibited:
  • Deleting comments
  • Deleting spaces
  • Changing line order
  • Shortening commands
  • Any simplification
Inline code (
...
) is fully retained. Never modify content inside backticks.
For files containing code blocks:
  • Treat code blocks as read-only areas
  • Only compress text outside code blocks
  • Forbid merging sections around code blocks

パターン例

Pattern Examples

例1

Example 1

原文:
main ブランチにプッシュする前には必ずテストスイートを実行するようにしてください。これはバグを早期に発見し、壊れたビルドが本番環境にデプロイされるのを防ぐために重要です。
圧縮:
main push前テスト実行。バグ早期発見、壊れビルド本番デプロイ防止。
Original:
Please be sure to run the test suite before pushing to the main branch. This is important to detect bugs early and prevent broken builds from being deployed to production.
Compressed:
Run tests before main push. Early bug detection, prevent broken build production deployment.

例2

Example 2

原文:
このアプリケーションは以下のコンポーネントを持つマイクロサービスアーキテクチャを採用しています。APIゲートウェイが全ての受信リクエストを処理し、適切なサービスにルーティングします。認証サービスはユーザーセッションとJWTトークンの管理を担当します。
圧縮:
マイクロサービスアーキテクチャ。APIゲートウェイ 全受信リクエストをサービスにルーティング。認証サービス ユーザーセッション + JWTトークン管理。
Original:
This application adopts 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 routes all incoming requests to services. Authentication service manages user sessions + JWT tokens.

境界

Boundaries

  • 自然言語ファイルのみ圧縮(.md, .txt, 拡張子なし)
  • 絶対変更しない: .py, .js, .ts, .json, .yaml, .yml, .toml, .env, .lock, .css, .html, .xml, .sql, .sh
  • 混在ファイル(散文 + コード)は散文部分のみ圧縮
  • コードか散文か判断つかない場合は変更しない
  • 原ファイルは FILE.original.md にバックアップしてから上書き
  • FILE.original.md は絶対圧縮しない(スキップ)
  • 機密ファイル(.env, credentials, id_rsa 等)は絶対に送信しない → 拒否
  • Only compress natural language files (.md, .txt, no extension)
  • Never modify: .py, .js, .ts, .json, .yaml, .yml, .toml, .env, .lock, .css, .html, .xml, .sql, .sh
  • For mixed files (prose + code), only compress the prose part
  • If unable to determine whether it's code or prose, do not modify
  • Back up the original file to FILE.original.md before overwriting
  • Never compress FILE.original.md (skip it)
  • Never send confidential files (.env, credentials, id_rsa, etc.) → Reject

セキュリティ

Security

圧縮は Anthropic API に生データ送信。以下は拒否:
  • .env
    ,
    .netrc
  • credentials.*
    ,
    secrets.*
    ,
    passwords.*
  • SSH鍵(
    id_rsa
    ,
    id_ed25519
    等)
  • 証明書(
    .pem
    ,
    .key
    ,
    .p12
    ,
    .crt
    等)
  • ディレクトリ
    .ssh
    ,
    .aws
    ,
    .gnupg
    ,
    .kube
    ,
    .docker
    配下
  • ファイル名に
    secret
    /
    credential
    /
    password
    /
    apikey
    /
    token
    /
    privatekey
    含むもの
ヒューリスティック誤検知時は、ファイル名変更で回避可能。
Compression sends raw data to the Anthropic API. Reject the following:
  • .env
    ,
    .netrc
  • credentials.*
    ,
    secrets.*
    ,
    passwords.*
  • SSH keys (
    id_rsa
    ,
    id_ed25519
    , etc.)
  • Certificates (
    .pem
    ,
    .key
    ,
    .p12
    ,
    .crt
    , etc.)
  • Files under directories
    .ssh
    ,
    .aws
    ,
    .gnupg
    ,
    .kube
    ,
    .docker
  • Files with names containing
    secret
    /
    credential
    /
    password
    /
    apikey
    /
    token
    /
    privatekey
In case of heuristic false positives, avoid by renaming the file.