rtk-optimizer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

RTK Optimizer Skill

RTK优化器Skill

Purpose: Automatically suggest RTK wrappers for high-verbosity commands to reduce token consumption.
用途:自动为高冗余度命令推荐RTK包装器,以减少Token消耗。

How It Works

工作原理

  1. Detect high-verbosity commands in user requests
  2. Suggest RTK wrapper if applicable
  3. Execute with RTK when user confirms
  4. Track savings over session
  1. 检测用户请求中的高冗余度命令
  2. 若适用则推荐RTK包装器
  3. 用户确认后使用RTK执行
  4. 在会话期间跟踪Token节省量

Supported Commands

支持的命令

Git (>70% reduction)

Git(缩减率>70%)

  • git log
    rtk git log
    (92.3% reduction)
  • git status
    rtk git status
    (76.0% reduction)
  • find
    rtk find
    (76.3% reduction)
  • git log
    rtk git log
    (缩减率92.3%)
  • git status
    rtk git status
    (缩减率76.0%)
  • find
    rtk find
    (缩减率76.3%)

Medium-Value (50-70% reduction)

中等缩减率(50-70%)

  • git diff
    rtk git diff
    (55.9% reduction)
  • cat <large-file>
    rtk read <file>
    (62.5% reduction)
  • git diff
    rtk git diff
    (缩减率55.9%)
  • cat <large-file>
    rtk read <file>
    (缩减率62.5%)

JS/TS Stack (70-90% reduction)

JS/TS技术栈(70-90%缩减率)

  • pnpm list
    rtk pnpm list
    (82% reduction)
  • pnpm test
    /
    vitest run
    rtk vitest run
    (90% reduction)
  • pnpm list
    rtk pnpm list
    (缩减率82%)
  • pnpm test
    /
    vitest run
    rtk vitest run
    (缩减率90%)

Rust Toolchain (80-90% reduction)

Rust工具链(80-90%缩减率)

  • cargo test
    rtk cargo test
    (90% reduction)
  • cargo build
    rtk cargo build
    (80% reduction)
  • cargo clippy
    rtk cargo clippy
    (80% reduction)
  • cargo test
    rtk cargo test
    (缩减率90%)
  • cargo build
    rtk cargo build
    (缩减率80%)
  • cargo clippy
    rtk cargo clippy
    (缩减率80%)

Python & Go (90% reduction)

Python & Go(90%缩减率)

  • pytest
    rtk python pytest
    (90% reduction)
  • go test
    rtk go test
    (90% reduction)
  • pytest
    rtk python pytest
    (缩减率90%)
  • go test
    rtk go test
    (缩减率90%)

GitHub CLI (79-87% reduction)

GitHub CLI(79-87%缩减率)

  • gh pr view
    rtk gh pr view
    (87% reduction)
  • gh pr checks
    rtk gh pr checks
    (79% reduction)
  • gh pr view
    rtk gh pr view
    (缩减率87%)
  • gh pr checks
    rtk gh pr checks
    (缩减率79%)

File Operations

文件操作

  • ls
    rtk ls
    (condensed output)
  • grep
    rtk grep
    (filtered output)
  • ls
    rtk ls
    (精简输出)
  • grep
    rtk grep
    (过滤后输出)

Activation Examples

激活示例

User: "Show me the git history" Skill: Detects
git log
→ Suggests
rtk git log
→ Explains 92.3% token savings
User: "Find all markdown files" Skill: Detects
find
→ Suggests
rtk find "*.md" .
→ Explains 76.3% savings
用户:"显示Git提交历史" Skill:检测到
git log
→ 推荐
rtk git log
→ 说明可节省92.3%的Token
用户:"查找所有Markdown文件" Skill:检测到
find
→ 推荐
rtk find "*.md" .
→ 说明可节省76.3%的Token

Installation Check

安装检查

Before first use, verify RTK is installed:
bash
rtk --version  # Should output: rtk 0.16.0+
If not installed:
bash
undefined
首次使用前,请确认已安装RTK:
bash
rtk --version  # 应输出:rtk 0.16.0+
若未安装:
bash
undefined

Homebrew (macOS/Linux)

Homebrew(macOS/Linux)

brew install rtk-ai/tap/rtk
brew install rtk-ai/tap/rtk

Cargo (all platforms)

Cargo(全平台)

cargo install rtk
undefined
cargo install rtk
undefined

Usage Pattern

使用模式

markdown
undefined
markdown
undefined

When user requests high-verbosity command:

当用户请求高冗余度命令时:

  1. Acknowledge request
  2. Suggest RTK optimization: "I'll use
    rtk git log
    to reduce token usage by ~92%"
  3. Execute RTK command
  4. Track savings (optional): "Saved ~13K tokens (baseline: 14K, RTK: 1K)"
undefined
  1. 确认用户请求
  2. 推荐RTK优化方案: "我将使用
    rtk git log
    来减少约92%的Token消耗"
  3. 执行RTK命令
  4. 跟踪节省量(可选): "已节省约13K Token(基准值:14K,RTK后:1K)"
undefined

Session Tracking

会话跟踪

Optional: Track cumulative savings across session:
bash
undefined
可选:跟踪会话期间的累计Token节省量:
bash
undefined

At session end

会话结束时

rtk gain # Shows total token savings for session (SQLite-backed)
undefined
rtk gain # 显示会话期间的总Token节省量(基于SQLite存储)
undefined

Edge Cases

边缘情况

  • Small outputs (<100 chars): Skip RTK (overhead not worth it)
  • Already using Claude tools: Grep/Read tools are already optimized
  • Multiple commands: Batch with RTK wrapper once, not per command
  • 小输出内容(<100字符):跳过RTK(开销得不偿失)
  • 已使用Claude工具:Grep/Read工具已做优化
  • 多条命令:一次性用RTK包装器批量处理,而非逐个命令处理

Configuration

配置

Enable via CLAUDE.md:
markdown
undefined
通过CLAUDE.md启用:
markdown
undefined

Token Optimization

Token优化

Use RTK (Rust Token Killer) for high-verbosity commands:
  • git operations (log, status, diff)
  • package managers (pnpm, npm)
  • build tools (cargo, go)
  • test frameworks (vitest, pytest)
  • file finding and reading
undefined
对以下高冗余度命令使用RTK(Rust Token Killer):
  • Git操作(log、status、diff)
  • 包管理器(pnpm、npm)
  • 构建工具(cargo、go)
  • 测试框架(vitest、pytest)
  • 文件查找与读取
undefined

Metrics (Verified)

验证指标

Based on real-world testing:
  • git log
    : 13,994 chars → 1,076 chars (92.3% reduction)
  • git status
    : 100 chars → 24 chars (76.0% reduction)
  • find
    : 780 chars → 185 chars (76.3% reduction)
  • git diff
    : 15,815 chars → 6,982 chars (55.9% reduction)
  • read file
    : 163,587 chars → 61,339 chars (62.5% reduction)
Average: 72.6% token reduction
基于真实场景测试:
  • git log
    :13,994字符 → 1,076字符(缩减率92.3%)
  • git status
    :100字符 → 24字符(缩减率76.0%)
  • find
    :780字符 → 185字符(缩减率76.3%)
  • git diff
    :15,815字符 → 6,982字符(缩减率55.9%)
  • read file
    :163,587字符 → 61,339字符(缩减率62.5%)
平均缩减率:72.6%

Limitations

局限性

  • 446 stars on GitHub, actively maintained (30 releases in 23 days)
  • Not suitable for interactive commands
  • Rapid development cadence (check for breaking changes)
  • GitHub上拥有446星,维护活跃(23天内发布30个版本)
  • 不适用于交互式命令
  • 开发节奏快(需注意破坏性更新)

Recommendation

使用建议

Use RTK for: git workflows, file operations, test frameworks, build tools, package managers Skip RTK for: small outputs, quick exploration, interactive commands
推荐使用RTK的场景:Git工作流、文件操作、测试框架、构建工具、包管理器 不推荐使用RTK的场景:小输出内容、快速探索、交互式命令

References

参考资料