feat: improve skill descriptions from PR #9 (selective merge)
Cherry-pick description improvements and allowed-tools fixes from @popey's PR #9, while preserving reference documentation in skills that serve as templates (audit-agents-skills, ccboard, design-patterns). Co-Authored-By: Alan Pope <alan@popey.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
be52e232b3
commit
40213f0a7e
23 changed files with 1994 additions and 197 deletions
|
|
@ -7,86 +7,138 @@ tags: [optimization, tokens, efficiency, git]
|
|||
|
||||
# RTK Optimizer Skill
|
||||
|
||||
Automatically suggest and apply RTK (Rust Token Killer) wrappers for verbose commands, reducing token usage by ~73% on average.
|
||||
**Purpose**: Automatically suggest RTK wrappers for high-verbosity commands to reduce token consumption.
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **Detect high-verbosity commands** in user requests
|
||||
2. **Suggest RTK wrapper** with expected savings
|
||||
2. **Suggest RTK wrapper** if applicable
|
||||
3. **Execute with RTK** when user confirms
|
||||
4. **Track savings** over session via `rtk gain`
|
||||
|
||||
## Prerequisites
|
||||
|
||||
```bash
|
||||
rtk --version # Requires rtk 0.16.0+
|
||||
|
||||
# Install if needed:
|
||||
brew install rtk-ai/tap/rtk # macOS/Linux
|
||||
cargo install rtk # All platforms
|
||||
```
|
||||
4. **Track savings** over session
|
||||
|
||||
## Supported Commands
|
||||
|
||||
| Command | RTK Equivalent | Reduction |
|
||||
|---------|---------------|-----------|
|
||||
| `git log` | `rtk git log` | 92% (13,994 -> 1,076 chars) |
|
||||
| `git status` | `rtk git status` | 76% |
|
||||
| `git diff` | `rtk git diff` | 56% (15,815 -> 6,982 chars) |
|
||||
| `find` | `rtk find` | 76% |
|
||||
| `cat <large-file>` | `rtk read <file>` | 63% (163K -> 61K chars) |
|
||||
| `pnpm list` | `rtk pnpm list` | 82% |
|
||||
| `vitest run` / `pnpm test` | `rtk vitest run` | 90% |
|
||||
| `cargo test` | `rtk cargo test` | 90% |
|
||||
| `cargo build` | `rtk cargo build` | 80% |
|
||||
| `cargo clippy` | `rtk cargo clippy` | 80% |
|
||||
| `pytest` | `rtk python pytest` | 90% |
|
||||
| `go test` | `rtk go test` | 90% |
|
||||
| `gh pr view` | `rtk gh pr view` | 87% |
|
||||
| `gh pr checks` | `rtk gh pr checks` | 79% |
|
||||
| `ls` | `rtk ls` | condensed |
|
||||
| `grep` | `rtk grep` | filtered |
|
||||
### Git (>70% reduction)
|
||||
- `git log` → `rtk git log` (92.3% reduction)
|
||||
- `git status` → `rtk git status` (76.0% reduction)
|
||||
- `find` → `rtk find` (76.3% reduction)
|
||||
|
||||
## Usage Pattern
|
||||
### Medium-Value (50-70% reduction)
|
||||
- `git diff` → `rtk git diff` (55.9% reduction)
|
||||
- `cat <large-file>` → `rtk read <file>` (62.5% reduction)
|
||||
|
||||
```markdown
|
||||
# When user requests a verbose command:
|
||||
### JS/TS Stack (70-90% reduction)
|
||||
- `pnpm list` → `rtk pnpm list` (82% reduction)
|
||||
- `pnpm test` / `vitest run` → `rtk vitest run` (90% reduction)
|
||||
|
||||
1. Acknowledge the request
|
||||
2. Suggest RTK: "I'll use `rtk git log` to reduce token usage by ~92%"
|
||||
3. Execute the RTK-wrapped command
|
||||
4. Report savings: "Saved ~13K tokens (baseline: 14K, RTK: 1K)"
|
||||
```
|
||||
### Rust Toolchain (80-90% reduction)
|
||||
- `cargo test` → `rtk cargo test` (90% reduction)
|
||||
- `cargo build` → `rtk cargo build` (80% reduction)
|
||||
- `cargo clippy` → `rtk cargo clippy` (80% reduction)
|
||||
|
||||
### Python & Go (90% reduction)
|
||||
- `pytest` → `rtk python pytest` (90% reduction)
|
||||
- `go test` → `rtk go test` (90% reduction)
|
||||
|
||||
### GitHub CLI (79-87% reduction)
|
||||
- `gh pr view` → `rtk gh pr view` (87% reduction)
|
||||
- `gh pr checks` → `rtk gh pr checks` (79% reduction)
|
||||
|
||||
### File Operations
|
||||
- `ls` → `rtk ls` (condensed output)
|
||||
- `grep` → `rtk grep` (filtered output)
|
||||
|
||||
## Activation Examples
|
||||
|
||||
**User**: "Show me the git history"
|
||||
**Action**: Detect `git log` -> execute `rtk git log` -> report 92% savings
|
||||
**Skill**: Detects `git log` → Suggests `rtk git log` → Explains 92.3% token savings
|
||||
|
||||
**User**: "Run the test suite"
|
||||
**Action**: Detect `cargo test` / `pytest` -> execute `rtk cargo test` -> report 90% savings
|
||||
**User**: "Find all markdown files"
|
||||
**Skill**: Detects `find` → Suggests `rtk find "*.md" .` → Explains 76.3% savings
|
||||
|
||||
## When to Skip RTK
|
||||
## Installation Check
|
||||
|
||||
- **Small outputs** (<100 chars): Overhead not worth it
|
||||
- **Claude built-in tools**: Grep/Read tools are already optimized
|
||||
- **Interactive commands**: RTK is for batch/non-interactive output only
|
||||
- **Multiple piped commands**: Wrap the outermost command, not each step
|
||||
Before first use, verify RTK is installed:
|
||||
```bash
|
||||
rtk --version # Should output: rtk 0.16.0+
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
If not installed:
|
||||
```bash
|
||||
# Homebrew (macOS/Linux)
|
||||
brew install rtk-ai/tap/rtk
|
||||
|
||||
- If `rtk` is not found, fall back to the raw command and suggest installation
|
||||
- If RTK output is empty or malformed, re-run without RTK and report the issue
|
||||
- If RTK version is outdated, warn about potential breaking changes (rapid release cadence)
|
||||
# Cargo (all platforms)
|
||||
cargo install rtk
|
||||
```
|
||||
|
||||
## Usage Pattern
|
||||
|
||||
```markdown
|
||||
# When user requests high-verbosity command:
|
||||
|
||||
1. Acknowledge request
|
||||
2. Suggest RTK optimization:
|
||||
"I'll use `rtk git log` to reduce token usage by ~92%"
|
||||
3. Execute RTK command
|
||||
4. Track savings (optional):
|
||||
"Saved ~13K tokens (baseline: 14K, RTK: 1K)"
|
||||
```
|
||||
|
||||
## Session Tracking
|
||||
|
||||
Optional: Track cumulative savings across session:
|
||||
|
||||
```bash
|
||||
rtk gain # Shows cumulative token savings for the session (SQLite-backed)
|
||||
# At session end
|
||||
rtk gain # Shows total token savings for session (SQLite-backed)
|
||||
```
|
||||
|
||||
## Edge Cases
|
||||
|
||||
- **Small outputs** (<100 chars): Skip RTK (overhead not worth it)
|
||||
- **Already using Claude tools**: Grep/Read tools are already optimized
|
||||
- **Multiple commands**: Batch with RTK wrapper once, not per command
|
||||
|
||||
## Configuration
|
||||
|
||||
Enable via CLAUDE.md:
|
||||
```markdown
|
||||
## Token Optimization
|
||||
|
||||
Use RTK (Rust Token Killer) for high-verbosity commands:
|
||||
- git operations (log, status, diff)
|
||||
- package managers (pnpm, npm)
|
||||
- build tools (cargo, go)
|
||||
- test frameworks (vitest, pytest)
|
||||
- file finding and reading
|
||||
```
|
||||
|
||||
## Metrics (Verified)
|
||||
|
||||
Based on real-world testing:
|
||||
- `git log`: 13,994 chars → 1,076 chars (92.3% reduction)
|
||||
- `git status`: 100 chars → 24 chars (76.0% reduction)
|
||||
- `find`: 780 chars → 185 chars (76.3% reduction)
|
||||
- `git diff`: 15,815 chars → 6,982 chars (55.9% reduction)
|
||||
- `read file`: 163,587 chars → 61,339 chars (62.5% reduction)
|
||||
|
||||
**Average: 72.6% token reduction**
|
||||
|
||||
## Limitations
|
||||
|
||||
- 446 stars on GitHub, actively maintained (30 releases in 23 days)
|
||||
- Not suitable for interactive commands
|
||||
- Rapid development cadence (check for breaking changes)
|
||||
|
||||
## Recommendation
|
||||
|
||||
**Use RTK for**: git workflows, file operations, test frameworks, build tools, package managers
|
||||
**Skip RTK for**: small outputs, quick exploration, interactive commands
|
||||
|
||||
## References
|
||||
|
||||
- RTK GitHub: https://github.com/rtk-ai/rtk
|
||||
- RTK Website: https://www.rtk-ai.app/
|
||||
- Evaluation: `docs/resource-evaluations/rtk-evaluation.md`
|
||||
- CLAUDE.md template: `examples/claude-md/rtk-optimized.md`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue