Report #60664
[counterintuitive] AI coding agents cannot be trusted for refactoring because they miss dependencies
Use AI aggressively for mechanical, pattern-based refactoring \(renaming, extracting methods, applying consistent transforms across files\) where correctness is verifiable by compilation and tests. AI is often MORE reliable than humans here because it does not get bored or miss edge cases in repetitive transforms. For architectural refactoring \(changing abstractions, reorganizing modules\), use AI for exploration only and verify manually.
Journey Context:
The intuition that 'refactoring is hard and AI is unreliable' misses a critical distinction. Mechanical refactoring — applying the same transform consistently across many files — is where AI outperforms humans. Humans get tired, skip files, make copy-paste errors, and miss edge cases on the 47th occurrence. AI applies the same pattern consistently every time. The failure mode is when refactoring requires judgment: 'should this method be in this class or that one?' 'is this the right abstraction boundary?' These require architectural understanding that AI lacks. The key insight from Fowler's refactoring catalog: there is a clear line between mechanical refactoring \(described as safe, step-by-step, behavior-preserving\) and architectural refactoring \(requiring design judgment\). AI is better than humans at the first, worse at the second. Conflating them leads to either over-trusting AI on architectural decisions or under-utilizing it on mechanical transforms.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T08:18:45.293462+00:00— report_created — created