SI
Simplify
Bounded simplification pass for a file or hunk that preserves behavior while reducing complexity.
Install
mkdir -p .claude/skills/simplify-lordmacu && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16336" && unzip -o skill.zip -d .claude/skills/simplify-lordmacu && rm skill.zipInstalls to .claude/skills/simplify-lordmacu
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Bounded simplification pass for a file or hunk that preserves behavior while reducing complexity.97 charsno explicit “when” trigger
About this skill
Simplify
Simplify code in a bounded, evidence-driven way: smaller, clearer, and easier to maintain while preserving behavior unless the user explicitly asks otherwise.
Use when
- User asks for refactor/cleanup without adding new features.
- A file or hunk looks noisy (duplication, dead code, redundant guards).
- You need clearer names and tighter structure with minimal risk.
Do not use when
- User is requesting new behavior or a product-level redesign.
- You do not have a concrete target file/hunk.
- The change would require broad API/contract breakage without approval.
Input contract
target(required): file path or hunk identifier to simplify.scope(optional):fileorhunk(defaultfile).max_passes(optional): default2, clamp to[1, 4].preserve_behavior(optional): defaulttrue.focus(optional): subset ofreuse,dead_code,redundant_guards,naming,duplication,efficiency.
Parsing rules (priority order)
- If structured args are provided, use them directly.
- Else infer from user language:
- "this file", explicit path, or pasted diff ->
target - "just this block/hunk" ->
scope=hunk - "two passes/max 3 rounds" ->
max_passes - "don't change behavior" ->
preserve_behavior=true - keywords like "remove dead code", "rename", "dedupe" ->
focus
- "this file", explicit path, or pasted diff ->
- Defaults:
scope=file,max_passes=2,preserve_behavior=true
- If
targetis still missing, ask for one concrete file or hunk.
Canonical workflow
- Understand baseline
- Read the target and identify purpose, invariants, and public interfaces.
- Run bounded simplify passes (
1..max_passes)- Apply only high-signal improvements:
- remove dead code / unreachable branches
- collapse redundant guards and repeated conditionals
- deduplicate copy-paste logic into local helpers where appropriate
- improve naming for intent clarity
- replace ad-hoc logic with existing utilities when available
- Apply only high-signal improvements:
- Behavior safety check
- If
preserve_behavior=true, avoid interface/semantic changes. - If a behavior change seems necessary, stop and ask for confirmation.
- If
- Verification
- Run targeted checks (lint/test/build scope relevant to changed files).
- Stop when:
- no further meaningful simplification remains (
status=already_simple), or - simplification applied safely (
status=simplified), or - blocked by missing context/approval (
status=needs_user_input), or - pass budget reached (
status=max_passes_reached).
- no further meaningful simplification remains (
Guardrails
- Never run unbounded refactor loops.
- Do not introduce speculative abstractions with no local payoff.
- Do not touch unrelated files "while here".
- Prefer small, reviewable edits over sweeping rewrites.
- Keep comments only for non-obvious WHY; remove narrative noise.
Output format
Always return:
status:simplified|already_simple|needs_user_input|max_passes_reachedpasses_run: number of simplify passes executedtarget: normalized file/hunk targetfocus_used: normalized focus dimensionschanges: concise bullet list of concrete simplificationsbehavior_safety: why behavior is preserved (or what approval is needed)verification: checks run + outcomesnext_action: required unlessstatus=simplifiedoralready_simple
Examples
target="crates/core/src/agent/mod.rs" max_passes=2 focus="dead_code,redundant_guards"target="src/main.rs#L120" scope="hunk" preserve_behavior=truetarget="diff:latest" focus="reuse,duplication,naming" max_passes=3