rtk-ai avatar

Code Simplifier

Built specifically for the RTK project, this reviews Rust code for verbose patterns and applies idiomatic simplifications without breaking behavior. It knows RTK's non-negotiable constraints (lazy_static regexes, mandatory context() chains, fallback handlers) and won't touch them. Instead it targets the usual suspects: manual loops that should be iterator chains, nested matches that need flattening, unnecessary clones and allocations. The simplifications are standard Rust idioms, nothing clever. Useful when you've been heads-down implementing features and the code works but reads like you were thinking in Python. Runs clippy and tests after changes to verify no regressions.

skills.sh installs
2.2K
GitHub stars
86K
last updated
Aug 21, 2026

Install

$ npx -y skills add rtk-ai/rtk --skill code-simplifier --agent claude-code

Installs into .claude/skills of the current project.

Files

RTK Code Simplifier

Review and simplify Rust code in RTK while respecting the project's constraints.

Constraints (never simplify away)

  • LazyLock regex — cannot be moved inside functions even if "simpler"
  • .context() on every ? — verbose but mandatory
  • Fallback to raw command — never remove even if it looks like dead code
  • Exit code propagation — never simplify to Ok(())
  • #[cfg(test)] mod tests — never remove test modules

Simplification Patterns

1. Iterator chains over manual loops

// ❌ Verbose
let mut result = Vec::new();
for line in input.lines() {
    let trimmed = line.trim();
    if !trimmed.is_empty() && trimmed.starts_with("error") {
        result.push(trimmed.to_string());
    }
}

// ✅ Idiomatic
let result: Vec<String> = input.lines()
    .map(|l| l.trim())
    .filter(|l| !l.is_empty() && l.starts_with("error"))
    .map(str::to_string)
    .collect();

2. String building

// ❌ Verbose push loop
let mut out = String::new();
for (i, line) in lines.iter().enumerate() {
    out.push_str(line);
    if i < lines.len() - 1 {
        out.push('\n');
    }
}

// ✅ join
let out = lines.join("\n");

Sponsors

Details

Repository
github.com/rtk-ai/rtk
Categories
Git & Pull Requests, Code Review & Quality, Rust
First seen
Jun 3, 2026

More from rtk-ai/rtk

All 7
1obra avatarwriting-clearly-and-conciselyobra/the-elements-of-styleApply Strunk's timeless writing rules to ANY prose humans will read—documentation, commit messages, error messages, explanations, reports, or UI text. Makes you2.2Kskills.sh installs
2k-dense-ai avatarscholar-evaluationk-dense-ai/scientific-agent-skillsProvide qualitative-first, evidence-traceable developmental review of scholarly works and audit low-stakes research-assessment rubrics with optional local quali2.2Kskills.sh installs
3vinvcn avatarto-prdvinvcn/mattpocock-skills-zh-cn将当前对话上下文转成 PRD,并发布到项目 issue tracker。适用于用户想基于当前上下文创建 PRD 时。2.2Kskills.sh installs
4microsoft avatarhygienemicrosoft/vscodeUse when making code changes to ensure they pass VS Code's hygiene checks. Covers the pre-commit hook, unicode restrictions, string quoting rules, copyright hea2.2Kskills.sh installs
5aj-geddes avatarjenkins-pipelineaj-geddes/useful-ai-promptsBuild Jenkins declarative and scripted pipelines with stages, agents, parameters, and plugins. Implement multi-branch pipelines and deployment automation.2.2Kskills.sh installs
6truongduy2611 avatarapp-store-preflight-skillstruongduy2611/app-store-preflight-skillsScan an iOS/macOS Xcode project for common App Store rejection patterns before submission. Use when preparing an app for App Store review, after receiving a rej2.1Kskills.sh installs