skills/rtk/SKILL.md
RTK (Rust Token Killer) setup, configuration, and usage. Use when setting up RTK in a project, configuring custom filters, optimizing agent token usage, or troubleshooting RTK hooks and rewrites.
npx skillsauth add oornnery/.agents rtkInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
CLI proxy reduces LLM token consumption 60-90% on dev commands. Intercepts command output (git, test runners, linters, build tools), returns only essential info to agent context window.
brew install rtk # macOS (Homebrew)
cargo install rtk-ai # From crates.io
Verify correct binary (name collision with another rtk package):
rtk --version # Should show "rtk 0.31.0" or newer
rtk gain # Should show token savings (NOT "command not found")
Use rtk init -g for hook-based integration. Recommended approach -- transparently rewrites commands with zero manual effort:
rtk init -g
Installs:
~/.claude/hooks/rtk-rewrite.sh — PreToolUse hook rewrites Bash commands through rtk hook~/.claude/RTK.md — slim reference (10 lines, minimal token cost)~/.claude/settings.jsonAfter setup, all agent Bash commands auto-rewritten. Example: git status becomes rtk git status transparently.
rtk init --agent cursor # Cursor
rtk init --codex # Codex CLI (base + variants)
Windsurf and Cline use rules files (.windsurfrules, .clinerules) generated by rtk init.
rtk init -g --uninstall
Hook intercepts PreToolUse Bash events, rewrites commands via rtk rewrite, returns compressed output. Strategies: filtering (ANSI, boilerplate), grouping (errors by rule), truncation, deduplication.
Run directly -- never through proxy:
rtk gain # Token savings dashboard
rtk gain --history # Per-command history with savings %
rtk gain --graph # Visual savings graph
rtk gain --project # Scoped to current project
rtk discover # Scan agent history for missed optimizations
rtk learn # Detect project patterns, suggest optimizations
rtk session # Adoption overview
rtk proxy <cmd> # Run raw command (no filtering), still tracked
rtk rewrite "<cmd>" # Preview what a command would be rewritten to
rtk config # Show current configuration
rtk verify # Integrity check
rtk hook-audit # Audit hook installations
~/.config/rtk/config.toml:
[tracking]
history_days = 90
[display]
colors = true
max_width = 120
[filters]
ignore_dirs = [".git", "node_modules", "target", "__pycache__", ".venv"]
[hooks]
exclude = [] # commands to skip rewriting
Use [hooks] exclude to bypass rewriting where raw output needed.
Declarative filter pipelines for commands RTK doesn't cover natively.
Project-local: .rtk/filters.toml (requires rtk trust for security)
User-global: ~/.config/rtk/filters.toml
Example -- compress Terraform plan output:
[filters.terraform-plan]
command = "terraform"
subcommand = "plan"
strip_ansi = true
strip_lines_matching = ["Refreshing state...", "Reading...", "data\\."]
truncate_lines_at = 200
max_lines = 100
on_empty = "No changes detected"
[[filters.terraform-plan.replace]]
pattern = "Plan: (\\d+) to add"
replacement = "+$1"
[[tests.terraform-plan]]
input = "Refreshing state...\nPlan: 3 to add"
expected = "+3"
Pipeline stages (applied sequentially):
strip_ansi — remove escape codesreplace — regex substitutions (chainable)match_output — short-circuit if pattern matches (with unless)strip_lines_matching / keep_lines_matching — filter lines by regextruncate_lines_at — limit line lengthhead_lines / tail_lines — retain first/last N linesmax_lines — absolute line capon_empty — fallback message if result emptyProject-local .rtk/filters.toml requires explicit trust:
rtk trust # Trust current project's filters
rtk untrust # Revoke trust
RTK_TOML_DEBUG=1 rtk <cmd> # Log matched filters to stderr
RTK_DISABLED=1 <cmd> # Bypass RTK entirely
RTK_NO_TOML=1 rtk <cmd> # Bypass TOML filters only
rtk proxy <cmd> # Run raw, still track usage
rtk read filter levels: NoFilter (unchanged), MinimalFilter (strips comments/blanks), AggressiveFilter (imports + signatures only). Data formats (JSON, YAML, TOML) bypass aggressive filtering.
rtk init -g for global hook -- most transparentrtk gain regularly, rtk discover for missed opportunitiesrtk proxy <cmd> for full unfiltered output[[tests]] in custom filters~/.local/share/rtk/tee/development
--- name: verification description: Discover and run project validation gates: format, lint, typecheck, LSP diagnostics, tests, build, static security checks, dependency audits, and RTK output handling. Use before claiming work is complete, when fixing broken checks, or when setting up a validation plan. --- # Verification Use this skill to prove changes with the strongest practical checks the repo already supports. ## Discovery Order 1. Read task aliases: `package.json`, `pyproject.toml`, `
tools
Build, review, or validate standalone Python scripts run with uv inline metadata. Use for one-file automation, operational scripts, script dependencies, shebangs, idempotency, safety, representative runs, and promoting scripts to packages.
development
Build, review, or validate Python packages and libraries where public API stability, packaging metadata, imports, examples, changelogs, build output, and compatibility matter.
tools
Build, review, or validate Python command-line applications and terminal tools. Use for argparse, Typer, Rich, Textual-adjacent CLI UX, stdout/stderr contracts, exit codes, automation-friendly flags, help output, and CLI tests.