Refactoring is the process of improving the internal structure of code while leaving its functionality and external behavior unchanged. It consists of repeated small changes such as removing duplication, extracting functions and classes, renaming, and reorganizing modules to make code easier to read and maintain. The concept was established in software engineering in the 1990s and popularized by Martin Fowler's book Refactoring (1999).
It is typically carried out together with automated tests to confirm that behavior has not changed. In the AI field, multi-file refactoring is regarded as a representative task for gauging the capability of coding agents and is frequently used as a task in coding benchmarks.