> For the complete documentation index, see [llms.txt](https://as-pect.gitbook.io/as-pect/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://as-pect.gitbook.io/as-pect/.pi/skills/tdd/refactoring.md).

# Refactor Candidates

After TDD cycle, look for:

* **Duplication** → Extract function/class
* **Long methods** → Break into private helpers (keep tests on public interface)
* **Shallow modules** → Combine or deepen
* **Feature envy** → Move logic to where data lives
* **Primitive obsession** → Introduce value objects
* **Existing code** the new code reveals as problematic
