Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
rtk-ai avatar

Code Simplifier

  • 1.2k installs
  • 74.8k repo stars
  • Updated August 3, 2026
  • rtk-ai/rtk

code-simplifier is an RTK Rust review skill that detects over-engineering, unnecessary allocations, and verbose patterns for developers who need idiomatic refactors without changing program behavior.

About

code-simplifier is a Claude Code skill from rtk-ai/rtk that reviews and simplifies Rust code in the RTK project while preserving mandated constraints. The skill triggers on phrases like simplify, too verbose, over-engineered, refactor this, and make this idiomatic, then scans for unnecessary abstractions, extra allocations, and non-idiomatic patterns using Read, Grep, Glob, and Edit tools. Developers reach for code-simplifier after AI-generated or legacy RTK changes when readability matters but project rules—lazy_static regex placement and mandatory .context() on every ?—must stay intact. The low-effort workflow produces cleaner Rust that still passes RTK behavioral requirements.

  • Automatically simplifies code by removing over-engineering and redundant patterns
  • Reduces cognitive load for both humans and downstream agents
  • Works across frontend, backend, and agent workflows
  • Preserves functionality while improving readability and maintainability
  • Designed as a reusable capability within larger agentic coding stacks

Code Simplifier by the numbers

  • 1,182 all-time installs (skills.sh)
  • +51 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #932 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/rtk-ai/rtk --skill code-simplifier

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1.2k
repo stars74.8k
Last updatedAugust 3, 2026
Repositoryrtk-ai/rtk

How do you simplify Rust code without changing behavior?

Automatically reduce complexity, remove unnecessary abstractions, and produce cleaner, more maintainable code from AI-generated or legacy implementations.

Who is it for?

RTK contributors cleaning up AI-generated or verbose Rust who need behavior-preserving idiomatic refactors within project-specific constraints.

Skip if: Non-Rust codebases, greenfield rewrites, or teams that want architectural redesigns beyond localized simplification.

When should I use this skill?

A developer says simplify, too verbose, over-engineered, refactor this, or make this idiomatic on RTK Rust code.

What you get

Idiomatic simplified Rust diffs that preserve RTK constraints and remove over-engineered abstractions.

  • simplified Rust diffs
  • idiom recommendations
  • refactored source files

Files

SKILL.mdMarkdownGitHub ↗

RTK Code Simplifier

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

Constraints (never simplify away)

  • lazy_static! 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");

3. Option/Result chaining

// ❌ Nested match
let result = match maybe_value {
    Some(v) => match transform(v) {
        Ok(r) => r,
        Err(_) => default,
    },
    None => default,
};

// ✅ Chained
let result = maybe_value
    .and_then(|v| transform(v).ok())
    .unwrap_or(default);

4. Struct destructuring

// ❌ Repeated field access
fn process(args: &MyArgs) -> String {
    format!("{} {}", args.command, args.subcommand)
}

// ✅ Destructure
fn process(&MyArgs { ref command, ref subcommand, .. }: &MyArgs) -> String {
    format!("{} {}", command, subcommand)
}

5. Early returns over nesting

// ❌ Deeply nested
fn filter(input: &str) -> Option<String> {
    if !input.is_empty() {
        if let Some(line) = input.lines().next() {
            if line.starts_with("error") {
                return Some(line.to_string());
            }
        }
    }
    None
}

// ✅ Early return
fn filter(input: &str) -> Option<String> {
    if input.is_empty() { return None; }
    let line = input.lines().next()?;
    if !line.starts_with("error") { return None; }
    Some(line.to_string())
}

6. Avoid redundant clones

// ❌ Unnecessary clone
fn filter_output(input: &str) -> String {
    let s = input.to_string();  // Pointless clone
    s.lines().filter(|l| !l.is_empty()).collect::<Vec<_>>().join("\n")
}

// ✅ Work with &str
fn filter_output(input: &str) -> String {
    input.lines().filter(|l| !l.is_empty()).collect::<Vec<_>>().join("\n")
}

7. Use if let for single-variant match

// ❌ Full match for one variant
match output {
    Ok(s) => process(&s),
    Err(_) => {},
}

// ✅ if let (but still handle errors in RTK — don't silently drop)
if let Ok(s) = output {
    process(&s);
}
// Note: in RTK filters, always handle Err with eprintln! + fallback

RTK-Specific Checks

Run these after simplification:

# Verify no regressions
cargo fmt --all && cargo clippy --all-targets && cargo test

# Verify no new regex in functions
grep -n "Regex::new" src/<file>.rs
# All should be inside lazy_static! blocks

# Verify no new unwrap in production
grep -n "\.unwrap()" src/<file>.rs
# Should only appear inside #[cfg(test)] blocks

What NOT to Simplify

  • lazy_static! { static ref RE: Regex = Regex::new(...).unwrap(); } — the .unwrap() here is acceptable, it's init-time
  • .context("description")? chains — verbose but required
  • The fallback match arm Err(e) => { eprintln!(...); raw_output } — looks redundant but is the safety net
  • std::process::exit(code) at end of run() — looks like it could be Ok(())but it isn't

Related skills

How it compares

Pick code-simplifier for RTK-specific Rust simplification with project constraints; pick generic linters when you only need syntax or style enforcement.

FAQ

What constraints does code-simplifier preserve?

code-simplifier never removes RTK mandates such as lazy_static regex placement or mandatory .context() on every ? operator. Simplifications must keep behavior identical while improving idiomatic Rust style.

What triggers code-simplifier?

code-simplifier activates on simplify, too verbose, over-engineered, refactor this, or make this idiomatic requests against RTK Rust. It uses Read, Grep, Glob, and Edit to locate and fix verbose patterns.

AI & Agent Buildingagentsautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.