audit-swift-simplify
Report behavior-preserving ways to make Swift clearer and more idiomatic — without changing what the code does. Point it at a file, a subsystem, or the whole project.
What This Command Does
Launches the swift-simplifier agent to surface local Swift-language simplification opportunities, each tagged by how safe it is to apply.
What It Checks
- Control flow & optionals – nested
if let→guard/comma-form, shorthandif let x, redundantelseafterreturn/throw,x != nil ? x! : y→?? if/switchexpressions – temp-var-then-assign ladders and nested ternaries → expressions (Swift 5.9)- Collection idioms –
.count == 0→.isEmpty,.filter{}.first→.first(where:),.filter{}.count→count(where:)(with purity preconditions) - Boilerplate – redundant
self., redundant inferred type annotations, redundantreturn, verbose closures → trailing/$0 - Dead availability guards – always-true
if #availableagainst your deployment floor
Each finding is tagged SAFE / PRECONDITION / ADVISORY. The agent reports; it does not edit.
Related Agent
- swift-simplifier – The agent that powers this command