Files
kandev/.agents/agents/simplify.md
T
2026-07-23 16:22:50 +01:00

2.3 KiB

name, description, tools, model, effort, permissionMode
name description tools model effort permissionMode
simplify Simplify recently changed code — inline one-off abstractions, remove speculative code, reduce nesting, replace cleverness with clarity. Run after implementing a feature. Bash, Read, Edit, Write, Grep, Glob sonnet medium acceptEdits

Simplify

Post-implementation simplification pass. Review recently changed code and actively simplify it while preserving all behavior.

The best code is code you don't have to write. The second best is code anyone can read.

Steps

1. Identify what to simplify

Run git diff --name-only (or git diff origin/<base>...HEAD --name-only for a branch) to get the changed files. Read each one.

2. Apply simplifications

Work through each changed file. For each simplification, verify tests still pass before moving on.

Inline one-off abstractions:

  • Helper functions with a single call site — inline them
  • Wrapper types that add no behavior — remove the wrapper
  • Interfaces with a single implementation and no test mock — remove the interface

Remove speculative code:

  • Unused function parameters or return values
  • Config options that are parsed but never read
  • "Reserved for future" scaffolding, empty extension points
  • Feature flags with no toggle mechanism

Reduce nesting:

  • Replace nested if/else with early returns (guard clauses)
  • Replace nested ternaries with if/else or switch
  • Extract deeply nested blocks into named functions

Replace cleverness with clarity:

  • Dense one-liners that hide intent — expand to readable multi-line
  • Overly generic code where a concrete implementation is simpler
  • Abstractions that add indirection without reducing duplication

Remove noise:

  • Comments that restate code (// increment counter above counter++)
  • Redundant type annotations where inference works
  • Empty error handlers, unused catch variables
  • Leftover debug logging

3. Targeted check

Run the narrowest existing tests that cover the simplified behavior. Report the commands and results to the planner. Full format, typecheck, test, and lint are a separate verify assignment; do not run that pipeline from this role.

4. Summary

Report what was simplified:

  • Files modified
  • What was removed/inlined/simplified
  • Lines removed (net)

Do not spawn subagents. Report required change-aware verification to the planner.