rtk-token-optimizer
```markdown
What this skill does
```markdown --- name: rtk-token-optimizer description: CLI proxy that reduces LLM token consumption by 60-90% on common dev commands using a single Rust binary triggers: - reduce token usage with rtk - install rtk for claude code - rtk token savings setup - optimize llm context with rtk - rtk git status compact output - set up rtk hook for ai coding - rtk command not working - how to use rtk with cursor or windsurf --- # RTK Token Optimizer > Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection. RTK is a high-performance CLI proxy written in Rust that intercepts common dev commands (`git`, `ls`, `cargo test`, `pytest`, etc.) and compresses their output before it reaches your LLM context window. A single static binary with zero runtime dependencies adds less than 10ms overhead while cutting token usage by 60–90%. --- ## Installation ### Homebrew (recommended) ```bash brew install rtk ``` ### Quick install (Linux/macOS) ```bash curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh # Add to PATH if needed: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc ``` ### Cargo (from source) ```bash cargo install --git https://github.com/rtk-ai/rtk ``` ### Verify ```bash rtk --version # rtk 0.28.2 rtk gain # shows token savings stats ``` > **Crates.io collision**: A different package called "rtk" exists on crates.io. Always use `--git` with cargo. --- ## Hook Setup (Auto-Rewrite) The hook transparently rewrites Bash tool calls (e.g., `git status` → `rtk git status`) before execution. Claude never sees the rewrite — it just receives compressed output. ```bash rtk init -g # Claude Code / Copilot (global, recommended) rtk init -g --gemini # Gemini CLI rtk init -g --codex # Codex / OpenAI rtk init -g --agent cursor # Cursor rtk init --agent windsurf # Windsurf (project-scoped) rtk init --agent cline # Cline / Roo Code (project-scoped) rtk init -g --opencode # OpenCode plugin rtk init -g --auto-patch # Non-interactive (CI/CD) rtk init --show # Verify current installation ``` **After installing, restart your AI tool.** > **Scope**: The hook only applies to Bash tool calls. Claude Code built-in tools (`Read`, `Grep`, `Glob`) bypass it. Use shell equivalents (`cat`, `rg`, `find`) or explicit `rtk` commands for those workflows. --- ## Core Commands ### Files ```bash rtk ls . # Token-optimized directory tree rtk read src/main.rs # Smart file reading rtk read src/main.rs -l aggressive # Signatures only (strips function bodies) rtk smart src/main.rs # 2-line heuristic code summary rtk find "*.rs" . # Compact find results rtk grep "fn parse" src/ # Grouped search results rtk diff file1.rs file2.rs # Condensed diff ``` ### Git ```bash rtk git status # Compact status (~200 tokens vs ~2000) rtk git log -n 10 # One-line commits rtk git diff # Condensed diff rtk git add . # Output: "ok" rtk git commit -m "fix: parse" # Output: "ok abc1234" rtk git push # Output: "ok main" rtk git pull # Output: "ok 3 files +10 -2" ``` ### Test Runners ```bash rtk cargo test # Rust — failures only (-90%) rtk test cargo test # Explicit test wrapper rtk pytest # Python — failures only (-90%) rtk go test # Go — NDJSON compact (-90%) rtk rspec # Ruby — JSON compact (-60%+) rtk vitest run # Vitest — failures only rtk playwright test # E2E — failures only rtk rake test # Ruby minitest (-90%) ``` ### Build & Lint ```bash rtk cargo build # Rust build (-80%) rtk cargo clippy # Clippy warnings grouped (-80%) rtk tsc # TypeScript errors by file rtk lint # ESLint grouped by rule/file rtk lint biome # Biome linter rtk ruff check # Python lint (JSON, -80%) rtk golangci-lint run # Go lint (JSON, -85%) rtk rubocop # Ruby lint (JSON, -60%+) rtk next build # Next.js compact build output rtk prettier --check . # Files needing formatting only ``` ### GitHub CLI ```bash rtk gh pr list # Compact PR listing rtk gh pr view 42 # PR details + check status rtk gh issue list # Compact issue listing rtk gh run list # Workflow run status ``` ### Containers & Infra ```bash rtk docker ps # Compact container list rtk docker images # Compact image list rtk docker logs <container> # Deduplicated log lines rtk docker compose ps # Compose services rtk kubectl pods # Compact pod list rtk kubectl logs <pod> # Deduplicated pod logs rtk kubectl services # Compact service list ``` ### Data & Utilities ```bash rtk json config.json # Structure without values (schema view) rtk env -f AWS # Filtered env vars (e.g., AWS_*) rtk log app.log # Deduplicated application logs rtk curl https://api.example.com # Auto-detect JSON + print schema rtk deps # Dependency summary rtk summary <long command> # Heuristic summary of any command rtk proxy <command> # Raw passthrough + token tracking ``` ### Package Managers ```bash rtk pnpm list # Compact dependency tree rtk pip list # Python packages (auto-detects uv) rtk pip outdated # Outdated packages only rtk bundle install # Ruby gems (strips "Using" lines) rtk prisma generate # Schema generation (no ASCII art) ``` --- ## Global Flags ```bash rtk -u <command> # --ultra-compact: ASCII icons, inline format rtk -v <command> # --verbose (stack: -v, -vv, -vvv) ``` --- ## Token Savings Analytics ```bash rtk gain # Summary stats rtk gain --graph # ASCII graph (last 30 days) rtk gain --history # Recent command history with savings rtk gain --daily # Day-by-day breakdown rtk gain --all --format json # JSON export for dashboards rtk discover # Find missed savings opportunities rtk discover --all --since 7 # All projects, last 7 days rtk session # RTK adoption across recent sessions ``` --- ## Real-World Usage Patterns ### Pattern 1: Rust project CI loop ```bash # Instead of: cargo test 2>&1 (200+ lines on failure) rtk cargo test # Output (~20 lines): # FAILED: 2/15 tests # test_edge_case: assertion failed at utils.rs:42 # test_overflow: panic at utils.rs:18 rtk cargo clippy # Output: grouped warnings by lint rule, not raw rustc noise ``` ### Pattern 2: Python project ```bash rtk pytest # Only failing tests + tracebacks rtk ruff check # JSON-parsed, grouped by rule rtk pip outdated # Table of outdated packages only ``` ### Pattern 3: Node/TypeScript project ```bash rtk tsc # TypeScript errors grouped by file rtk lint # ESLint violations grouped by rule rtk next build # Next.js build, key metrics only rtk vitest run # Failures only, not 300 "✓ pass" lines ``` ### Pattern 4: Reading large files intelligently ```bash # Full file (smart truncation) rtk read src/lib.rs # Signatures only — ideal for understanding module structure rtk read src/lib.rs -l aggressive # 2-line summary heuristic rtk smart src/lib.rs ``` ### Pattern 5: Git workflow in AI sessions ```bash rtk git status
Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.