/test-routing
Test RTK command routing without execution (dry-run) - verifies which commands have filters
$ npx -y skills add rtk-ai/rtk --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/test-routing
Context preview
What this command does when you run it.
Test RTK command routing without execution (dry-run) - verifies which commands have filters
Command definition
test-routing.mdmodel: haiku
description: Test RTK command routing without execution (dry-run) - verifies which commands have filters
/test-routing
Vérifie le routing de commandes RTK sans exécution (dry-run). Utile pour tester si une commande a un filtre disponible avant de l'exécuter.
Usage
/test-routing <command> [args...]
Exemples
/test-routing git status
# Output: ✅ RTK filter available: git status → rtk git status
/test-routing npm install
# Output: ⚠️ No RTK filter, would execute raw: npm install
/test-routing cargo test
# Output: ✅ RTK filter available: cargo test → rtk cargo test
Quand utiliser
- **Avant d'exécuter une commande**: Vérifier si RTK a un filtre
- **Debugging hook integration**: Tester le command routing sans side-effects
- **Documentation**: Identifier quelles commandes RTK supporte
- **Testing**: Valider routing logic sans exécuter de vraies commandes
Implémentation
Option 1: Check RTK Help Output
COMMAND="$1"
shift
ARGS="$@"
# Check if RTK has subcommand for this command
if rtk --help | grep -E "^ $COMMAND" >/dev/null 2>&1; then
echo "✅ RTK filter available: $COMMAND $ARGS → rtk $COMMAND $ARGS"
echo ""
echo "Expected behavior:"
echo " - Command will be filtered through RTK"
echo " - Output condensed for token efficiency"
echo " - Exit code preserved from original command"
else
echo "⚠️ No RTK filter available, would execute raw: $COMMAND $ARGS"
echo ""
echo "Expected behavior:"
echo " - Command executed without RTK filtering"
echo " - Full command output (no token savings)"
echo " - Original command behavior unchanged"
fiOption 2: Check RTK Source Code
COMMAND="$1"
shift
ARGS="$@"
# List of supported RTK commands (from src/main.rs)
RTK_COMMANDS=(
"git"
"grep"
"ls"
"read"
"err"
"test"
"log"
"json"
"lint"
"tsc"
"next"
"prettier"
"playwright"
"prisma"
"gh"
"vitest"
"pnpm"
"ruff"
"pytest"
"pip"
"go"
"golangci-lint"
"docker"
"cargo"
"smart"
"summary"
"diff"
"env"
"discover"
"gain"
"proxy"
)
# Check if command in supported list
if [[ " ${RTK_COMMANDS[@]} " =~ " ${COMMAND} " ]]; then
echo "✅ RTK filter available: $COMMAND $ARGS → rtk $COMMAND $ARGS"
echo ""
# Show filter details if available
case "$COMMAND" in
git)
echo "Filter: git operations (status, log, diff, etc.)"
echo "Token savings: 60-80% depending on subcommand"
;;
cargo)
echo "Filter: cargo build/test/clippy output"
echo "Token savings: 80-90% (failures only for tests)"
;;
gh)
echo "Filter: GitHub CLI (pr, issue, run)"
echo "Token savings: 26-87% depending on subcommand"
;;
pnpm)
echo "Filter: pnpm package manager"
echo "Token savings: 70-90% (dependency trees)"
;;
*)
echo "Filter: Available for $COMMAND"
echo "Token savings: 60-90% (typical)"
;;
esac
else
echo "⚠️ No RTK filter available, would execute raw: $COMMAND $ARGS"
echo ""
echo "Note: You can still use 'rtk proxy $COMMAND $ARGS' to:"
echo " - Execute command without filtering"
echo " - Track usage in 'rtk gain --history'"
echo " - Measure potential for new filter development"
fiOption 3: Interactive Mode
COMMAND="$1"
shift
ARGS="$@"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🧪 RTK Command Routing Test"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Command: $COMMAND $ARGS"
echo ""
# Check if RTK installed
if ! command -v rtk >/dev/null 2>&1; then
echo "❌ ERROR: RTK not installed"
echo " Install with: cargo install --path ."
exit 1
fi
# Check RTK version
RTK_VERSION=$(rtk --version 2>/dev/null | awk '{print $2}')
echo "RTK Version: $RTK_VERSION"
echo ""
# Check if command has filter
if rtk --help | grep -E "^ $COMMAND" >/dev/null 2>&1; then
echo "✅ Filter: Available"
echo ""
echo "Routing:"
echo " Input: $COMMAND $ARGS"
echo " Route: rtk $COMMAND $ARGS"
echo " Filter: Applied"
echo ""
# Estimate token savings (based on historical data)
case "$COMMAND" in
git)
echo "Expected Token Savings: 60-80%"
echo "Startup Time: <10ms"
;;
cargo)
echo "Expected Token Savings: 80-90%"
echo "Startup Time: <10ms"
;;
gh)
echo "Expected Token Savings: 26-87%"
echo "Startup Time: <10ms"
;;
*)
echo "Expected Token Savings: 60-90%"
echo "Startup Time: <10ms"
;;
esac
else
echo "⚠️ Filter: Not available"
echo ""
echo "Routing:"
echo " Input: $COMMAND $ARGS"
echo " Route: $COMMAND $ARGS (raw, no RTK)"
echo " Filter: None"
echo ""
echo "Alternatives:"
echo " - Use 'rtk proxy $COMMAND $ARGS' to track usage"
echo " - Consider contributing a filter for this command"
fi
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"Expected Output
Cas 1: Commande avec filtre
/test-routing git status
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🧪 RTK Command Routing Test
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Command: git status
RTK Version: 0.16.0
✅ Filter: Available
Routing:
Input: git status
Route: rtk git status
Filter: Applied
Expected Token Savings: 60-80%
Startup Time: <10ms
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Cas 2: Commande sans filtre
/test-routing npm install express
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🧪 RTK Command Routing Test
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Command: npm i
Read more
model: haiku description: Test RTK command routing without execution (dry-run) - verifies which commands have filters
/test-routing
Vérifie le routing de commandes RTK sans exécution (dry-run). Utile pour tester si une commande a un filtre disponible avant de l'exécuter.
Usage
/test-routing <command> [args...]
Exemples
/test-routing git status # Output: ✅ RTK filter available: git status → rtk git status /test-routing npm install # Output: ⚠️ No RTK filter, would execute raw: npm install /test-routing cargo test # Output: ✅ RTK filter available: cargo test → rtk cargo test
Quand utiliser
- **Avant d'exécuter une commande**: Vérifier si RTK a un filtre
- **Debugging hook integration**: Tester le command routing sans side-effects
- **Documentation**: Identifier quelles commandes RTK supporte
- **Testing**: Valider routing logic sans exécuter de vraies commandes
Implémentation
Option 1: Check RTK Help Output
COMMAND="$1"
shift
ARGS="$@"
# Check if RTK has subcommand for this command
if rtk --help | grep -E "^ $COMMAND" >/dev/null 2>&1; then
echo "✅ RTK filter available: $COMMAND $ARGS → rtk $COMMAND $ARGS"
echo ""
echo "Expected behavior:"
echo " - Command will be filtered through RTK"
echo " - Output condensed for token efficiency"
echo " - Exit code preserved from original command"
else
echo "⚠️ No RTK filter available, would execute raw: $COMMAND $ARGS"
echo ""
echo "Expected behavior:"
echo " - Command executed without RTK filtering"
echo " - Full command output (no token savings)"
echo " - Original command behavior unchanged"
fiOption 2: Check RTK Source Code
COMMAND="$1"
shift
ARGS="$@"
# List of supported RTK commands (from src/main.rs)
RTK_COMMANDS=(
"git"
"grep"
"ls"
"read"
"err"
"test"
"log"
"json"
"lint"
"tsc"
"next"
"prettier"
"playwright"
"prisma"
"gh"
"vitest"
"pnpm"
"ruff"
"pytest"
"pip"
"go"
"golangci-lint"
"docker"
"cargo"
"smart"
"summary"
"diff"
"env"
"discover"
"gain"
"proxy"
)
# Check if command in supported list
if [[ " ${RTK_COMMANDS[@]} " =~ " ${COMMAND} " ]]; then
echo "✅ RTK filter available: $COMMAND $ARGS → rtk $COMMAND $ARGS"
echo ""
# Show filter details if available
case "$COMMAND" in
git)
echo "Filter: git operations (status, log, diff, etc.)"
echo "Token savings: 60-80% depending on subcommand"
;;
cargo)
echo "Filter: cargo build/test/clippy output"
echo "Token savings: 80-90% (failures only for tests)"
;;
gh)
echo "Filter: GitHub CLI (pr, issue, run)"
echo "Token savings: 26-87% depending on subcommand"
;;
pnpm)
echo "Filter: pnpm package manager"
echo "Token savings: 70-90% (dependency trees)"
;;
*)
echo "Filter: Available for $COMMAND"
echo "Token savings: 60-90% (typical)"
;;
esac
else
echo "⚠️ No RTK filter available, would execute raw: $COMMAND $ARGS"
echo ""
echo "Note: You can still use 'rtk proxy $COMMAND $ARGS' to:"
echo " - Execute command without filtering"
echo " - Track usage in 'rtk gain --history'"
echo " - Measure potential for new filter development"
fiOption 3: Interactive Mode
COMMAND="$1"
shift
ARGS="$@"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🧪 RTK Command Routing Test"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "Command: $COMMAND $ARGS"
echo ""
# Check if RTK installed
if ! command -v rtk >/dev/null 2>&1; then
echo "❌ ERROR: RTK not installed"
echo " Install with: cargo install --path ."
exit 1
fi
# Check RTK version
RTK_VERSION=$(rtk --version 2>/dev/null | awk '{print $2}')
echo "RTK Version: $RTK_VERSION"
echo ""
# Check if command has filter
if rtk --help | grep -E "^ $COMMAND" >/dev/null 2>&1; then
echo "✅ Filter: Available"
echo ""
echo "Routing:"
echo " Input: $COMMAND $ARGS"
echo " Route: rtk $COMMAND $ARGS"
echo " Filter: Applied"
echo ""
# Estimate token savings (based on historical data)
case "$COMMAND" in
git)
echo "Expected Token Savings: 60-80%"
echo "Startup Time: <10ms"
;;
cargo)
echo "Expected Token Savings: 80-90%"
echo "Startup Time: <10ms"
;;
gh)
echo "Expected Token Savings: 26-87%"
echo "Startup Time: <10ms"
;;
*)
echo "Expected Token Savings: 60-90%"
echo "Startup Time: <10ms"
;;
esac
else
echo "⚠️ Filter: Not available"
echo ""
echo "Routing:"
echo " Input: $COMMAND $ARGS"
echo " Route: $COMMAND $ARGS (raw, no RTK)"
echo " Filter: None"
echo ""
echo "Alternatives:"
echo " - Use 'rtk proxy $COMMAND $ARGS' to track usage"
echo " - Consider contributing a filter for this command"
fi
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"Expected Output
Cas 1: Commande avec filtre
/test-routing git status ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🧪 RTK Command Routing Test ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Command: git status RTK Version: 0.16.0 ✅ Filter: Available Routing: Input: git status Route: rtk git status Filter: Applied Expected Token Savings: 60-80% Startup Time: <10ms ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Cas 2: Commande sans filtre
/test-routing npm install express ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🧪 RTK Command Routing Test ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Command: npm i
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
Repo: rtk-ai/rtk
Other commands on rtk.
- /clean-worktree
Interactive cleanup of stale worktrees (merged branches, orphaned refs)
Open command - /clean-worktrees
Clean all merged worktrees automatically (no interaction)
Open command - /diagnose
RTK environment diagnostics - Checks installation, hooks, version, command routing
Open command - /audit-codebase
RTK Codebase Health Audit — 7 catégories scorées 0-10
Open command - /codereview
RTK Code Review — Review locale pre-PR avec auto-fix
Open command - /remove-worktree
Remove a specific worktree (directory + git reference + branch)
Open command

