skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
rtk-ai/rtk86 installs

performance

RTK CLI performance analysis and optimization. Startup time (<10ms), binary size (<5MB), regex compilation, memory usage. Use when adding dependencies, changing initialization, or suspecting regressions.

How do I install this agent skill?

npx skills add https://github.com/rtk-ai/rtk --skill performance
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    The skill provides guidelines and commands for analyzing and optimizing the performance of the RTK CLI tool. It uses standard development tools and practices with no detected security issues.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

What does this agent skill do?

RTK Performance Analysis

Hard Targets (Non-Negotiable)

MetricTargetBlocker
Startup time<10msRelease blocker
Binary size (stripped)<5MBRelease blocker
Memory (resident)<5MBRelease blocker
Token savings per filter≥60%Release blocker

Benchmark Startup Time

# Install hyperfine (once)
brew install hyperfine

# Baseline (before changes)
hyperfine 'rtk git status' --warmup 3 --export-json /tmp/before.json

# After changes — rebuild first
cargo build --release

# Compare against installed
hyperfine 'target/release/rtk git status' 'rtk git status' --warmup 3

# Target: <10ms mean time

Check Binary Size

# Release build with strip=true (already in Cargo.toml)
cargo build --release
ls -lh target/release/rtk
# Should be <5MB

# If too large — check what's contributing
cargo bloat --release --crates
cargo bloat --release -n 20
# Install: cargo install cargo-bloat

Memory Usage

# macOS
/usr/bin/time -l target/release/rtk git status 2>&1 | grep "maximum resident"
# Target: <5,000,000 bytes (5MB)

# Linux
/usr/bin/time -v target/release/rtk git status 2>&1 | grep "Maximum resident"
# Target: <5,000 kbytes

Regex Compilation Audit

Regex compilation on every function call is a common perf killer:

# Find all Regex::new calls
grep -n "Regex::new" src/*.rs

# Verify ALL are inside lazy_static! blocks
# Any Regex::new outside lazy_static! = performance bug
// ❌ Recompiles on every filter_line() call
fn filter_line(line: &str) -> bool {
    let re = Regex::new(r"^error").unwrap();  // BAD
    re.is_match(line)
}

// ✅ Compiled once at first use
lazy_static! {
    static ref ERROR_RE: Regex = Regex::new(r"^error").unwrap();
}
fn filter_line(line: &str) -> bool {
    ERROR_RE.is_match(line)  // GOOD
}

Dependency Impact Assessment

Before adding any new crate:

# Check startup impact (measure before adding)
hyperfine 'rtk git status' --warmup 3

# Add dependency to Cargo.toml
# Rebuild
cargo build --release

# Measure after
hyperfine 'target/release/rtk git status' --warmup 3

# If startup increased >1ms — investigate
# If startup increased >3ms — reject the dependency

Forbidden dependencies

CrateReasonAlternative
tokio+5-10ms startupBlocking std::process::Command
async-std+5-10ms startupBlocking I/O
rayonThread pool init overheadSequential iteration
reqwestPulls tokioureq (blocking) if HTTP needed

Dependency weight check

# After cargo build --release
cargo build --release --timings
# Open target/cargo-timings/cargo-timing.html
# Look for crates with long compile times (correlates with complexity)

Allocation Profiling

# macOS — use Instruments
instruments -t Allocations target/release/rtk git log -10

# Or use cargo-instruments
cargo install cargo-instruments
cargo instruments --release -t Allocations -- git log -10

Common RTK allocation hotspots:

// ❌ Allocates new String on every line
let lines: Vec<String> = input.lines().map(|l| l.to_string()).collect();

// ✅ Borrow slices
let lines: Vec<&str> = input.lines().collect();

// ❌ Clone large output unnecessarily
let raw_copy = output.stdout.clone();

// ✅ Use reference until you actually need to own
let display = &output.stdout;

Token Savings Measurement

// In tests — always verify claims
fn count_tokens(text: &str) -> usize {
    text.split_whitespace().count()
}

#[test]
fn test_savings_claim() {
    let input = include_str!("../tests/fixtures/mycmd_raw.txt");
    let output = filter_output(input).unwrap();

    let input_tokens = count_tokens(input);
    let output_tokens = count_tokens(&output);
    let savings = 100.0 * (1.0 - output_tokens as f64 / input_tokens as f64);

    assert!(
        savings >= 60.0,
        "Expected ≥60% savings, got {:.1}% ({} → {} tokens)",
        savings, input_tokens, output_tokens
    );
}

Before/After Regression Check

Template for any performance-sensitive change:

# 1. Baseline
cargo build --release
hyperfine 'target/release/rtk git status' --warmup 5 --export-json /tmp/before.json
/usr/bin/time -l target/release/rtk git status 2>&1 | grep "maximum resident"
ls -lh target/release/rtk

# 2. Make changes
# ... edit code ...

# 3. Rebuild and compare
cargo build --release
hyperfine 'target/release/rtk git status' --warmup 5 --export-json /tmp/after.json
/usr/bin/time -l target/release/rtk git status 2>&1 | grep "maximum resident"
ls -lh target/release/rtk

# 4. Compare
# Startup: jq '.results[0].mean' /tmp/before.json /tmp/after.json
# If after > before + 1ms: investigate
# If after > 10ms: regression, do not merge

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/rtk-ai/rtk/performance">View performance on skillZs</a>