# Simplify Code

> Sweeps the code changed this session for code smells (dead code, duplication, data clumps, misplaced responsibility, speculative generality) by spawning read-only sub-agents in parallel, then applies the fixes that simplify without changing behavior. One pass, not a loop; correctness belongs to harden-code. Use after a refactor or feature, or when the user says "simplify", "clean up", or "code quality pass".

- Skill: `linardsliepenieks/simplify-code` (Agent Skill)
- Install (CLI): `npx skillmds@latest add linardsliepenieks/simplify-code`
- Raw SKILL.md: https://api.skillmd.com/api/skills/linardsliepenieks/simplify-code/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: LinardsLiepenieks (https://skillmd.com/u/linardsliepenieks)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/linardsliepenieks/simplify-code

---


# Simplify recently-changed code

One quality pass over the code changed this session: read-only sub-agents surface code smells, you apply the ones worth applying. **Not a loop**: one pass, done. Correctness (crashes, data loss, contract changes) is `harden-code`'s job; this skill is simplicity only. If nothing changed, ask which scope to use.

**The bar is simplicity.** The goal is clear, clean-cut features built on the codebase's established patterns, not bells and whistles, and no scaffolding for features that don't exist yet. If a simpler shape does the same job, or an existing pattern already covers it, that's the finding.

## Smells to surface

- **Dead code**: unused functions, unreachable branches, orphaned exports, commented-out blocks.
- **Duplicate code**: the same logic in two places, near-duplicate functions, repeated validation.
- **Data clumps**: the same field group or shape redeclared inline across files that should be one shared type/schema.
- **Misplaced responsibility**: logic in the wrong layer (business rules in transport, validation in storage, presentation in domain models); anything that violates the separation of concerns `CLAUDE.md` defines.
- **Speculative generality**: abstraction, indirection, or config built for a future that hasn't arrived (per `CLAUDE.md`'s restraint rule).

Leave alone: bugs, crashes, data loss (note them for `harden-code`, don't fix here); behavior-changing performance tweaks; and nits the formatter already handles.

## Process

1. **Scope**: the files changed this session (ask if you can't tell reliably).
2. **Partition**: group them into cohesive slices, one per import neighborhood or feature path; one sub-agent per slice.
3. **Dispatch in parallel**: read-only sub-agents, each given its file list and slice name, each returning findings as `file:line · smell · suggested fix`. They advise; they never edit.
   - **Adversarial variant (agent team):** when agent teams are enabled, run this as a team of QA skeptics instead. Each teammate owns a slice, argues that its code isn't earning its keep (is this abstraction premature, does this deviate from an established pattern, is this bell-and-whistle wanted by an actual feature), and teammates cross-examine each other before reporting. A smell that survives the challenge is worth applying.
4. **Triage**: apply a finding only if it simplifies **and** preserves behavior. Skip anything that changes behavior, contradicts `CLAUDE.md` conventions, or doesn't survive your own scrutiny, each skip with a one-line reason.
5. **Apply the survivors yourself**: you have the context, don't delegate to a fixer.
6. **Report**, per slice: audited, found, applied, skipped and why.

