Index of every page on this site: llms.txt
All skills
Run it yourself

This skill should be used when the user asks to "clean up code", "remove dead code", "simplify this function", "this code is too complex", "reduce complexity", "find unused imports", "code quality sweep", or "/simplifier". Focuses on dead code, complexity reduction, and duplication removal.

  • 6 files
  • 17.5 KB
  • Updated 2 days ago
  • GitHub
Use this Skill: https://skilld.dev/gh/utkudarilmaz/claude-code-setup/simplifier

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesrust-patterns.md

≈824 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Rust Simplification Patterns

Dead Code

// DEAD: Unused import
use std::fmt; // Never used

// DEAD: Unused variable
let config = load_config(); // Never referenced

// DEAD: Unreachable code
fn process() -> i32 {
    return compute();
    println!("never runs");
}

// DEAD: Unused function
fn old_helper() {} // No callers found

// DEAD: Warning suppression hiding dead code
#[allow(dead_code)]
fn unused() {} // Remove the function instead of silencing the compiler

Complexity

// COMPLEX: Nested matching
fn user_name(id: u32) -> Option<String> {
    match find_user(id) {
        Some(user) => match user.profile {
            Some(profile) => Some(profile.name),
            None => None,
        },
        None => None,
    }
}

// SIMPLIFIED: Combinators
fn user_name(id: u32) -> Option<String> {
    find_user(id).and_then(|user| user.profile).map(|profile| profile.name)
}
// COMPLEX: Deeply nested if-let
fn handle(input: Option<Input>) {
    if let Some(input) = input {
        if input.valid {
            if let Some(items) = input.items {
                // logic buried
            }
        }
    }
}

// SIMPLIFIED: let-else and early returns
fn handle(input: Option<Input>) {
    let Some(input) = input else { return };
    if !input.valid {
        return;
    }
    let Some(items) = input.items else { return };
    // logic at top level
}
// COMPLEX: Manual accumulation loop
let mut names = Vec::new();
for user in users {
    if user.active {
        names.push(user.name.clone());
    }
}

// SIMPLIFIED: Iterator chain
let names: Vec<_> = users.iter().filter(|u| u.active).map(|u| u.name.clone()).collect();

Rust-Specific Checks

Pattern Issue Fix
.unwrap() / .expect() outside tests Panics in production on the error path Propagate with ? or handle the Err/None case
Unneeded .clone() Extra allocation to satisfy the borrow checker quickly Borrow instead, or restructure ownership
fn f(s: String) for read-only use Forces callers to allocate or move Take &str (or &[T] instead of Vec<T>)
match with two arms returning bool Verbose for a predicate Use matches! or the condition directly
if x { true } else { false } Restates the condition Return the condition itself
.iter().map(...).collect() for side effects Allocates a throwaway collection Use a for loop
collect() then immediately iterate again Intermediate allocation Keep the iterator chain lazy
return expr; as the last statement Non-idiomatic Use the tail expression
Rc<RefCell<T>> where one owner exists Runtime borrow checking without need Use plain ownership or &mut
Box<T> for small sized types Pointless heap allocation Store the value directly
#[allow(...)] without a reason Hides a warning the code should fix Fix the warning or justify the allow
Ignored Result (let _ = fallible()) Error silently dropped Handle or propagate the error
unsafe block wider than needed Enlarges the audit surface Shrink to the exact unsafe operation
String building with repeated format! Allocation per iteration Use push_str or write! into one buffer

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 7ee2637. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 2 days ago

README badge

README badge for utkudarilmaz/claude-code-setup/simplifier