code-simplifier

Featured

Review RTK Rust code for idiomatic simplification. Detects over-engineering, unnecessary allocations, verbose patterns. Applies Rust idioms without changing behavior.

AI & Automation 57,145 stars 3516 forks Updated yesterday Apache-2.0

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# 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 ```rust // ❌ 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 ```rust // ❌ 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 ```rust // ❌ 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. S...

Details

Author
rtk-ai
Repository
rtk-ai/rtk
Created
4 months ago
Last Updated
yesterday
Language
Rust
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category