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 53,985 stars 3309 forks Updated today 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
today
Language
Rust
License
Apache-2.0

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

design-patterns

Rust design patterns for RTK. Newtype, Builder, RAII, Trait Objects, State Machine. Applied to CLI filter modules. Use when designing new modules or refactoring existing ones.

53,985 Updated today
rtk-ai
Code & Development Solid

code-refactor

Perform bulk code refactoring operations like renaming variables/functions across files, replacing patterns, and updating API calls. Use when users request renaming identifiers, replacing deprecated code patterns, updating method calls, or making consistent changes across multiple locations.

585 Updated 2 months ago
mhattingpete
Code & Development Solid

review-loop

Runs multi-pass automated code review with per-issue fix subagents. Triggers when preparing a branch for PR, reviewing code changes, or when thorough automated code quality review is needed.

24 Updated 3 weeks ago
onsails
Code & Development Solid

rust-dev

This skill should be used when working with Rust code, reviewing Rust code, managing Rust dependencies, creating Rust projects, or fixing Rust compilation errors. It provides strict coding standards (especially FAIL FAST error handling), workspace architecture guidance, dependency management automation, and common Rust patterns.

24 Updated 3 weeks ago
onsails
AI & Automation Solid

swift-

专为 iOS/macOS 现代开发打造的代码分析规范。全面剖析 SwiftUI 响应式模式、ARC 强引用循环破除、以及 Swift 5.5+ 下基于 Actor 与 async/await 的全新并发架构。

40 Updated today
microwind