Skip to content
Vroni

DocsUse cases

Refactoring

Hand Vroni the refactoring you keep putting off, like splitting a class that has grown too big or replacing a calculation copied across five files with one helper.

A refactoring reorganizes code without changing what the app does. Vroni’s review rounds and test step watch for behavior changes, so you get a pull request that cleans up the structure while keeping everything working the same.

Below, you’ll find how to write a refactoring task, what to lock down so behavior stays intact, and what to check when the pull request comes back.

Write the refactoring task

Point Vroni to the code, describe the structure you want, and state what must stay the same:

OrderController has grown to over 1,500 lines. Move the export logic into its own OrderExportService and the PDF generation into OrderPdfService. The routes and the behavior of every endpoint stay the same. Run the order tests before and after the change.

The price formatting code is copied in five places (search for number_format($price). Replace it with one helper and use it everywhere. The formatted prices must look exactly as before.

You can create the task in New task.

Say what must stay the same

The most useful part of a refactoring task is spelling out what can’t change. If you move export code, tell Vroni that the download URL and CSV columns have to stay the same. Vroni treats that as a requirement, and both its reviewers and the test step check for it.

Ask Vroni to run the same tests before and after the change, then check the pull request to see which commands it ran. If that part of the codebase has few tests, run a test task first.

Be careful with renames that touch the database. Some frameworks store class names in database columns, like Laravel does for polymorphic relations, so renaming a model can break saved records. If you rename one, ask Vroni to keep existing records working and add a test for a record saved before the rename.

One step per task

Big refactorings are easier to review when you break them up. Instead of asking to “clean up the billing module,” hand over one change at a time. Split the class first, then remove the duplicates, then rename. Merge each pull request before starting the next task, since every task branches off your main branch.

Review the pull request

When the pull request is ready, check that:

  • The new structure matches what you asked for.
  • The description doesn’t mention any change in behavior.
  • The tests pass.

If you don’t like a name or where something ended up, choose Request changes and say what you want instead. See Pull requests for more on the review flow.

Last updated November 25, 2026. Something missing or unclear? Write to [email protected].

Try Vroni on your own repository

Vroni is in early access, and new accounts are approved by hand.

Get early access