clean-worktree
Interactive cleanup of stale worktrees (merged branches, orphaned refs)
RTK environment diagnostics - Checks installation, hooks, version, command routing
$ npx -y skills add rtk-ai/rtk --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
/diagnoseContext preview
What this command does when you run it.
RTK environment diagnostics - Checks installation, hooks, version, command routing
model: haiku description: RTK environment diagnostics - Checks installation, hooks, version, command routing
Vérifie l'état de l'environnement RTK et suggère des corrections.
Lancer ces commandes en parallèle :
# RTK installation check which rtk && rtk --version || echo "❌ RTK not found in PATH"
# Git status (verify working directory) git status --short && git branch --show-current
# Hook configuration check
if [ -f ".claude/hooks/rtk-rewrite.sh" ]; then
echo "✅ OK: rtk-rewrite.sh hook present"
# Check if hook is executable
if [ -x ".claude/hooks/rtk-rewrite.sh" ]; then
echo "✅ OK: hook is executable"
else
echo "⚠️ WARNING: hook not executable (chmod +x needed)"
fi
else
echo "❌ MISSING: rtk-rewrite.sh hook"
fi# Hook rtk-suggest.sh check
if [ -f ".claude/hooks/rtk-suggest.sh" ]; then
echo "✅ OK: rtk-suggest.sh hook present"
if [ -x ".claude/hooks/rtk-suggest.sh" ]; then
echo "✅ OK: hook is executable"
else
echo "⚠️ WARNING: hook not executable (chmod +x needed)"
fi
else
echo "❌ MISSING: rtk-suggest.sh hook"
fi# Claude Code context check
if [ -n "$CLAUDE_CODE_HOOK_BASH_TEMPLATE" ]; then
echo "✅ OK: Running in Claude Code context"
echo " Hook env var set: CLAUDE_CODE_HOOK_BASH_TEMPLATE"
else
echo "⚠️ WARNING: Not running in Claude Code (hooks won't activate)"
echo " CLAUDE_CODE_HOOK_BASH_TEMPLATE not set"
fi# Test command routing (dry-run)
if command -v rtk >/dev/null 2>&1; then
# Test if rtk gain works (validates install)
if rtk --help | grep -q "gain"; then
echo "✅ OK: rtk gain available"
else
echo "❌ MISSING: rtk gain command (old version or wrong binary)"
fi
else
echo "❌ RTK binary not found"
fi# Run rtk gain to verify analytics work
if command -v rtk >/dev/null 2>&1; then
echo ""
echo "📊 Token Savings (last 5 commands):"
rtk gain --history 2>&1 | head -8 || echo "⚠️ rtk gain failed"
else
echo "⚠️ Cannot test rtk gain (binary not installed)"
fi# Only run if we're in RTK repository
if [ -f "Cargo.toml" ] && grep -q 'name = "rtk"' Cargo.toml 2>/dev/null; then
echo ""
echo "🦀 RTK Repository Quality Checks:"
# Check if cargo fmt passes
if cargo fmt --all --check >/dev/null 2>&1; then
echo "✅ OK: cargo fmt (code formatted)"
else
echo "⚠️ WARNING: cargo fmt needed"
fi
# Check if cargo clippy would pass (don't run full check, just verify binary)
if command -v cargo-clippy >/dev/null 2>&1 || cargo clippy --version >/dev/null 2>&1; then
echo "✅ OK: cargo clippy available"
else
echo "⚠️ WARNING: cargo clippy not installed"
fi
else
echo "ℹ️ Not in RTK repository (skipping quality checks)"
fi━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔍 RTK Environment Diagnostic
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📦 RTK Binary: ✅ OK (v0.16.0) | ❌ NOT FOUND
🔗 Hooks: ✅ OK (rtk-rewrite.sh + rtk-suggest.sh executable)
❌ MISSING or ⚠️ WARNING (not executable)
📊 Token Analytics: ✅ OK (rtk gain working)
❌ FAILED (command not available)
🎯 Claude Context: ✅ OK (hook environment detected)
⚠️ WARNING (not in Claude Code)
🦀 Code Quality: ✅ OK (fmt + clippy ready) [if in RTK repo]
⚠️ WARNING (needs formatting/clippy)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━Utiliser `AskUserQuestion` si problèmes détectés :
question: "Problèmes détectés. Quelles corrections appliquer ?"
header: "Fixes"
multiSelect: true
options:
- label: "cargo install --path ."
description: "Installer RTK localement depuis le repo"
- label: "chmod +x .claude/hooks/bash/*.sh"
description: "Rendre les hooks exécutables"
- label: "Tout corriger (recommandé)"
description: "Install RTK + fix hooks permissions"**Adaptations selon contexte** :
options:
- label: "cargo install --path ."
description: "Installer RTK localement (si dans le repo)"
- label: "cargo install rtk"
description: "Installer RTK depuis crates.io (dernière release)"
- label: "brew install rtk-ai/tap/rtk"
description: "Installer RTK via Homebrew (macOS/Linux)"options:
- label: "chmod +x .claude/hooks/*.sh"
description: "Rendre tous les hooks exécutables"
- label: "Copier hooks depuis template"
description: "Si hooks manquants, copier depuis repository principal"options:
- label: "Réinstaller RTK"
description: "cargo install --path . --force (version outdated?)"
- label: "Vérifier version"
description: "rtk --version (besoin v0.16.0+ pour rtk gain)"# Depuis la racine du repo RTK cargo install --path . # Vérifier installation which rtk && rtk --version
chmod +x .claude/hooks/*.sh # Vérifier permissions ls -la .claude/hooks/*.sh
# Install RTK cargo install --path . # Fix hooks permissio
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
Repo: rtk-ai/rtk
Interactive cleanup of stale worktrees (merged branches, orphaned refs)
Clean all merged worktrees automatically (no interaction)
Conventional Commits enforcer for AI-authored PRs.
Refuse force-pushes / history rewrites unless the user explicitly asks.
Defensive idioms when generating Rust code.
Force the agent to write or extend a test for every behaviour change.