Legacy refactoring
Code that works but that nobody dares to touch. We take apart a system with no documentation, cover its behaviour with tests and rewrite it in pieces—so the business does not stop for a single day.
Scope of work
point by point.
- Code audit: size, dependencies, risk areas
- Documentation reconstructed from the source
- Characterisation tests for the current behaviour
- A piece-by-piece migration plan with rollback points
- Data migration with integrity checks
- Dependency updates and known CVEs closed
- Splitting the monolith where that is justified
- CI/CD, linters, automated tests
- Old and new systems running side by side
- Training your team on the new code
Situations
where this pays for itself.
The only developer has left
The system runs, but nobody knows how. We rebuild the picture and make changes safe again.
System map in 5 working days
Every fix breaks something else
We cover the behaviour with tests before refactoring. After that, changes stop being a lottery.
From 0 to 70% coverage of the critical paths
Outdated stack
PHP 5, Python 2, Angular 1. We update in pieces rather than by a heroic weekend rewrite.
40,000 lines in 3 weeks
It cannot take the load
We profile, find the real bottleneck and fix that instead of rewriting everything.
Usually 3–5 queries cause 80% of the slowness
Four steps
from brief to handover.
- 01
Reconnaissance
We read the code, the commit history and the logs. AI helps read tens of thousands of lines quickly and draw the map.
- 02
Safety net
We write tests that pin down the current behaviour—including the oddities somebody is already relying on.
- 03
Migration in pieces
We move module by module, keeping the option to roll back at every step.
- 04
Handover
Documentation, CI, a walkthrough of the new code with your team. The aim is for us to become unnecessary.
What we
build it with.
Three tiers.
The exact estimate follows the brief.
from ₽150,000
5–10 working days
- Audit of up to 30,000 lines
- Map of the system and its dependencies
- Prioritised list of risks
- Migration plan with estimates
from ₽600,000
25–50 working days
- Characterisation tests for the critical paths
- Dependency updates and CVEs closed
- 2–3 modules moved to the new stack
- CI/CD and automated tests
- Team training
on request
50–120 working days
- Staged migration of the whole system
- Old and new versions running side by side
- Data migration with integrity checks
- Load testing
- Support through the transition period
Prices are the lower bound. What pushes an estimate up is set out on the pricing page
About this
service.
01Would it not be easier to rewrite from scratch?
Almost never. A working system hides hundreds of decisions taken for real reasons—nobody remembers them, but the business leans on them. A rewrite from scratch usually takes twice as long as estimated and reproduces the same workarounds. We rewrite in pieces, and at every step you have a working system.
02How does AI help with refactoring?
It reads fast: in an hour it builds a dependency map across 40,000 lines, finds duplicates and dead code, and drafts characterisation tests. The decision about what to change and how is taken by a person, and every line is reviewed by a person too. AI speeds up the boring part; it does not replace engineering judgement.
03What if we have no tests at all?
That is normal for legacy code, and it is where we start. We write characterisation tests: they record how the system behaves today, including the bugs somebody already relies on. Only then do we start changing code—otherwise refactoring turns into a hunt for what broke.
04How long will it take?
An audit of 30,000 lines takes 5–10 working days, and after it we can give a timeline for the rest. Projects of up to 100,000 lines usually fit into 2–4 months of staged migration. Without the audit, any estimate would be invented.
Get an estimate:
Legacy refactoring
The brief takes 5–7 minutes. In working hours we reply within two hours, and the estimate is free.