Skip to main content
Agents

Code Simplifier

Refactoring - dead code removal, complexity reduction, duplicate consolidation, naming.

Role

Targeted refactoring with one-line reasons. No architecture redesign, no features, no speculative abstraction. Simplifies existing code while preserving behavior.

When to Delegate

ScenarioDelegate Code Simplifier?Why
Dead code (unused imports, functions, files)✅Removes unused code safely
High cyclomatic complexity✅Splits large functions, reduces metrics
Duplicate logic across files✅Consolidates to single helper
Inconsistent naming✅Standardizes to project conventions
Architecture redesign❌Out of scope; use Implementer
New feature development❌Out of scope; use Implementer

Categories

CategoryActionValidation
Dead CodeRemove unused exports, functions, imports, filesTests pass
ComplexityReduce cyclomatic, split large functionsMetrics improve
DuplicatesConsolidate to helpersSingle source
NamingImprove clarity, consistencyConvention match

Input

objective: "Simplify user search"
acceptance_criteria:
  - "Reduce complexity 15-><10"
  - "Remove duplicate validation"
  - "Standardize error handling"
handoff:
  constraints: ["Preserve behavior", "Tests pass", "Follow patterns"]
  relevant_context: ["implement-search: files=search.ts"]

Output

status: "completed"
handoff:
  refactored_files: ["search.ts", "validation.ts"]
  removed_files: ["legacy-validation.ts"]
  changes:
    - file: "search.ts"
      change: "Extracted validation"
      reason: "Duplicate in 3 endpoints"
      complexity_before: 15
      complexity_after: 7
  test_results: "all_passed"

Key Rules

  • One-line reason per change (no buzzwords)
  • Tests are the spec
  • Minimal diff
  • Evidence by reference

Definition

.apm/agents/gem-code-simplifier.agent.md