hui-compress

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Hui Compress

Hui Compress

Purpose

用途

Compress natural language files (CLAUDE.md, todos, preferences) into hui-speak to reduce input tokens. Compressed version overwrites original. Human-readable backup saved as
<filename>.original.md
.
将自然语言文件(CLAUDE.md、待办事项、偏好设置)压缩为hui语言格式,以减少输入tokens。压缩版本将覆盖原文件,可读的备份文件保存为
<filename>.original.md

Trigger

触发方式

/hui-compress <filepath>
or when user asks to compress a memory file.
/hui-compress <filepath>
或当用户要求压缩记忆文件时。

Process

操作流程

  1. The compression scripts live in
    scripts/
    (adjacent to this SKILL.md). If the path is not immediately available, search for
    scripts/__main__.py
    next to this SKILL.md.
  2. From the directory containing this SKILL.md, run:
python3 -m scripts <absolute_filepath>
  1. The CLI will:
  • detect file type (no tokens)
  • call Claude to compress
  • validate output (no tokens)
  • if errors: cherry-pick fix with Claude (targeted fixes only, no recompression)
  • retry up to 2 times
  • if still failing after 2 retries: report error to user, leave original file untouched
  1. Return result to user
  1. 压缩脚本位于
    scripts/
    目录下(与本SKILL.md同级)。若无法直接获取路径,请在SKILL.md同级目录下查找
    scripts/__main__.py
  2. 在包含本SKILL.md的目录中运行:
python3 -m scripts <absolute_filepath>
  1. 命令行界面(CLI)将:
  • 检测文件类型(不消耗tokens)
  • 调用Claude进行压缩
  • 验证输出结果(不消耗tokens)
  • 若出现错误:使用Claude进行针对性修复(仅针对性修复,不重新压缩)
  • 最多重试2次
  • 若2次重试后仍失败:向用户报告错误,保留原文件不变
  1. 向用户返回处理结果

Compression Rules

压缩规则

Remove

需要移除的内容

  • Articles: a, an, the
  • Filler: just, really, basically, actually, simply, essentially, generally
  • Pleasantries: "sure", "certainly", "of course", "happy to", "I'd recommend"
  • Hedging: "it might be worth", "you could consider", "it would be good to"
  • Redundant phrasing: "in order to" → "to", "make sure to" → "ensure", "the reason is because" → "because"
  • Connective fluff: "however", "furthermore", "additionally", "in addition"
  • 冠词: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"

Preserve EXACTLY (never modify)

必须完全保留(绝不修改)

  • Code blocks (fenced ``` and indented)
  • Inline code (
    backtick content
    )
  • URLs and 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, people, companies)
  • Dates, version numbers, numeric values
  • Environment variables (
    $HOME
    ,
    NODE_ENV
    )
  • 代码块(使用```包裹的和缩进的代码)
  • 行内代码(
    反引号包裹的内容
  • URL和链接(完整URL、Markdown链接)
  • 文件路径(
    /src/components/...
    ./config.yaml
  • 命令(
    npm install
    git commit
    docker build
  • 技术术语(库名称、API名称、协议、算法)
  • 专有名词(项目名称、人物、公司)
  • 日期、版本号、数值
  • 环境变量(
    $HOME
    NODE_ENV

Preserve Structure

保留结构

  • All markdown headings (keep exact heading text, compress body below)
  • Bullet point hierarchy (keep nesting level)
  • Numbered lists (keep numbering)
  • Tables (compress cell text, keep structure)
  • Frontmatter/YAML headers in markdown files
  • 所有Markdown标题(保留标题文本原文,仅压缩标题下方的正文)
  • 项目符号层级(保留嵌套级别)
  • 编号列表(保留编号)
  • 表格(压缩单元格文本,保留结构)
  • Markdown文件中的Frontmatter/YAML头部

Compress

压缩方式

  • Use short synonyms: "big" not "extensive", "fix" not "implement a solution for", "use" not "utilize"
  • Fragments OK: "Run tests before commit" not "You should always run tests before committing"
  • Drop "you should", "make sure to", "remember to" — just state the action
  • Merge redundant bullets that say the same thing differently
  • Keep one example where multiple examples show the same pattern
CRITICAL RULE: Anything inside
...
must be copied EXACTLY. Do not:
  • remove comments
  • remove spacing
  • reorder lines
  • shorten commands
  • simplify anything
Inline code (
...
) must be preserved EXACTLY. Do not modify anything inside backticks.
If file contains code blocks:
  • Treat code blocks as read-only regions
  • Only compress text outside them
  • Do not merge sections around code
  • 使用简短同义词:用"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"等表述,直接说明操作
  • 合并表述相同但方式不同的冗余项目符号
  • 若多个示例展示同一模式,仅保留一个示例

Pattern

关键规则:

Original:
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.
Compressed:
Run tests before push to main. Catch bugs early, prevent broken prod deploys.
Original:
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.
Compressed:
Microservices architecture. API gateway route all requests to services. Auth service manage user sessions + JWT tokens.
...
包裹的任何内容必须完全复制,不得:
  • 删除注释
  • 删除空格
  • 重新排序行
  • 缩短命令
  • 简化任何内容
行内代码(
...
)必须完全保留,不得修改反引号内的任何内容。
若文件包含代码块:
  • 将代码块视为只读区域
  • 仅压缩代码块外的文本
  • 不得合并代码块周围的内容

Boundaries

示例

  • ONLY compress natural language files (.md, .txt, .typ, .typst, .tex, extensionless)
  • NEVER modify: .py, .js, .ts, .json, .yaml, .yml, .toml, .env, .lock, .css, .html, .xml, .sql, .sh
  • If file has mixed content (prose + code), compress ONLY the prose sections
  • If unsure whether something is code or prose, leave it unchanged
  • Original file is backed up as FILE.original.md before overwriting
  • Never compress FILE.original.md (skip it)
原文:
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(跳过该文件)