Code simplify
Use a separate code-simplifier subagent when available.
If the current agent runtime lacks named subagents, use the available generic subagent mechanism and pass the constraints below verbatim.
Modes
Detect mode from user wording.
apply: analyze and fixreport: return findings only, no edits
Default: apply.
Use report when user says audit, report, analyze, find issues,
report only, no changes, do not fix, or equivalent.
State detected mode in the first line of the subagent prompt.
Output shape
The subagent must group findings under these exact headers in this order:
- Bugs - will break on some input
- Misguidance - docs, comments, or instructions that disagree with code
- Missing validations - boundaries where failure is silently swallowed
- Real simplifications - reduces surface area without churn
- Low-priority - nitpicks, style preferences, or theoretical issues
Rules:
- One bullet per finding
- Include
file:linecitation - Sort by severity
- Skip
Low-priorityif user excluded nitpicks or style
Exclusion handling
Forward user exclusions verbatim.
If disagreeing with an exclusion, use one closing line:
Disagreed-with exclusions: <one-line note>
Do not smuggle excluded items into findings.
Dispatch
Pass these constraints to the subagent:
- Mode:
applyorreport - Output shape: five-header template above
- Exclusions: user exclusions verbatim
- Scope: recently modified sections unless user directs otherwise
- Project context: read
CLAUDE.md,AGENTS.md, or equivalent local rules before changes
Extra guidance
Lua and Neovim:
- Use
vim.keymap.setfor keymaps - Add
descto keymaps - Prefer Neovim 0.11+ APIs
- Assume Lua 5.1 unless specified otherwise
CSS:
- Use modern CSS features
- Prefer utility-first patterns when using CSS modules