‹ 首页

mix-compression

@oliver-kriska · 收录于 4 天前 · 上游提交 4 天前

Reduce mix output noise (5-15% token savings) by installing rtk filters that compress mix test/credo/dialyzer/compile output before it reaches Claude. Use when long mix output floods context.

适合你,如果经常用 Claude 处理 Elixir 项目且被大量 mix 输出淹没。

/ 通过 npx 安装 校验哈希
npx oh-my-skill add oliver-kriska/claude-elixir-phoenix/mix-compression
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- oliver-kriska/claude-elixir-phoenix/mix-compression
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify oliver-kriska/claude-elixir-phoenix/mix-compression
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
503GitHub stars
~892最小装载
~892含声明引用
~5.2K文本包总量
索引托管

怎么用

商店整理自技能原文 · 版本 88c1194 · 表述以原文为准
它做什么

安装 rtk 过滤器后,Claude 运行 mix 命令(如 mix test、mix credo)时,输出会被压缩:成功信息精简为一行,错误和警告保留,从而节省 5-15% 的 token 消耗。

什么时候触发

当你长时间运行 mix 命令、调试循环多次执行 mix test/compile,或 dialyzer 输出过长时触发。

装好后可以这样说
Claude 会检测并安装 rtk,配置过滤器。
Claude 会配置 mix-compile 过滤器。
Claude 会执行安装和验证步骤。
技能原文 SKILL.md作者撰写 · MIT · 88c1194

Mix Output Compression

Mix commands (mix test, mix credo, mix dialyzer, mix compile) emit verbose, repetitive output that consumes context fast. This skill installs rtk — a CLI proxy that filters tool output before it lands in the transcript.

The filters short-circuit happy paths to a single line (mix test: all pass) while preserving full failure blocks, compile errors, and stack traces. Net win: 5-15% per-session token reduction on mix-heavy workflows.

When to use
  • Long sessions/phx:work or /phx:full hitting context limits from mix output
  • Debugging loops/phx:investigate retrying mix compile/mix test repeatedly
  • Dialyzer-heavy projectsmix dialyzer output dominates the transcript
Iron Laws
  1. NEVER strip critical signals — compile errors (** (CompileError), == Compilation error in), test failures (FAILURES, 0 failures — preserved even on short-circuit), dialyzer warnings, and stack traces with file:line MUST pass through unchanged
  2. Verify after install — run rtk verify (or rtk verify --filter mix-test) to confirm the bundled test fixtures pass before declaring success
  3. Never overwrite existing .rtk/filters.toml — diff and merge instead
Workflow
Step 1: Detect rtk
which rtk && rtk --version

Read ${CLAUDE_SKILL_DIR}/references/install.md if rtk is missing — covers homebrew install + shell hook setup.

Step 2: Seed .rtk/filters.toml

Reference filters live at ${CLAUDE_SKILL_DIR}/references/rtk-filters.toml. Six production-tested filters covering:

  • mix-test — short-circuits all-pass, preserves failure blocks + compile errors
  • mix-credo — collapses clean runs, preserves violation blocks
  • mix-dialyzer — drops PLT progress, keeps warnings + summary
  • mix-deps-get — collapses unchanged package lists
  • mix-ecto-migrate — strips compile prefix, short-circuits "already up"
  • mix-compile — handles parallel worker prefixes (N>) and MIX_ENV

Run this if the project has no .rtk/filters.toml yet:

mkdir -p .rtk
cp "${CLAUDE_SKILL_DIR}/references/rtk-filters.toml" .rtk/filters.toml

Read both files if one already exists. Present a diff to the user. Merge only the filters they don't already have.

Step 3: Verify filters work
rtk verify                       # runs all embedded [[tests.*]] fixtures
rtk verify --filter mix-test     # one filter only

Check that all report "passed". Flag and stop if any fail — usually means the user has a custom rtk version with regex differences.

Step 4: Confirm shell hook

Run rtk init zsh (or rtk init bash) to install the transparent rewrite hook that turns mix X into rtk mix X. Re-running is safe (idempotent). Skip this step and mix calls run unfiltered.

Customization

Add custom regex patterns to strip_lines_matching for project-specific noise sources (e.g., third-party hex deps spamming stack traces). See the inline example in ${CLAUDE_SKILL_DIR}/references/rtk-filters.toml lines 57-59.

What this is NOT
  • Not a hook — Claude Code's PostToolUse hooks fire after the tool result is in the transcript and cannot shrink it. rtk works at the subprocess layer (the only layer where transcript-shortening is possible).
  • Not project-analysis — the bundled filter set is universal across Phoenix projects. No mix.exs inspection needed.
  • Not telemetry — rtk has telemetry off by default (enabled = false in config.toml). Filters run locally, no data leaves the machine.
References
  • ${CLAUDE_SKILL_DIR}/references/rtk-filters.toml — bundled filter set
  • ${CLAUDE_SKILL_DIR}/references/install.md — rtk install + shell hook setup
  • rtk on GitHub
按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。