SuperAPI AI Directory

genshijin-compress

Agents & models

View repository

Updated 10-15 22:38

About this skill

genshijin-compress

Purpose

Convert natural-language files (CLAUDE.md, todos, settings) into caveman mode to reduce input tokens. The compressed version overwrites the original file, and the human-readable version is saved with <filename>.original.md .

Trigger

/genshijin-compress <filepath> or a request such as "memory file compression".

Processing flow

  1. In the same directory as this SKILL.md, scripts/ is detected

  2. Execute:

    cd <SKILL.md を含むディレクトリ> && python3 -m scripts <絶対ファイルパス>
    
  1. CLI processing details:

    • File type detection (no token consumption)
    • Compress with Claude API/CLI
    • Output validation (no token consumption)
    • On error: pinpoint-fix only the relevant part with Claude (without recompressing)
    • Retry up to 2 times
    • On failure: report the error to the user, original file unchanged
  2. Return the result to the user

Compression rules

Delete

  • Honorifics and polite language (desu/masu/gozaimasu)
  • Cushion words (eeto/maa/chinami ni/ichiou/toriaezu/kihonteki ni/zakkuri iu to)
  • Prefaces (go-shitsumon arigatou gozaimasu/otikara ni nareba saiwai desu)
  • Hedging (~kamoshiremasen/~to omowaremasu/osoraku)
  • Redundant expressions (~suru koto ga dekiru→~dekiru, ~to iu mono wa→~wa)
  • Redundant connectives (~to iu koto ni narimasu node→dakara, ~sasete itadaku→suru)
  • Obvious particles (ga/no/wo/ni/de/wa/to/mo)
  • Adjectival verb inflectional endings (na/ni/de/da) → stem ending
  • Formal nouns (koto/mono/tame) → nominalize or omit
  • Auxiliary verbs (teiru/teoku/teshimau) → state expressions

Fully preserve (never change)

  • Code block (fenced ``` and indented)
  • Inline code (backtick)
  • URLs and links (full URLs, Markdown links)
  • File path (/src/components/..., ./config.yaml)
  • Command (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, numeric values
  • Environment variables ($HOME, NODE_ENV)
  • Original error messages

Preserve structure

  • All Markdown headings (heading text fully preserved, only the body below is compressed)
  • Bullet list hierarchy (maintain nesting levels)
  • Numbered lists (maintain numbers)
  • Tables (maintain structure, compress only text within cells)
  • Frontmatter/YAML header

Compress

  • Noun-ending and predicate-ending style
  • Absorb particles via kanji compounding ("koukafuka ji ni kousoku"→"koukafuka ji kousoku")
  • Convert native Japanese words to Sino-Japanese ("hayaku dousa"→"kousoku dousa")
  • Fragments OK: "Run tests before commit" not allowed "Be sure to run tests before committing"
  • Delete "please do ~" "remember to ~" → describe behavior only
  • Merge duplicate bullet points
  • For multiple examples of the same pattern, keep only 1 example

Important rules: ... Inside exact copy. Prohibited:

  • Deleting comments
  • Deleting spaces
  • Changing line order
  • Shortening commands
  • Any simplification

Inline code (...) are preserved exactly. Nothing inside backticks is changed.

Files containing code blocks:

  • Treat code blocks as read-only regions
  • Compress only the outer text
  • Do not merge sections around code

Pattern examples

Example 1

Original:

Be sure to run the test suite before pushing to the main branch. This is important for finding bugs early and preventing broken builds from being deployed to production.

Compressed:

Run tests before main push. Early bug detection, prevents broken build production deployment.

Example 2

Original:

This application adopts a microservices architecture with the following components. The API gateway handles all incoming requests and routes them to the appropriate services. 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

  • Compress only 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), compress only the prose parts
  • If it cannot be determined whether something is code or prose, do not change it
  • Back up the original file to FILE.original.md before overwriting
  • Never compress FILE.original.md (skip)
  • Never send sensitive files (.env, credentials, id_rsa, etc.) → refuse

Security

Compression sends raw data to the Anthropic API. Refuse the following:

  • .env, .netrc
  • credentials.*, secrets.*, passwords.*
  • SSH keys (id_rsa, id_ed25519 etc.)
  • Certificates (.pem, .key, .p12, .crt etc.)
  • Directory .ssh, .aws, .gnupg, .kube, .docker under
  • Those containing secret/credential/password/apikey/token/privatekey in the filename

If a heuristic produces a false positive, it can be avoided by renaming the file.