<ul data-eligibleForWebStory="true">OpenRewrite is an open-source tool for automating code refactorings, enabling developers to tackle technical debt efficiently.It includes an auto-refactoring engine that runs predefined refactoring recipes for framework migrations, security fixes, and style consistency tasks.The tool's community is continuously expanding its language and framework coverage.OpenRewrite features two main components: recipes and the engine that executes them.Authors can create new refactoring recipes to customize code transformations.A specific scenario discussed involves restructuring Kotlin package directories following official recommendations.OpenRewrite offers benefits like testability, scalability, and composability over traditional tools like sysadmin or IDEs.The article delves into the implementation details of crafting a new recipe in OpenRewrite for flattening Kotlin package structures.Testing recipes in OpenRewrite is facilitated by parsers and an in-memory execution context.Potential future work includes JSON serializability of recipes and automatic root package detection.Overall, the article demonstrates the simplicity and effectiveness of authoring OpenRewrite recipes for codebase migrations.