|
1 | | -<!-- rtk-instructions v2 --> |
2 | | -# RTK (Rust Token Killer) - Token-Optimized Commands |
3 | | - |
4 | | -## Golden Rule |
5 | | - |
6 | | -**Always prefix commands with `rtk`**. If RTK has a dedicated filter, it uses it. If not, it passes through unchanged. This means RTK is always safe to use. |
7 | | - |
8 | | -**Important**: Even in command chains with `&&`, use `rtk`: |
9 | | - |
10 | | -```bash |
11 | | -# ❌ Wrong |
12 | | -git add . && git commit -m "msg" && git push |
13 | | - |
14 | | -# ✅ Correct |
15 | | -rtk git add . && rtk git commit -m "msg" && rtk git push |
16 | | -``` |
17 | | - |
18 | | -## RTK Commands by Workflow |
19 | | - |
20 | | -### Build & Compile (80-90% savings) |
21 | | - |
22 | | -```bash |
23 | | -rtk cargo build # Cargo build output |
24 | | -rtk cargo check # Cargo check output |
25 | | -rtk cargo clippy # Clippy warnings grouped by file (80%) |
26 | | -rtk tsc # TypeScript errors grouped by file/code (83%) |
27 | | -rtk lint # ESLint/Biome violations grouped (84%) |
28 | | -rtk prettier --check # Files needing format only (70%) |
29 | | -rtk next build # Next.js build with route metrics (87%) |
30 | | -``` |
31 | | - |
32 | | -### Test (90-99% savings) |
33 | | - |
34 | | -```bash |
35 | | -rtk cargo test # Cargo test failures only (90%) |
36 | | -rtk vitest run # Vitest failures only (99.5%) |
37 | | -rtk playwright test # Playwright failures only (94%) |
38 | | -rtk test <cmd> # Generic test wrapper - failures only |
39 | | -``` |
40 | | - |
41 | | -### Git (59-80% savings) |
42 | | - |
43 | | -```bash |
44 | | -rtk git status # Compact status |
45 | | -rtk git log # Compact log (works with all git flags) |
46 | | -rtk git diff # Compact diff (80%) |
47 | | -rtk git show # Compact show (80%) |
48 | | -rtk git add # Ultra-compact confirmations (59%) |
49 | | -rtk git commit # Ultra-compact confirmations (59%) |
50 | | -rtk git push # Ultra-compact confirmations |
51 | | -rtk git pull # Ultra-compact confirmations |
52 | | -rtk git branch # Compact branch list |
53 | | -rtk git fetch # Compact fetch |
54 | | -rtk git stash # Compact stash |
55 | | -rtk git worktree # Compact worktree |
56 | | -``` |
57 | | - |
58 | | -Note: Git passthrough works for ALL subcommands, even those not explicitly listed. |
59 | | - |
60 | | -### GitHub (26-87% savings) |
61 | | - |
62 | | -```bash |
63 | | -rtk gh pr view <num> # Compact PR view (87%) |
64 | | -rtk gh pr checks # Compact PR checks (79%) |
65 | | -rtk gh run list # Compact workflow runs (82%) |
66 | | -rtk gh issue list # Compact issue list (80%) |
67 | | -rtk gh api # Compact API responses (26%) |
68 | | -``` |
69 | | - |
70 | | -### JavaScript/TypeScript Tooling (70-90% savings) |
71 | | - |
72 | | -```bash |
73 | | -rtk pnpm list # Compact dependency tree (70%) |
74 | | -rtk pnpm outdated # Compact outdated packages (80%) |
75 | | -rtk pnpm install # Compact install output (90%) |
76 | | -rtk npm run <script> # Compact npm script output |
77 | | -rtk npx <cmd> # Compact npx command output |
78 | | -rtk prisma # Prisma without ASCII art (88%) |
79 | | -``` |
80 | | - |
81 | | -### Files & Search (60-75% savings) |
82 | | - |
83 | | -```bash |
84 | | -rtk ls <path> # Tree format, compact (65%) |
85 | | -rtk read <file> # Code reading with filtering (60%) |
86 | | -rtk grep <pattern> # Search grouped by file (75%) |
87 | | -rtk find <pattern> # Find grouped by directory (70%) |
88 | | -``` |
89 | | - |
90 | | -### Analysis & Debug (70-90% savings) |
91 | | - |
92 | | -```bash |
93 | | -rtk err <cmd> # Filter errors only from any command |
94 | | -rtk log <file> # Deduplicated logs with counts |
95 | | -rtk json <file> # JSON structure without values |
96 | | -rtk deps # Dependency overview |
97 | | -rtk env # Environment variables compact |
98 | | -rtk summary <cmd> # Smart summary of command output |
99 | | -rtk diff # Ultra-compact diffs |
100 | | -``` |
101 | | - |
102 | | -### Infrastructure (85% savings) |
103 | | - |
104 | | -```bash |
105 | | -rtk docker ps # Compact container list |
106 | | -rtk docker images # Compact image list |
107 | | -rtk docker logs <c> # Deduplicated logs |
108 | | -rtk kubectl get # Compact resource list |
109 | | -rtk kubectl logs # Deduplicated pod logs |
110 | | -``` |
111 | | - |
112 | | -### Network (65-70% savings) |
113 | | - |
114 | | -```bash |
115 | | -rtk curl <url> # Compact HTTP responses (70%) |
116 | | -rtk wget <url> # Compact download output (65%) |
117 | | -``` |
118 | | - |
119 | | -### Meta Commands |
120 | | - |
121 | | -```bash |
122 | | -rtk gain # View token savings statistics |
123 | | -rtk gain --history # View command history with savings |
124 | | -rtk discover # Analyze Claude Code sessions for missed RTK usage |
125 | | -rtk proxy <cmd> # Run command without filtering (for debugging) |
126 | | -rtk init # Add RTK instructions to CLAUDE.md |
127 | | -rtk init --global # Add RTK to ~/.claude/CLAUDE.md |
128 | | -``` |
129 | | - |
130 | | -## Token Savings Overview |
131 | | - |
132 | | -| Category | Commands | Typical Savings | |
133 | | -|----------|----------|-----------------| |
134 | | -| Tests | vitest, playwright, cargo test | 90-99% | |
135 | | -| Build | next, tsc, lint, prettier | 70-87% | |
136 | | -| Git | status, log, diff, add, commit | 59-80% | |
137 | | -| GitHub | gh pr, gh run, gh issue | 26-87% | |
138 | | -| Package Managers | pnpm, npm, npx | 70-90% | |
139 | | -| Files | ls, read, grep, find | 60-75% | |
140 | | -| Infrastructure | docker, kubectl | 85% | |
141 | | -| Network | curl, wget | 65-70% | |
142 | | - |
143 | | -Overall average: **60-90% token reduction** on common development operations. |
144 | | -<!-- /rtk-instructions --> |
0 commit comments