Restructuring without regression
How can you improve existing code with Claude Code while checking that its behaviour remains unchanged?
- Lovable
- Claude Code
- Codex
1960 € per session, excl. VAT
In short
This seven-hour day, excluding breaks, structures an assisted refactoring approach: diagnose a module, safeguard its behaviour with tests, request limited changes from Claude Code, then examine the differences. Participants compile a revised code dossier, accompanied by evidence of quality and handover instructions.
Why this training?
Duplication and mixed responsibilities make corrections risky: changing a discount can affect several quotation workflows. Useful refactoring starts by making the behaviours to preserve explicit, rather than requesting a complete rewrite. Claude Code can help generate or modify code from instructions. Its proposals remain technical hypotheses: human review, tests and before-and-after measurements allow each change to be accepted, corrected or rejected. Running case study: The fictional organisation Avelcro Distribution uses a quotation calculation module with duplicated discount rules and scattered rounding logic. Using a training repository and fictional orders, participants restructure this module without changing the amounts returned or its public interface. Transfer to work: On returning, select a limited business module, obtain authorisation to process the code and repeat the approach on an isolated branch. Have the differences, tests and measurements reviewed before any integration decision.
Objectives of this training
- Identify duplication and dependencies in an existing module.
- Write tests characterising the behaviours to preserve.
- Formulate a bounded refactoring instruction for Claude Code.
- Examine differences and correct unsolicited changes.
- Compare quality before and after, and document limitations.
Who is it for and what are the prerequisites?
Roles and tasks concerned
- Developers responsible for maintaining business applications.
- Technical leads who review AI-assisted changes.
Prior skills
- Be able to read, modify and test code in the language of the supplied repository.
- Be proficient in branches, version differences and rollback.
- Have already used an AI assistant for a development task.
What you will work on
Bound the work
Objective: Define the invariants of quotation calculation. Refactoring versus functional enhancement; public interface, business rules, confidentiality and secrets management.
Diagnose before modifying
Objective: Prioritise observable structural flaws. Duplication, function length, responsibilities and dependencies; establishing a measurable baseline.
Protect existing behaviours
Objective: Build a relevant test safety net. Characterisation tests, boundary values and expected results verified independently of AI proposals.
Transform in small batches
Objective: Separate calculation, validation and presentation. Bounded instructions, function extraction, reducing duplication and preserving signatures.
Evaluate and challenge the result
Objective: Distinguish demonstrated improvement from subjective judgement. Review of differences, readability, dependencies and comparison of measurements; performance without conclusions unsupported by measurements.
Prepare for handover to a peer
Objective: Deliver a reviewable and reversible change. Documentation of choices, test commands, residual risks and rollback procedure.
What you take away
- Prioritised diagnosis and refactoring scope.
- Characterisation test suite and execution results.
- Refactored code with traceable changes.
- Review dossier, comparative measurements and rollback procedure.
Method and assessment
- Short inputs followed by immediate practice on the running case study.
- Individual work followed by work in pairs, with cross-review of outputs.
- Guided group discussion: what works, what needs correcting and what remains a human decision.
- Preparation: Check access to Claude Code and an execution environment authorised by the organisation. Prepare the training repository, its dependencies and its fictional data; remove secrets and identifying information.
Observable criteria: Tests cover the standard case, discount threshold, invalid input and rounding. ; Behaviour tests pass before and after the changes. ; Every accepted difference falls within the stated scope. ; Comparative measurements specify their method and limitations. ; No secrets appear in the material sent to the assistant..
Frequently asked questions
Do you need to use all three tools?
No. The exercises use Claude Code; Lovable and Codex remain alternatives to consider depending on authorisations and official documentation.
Can you bring internal code?
The exercises use the fictional repository. Any other code requires authorisation, appropriate anonymisation and the removal of secrets.
Are passing tests enough?
No. They only prove the cases covered; human review and examination of limitations remain necessary.
Will the deliverable be deployed?
No. It prepares for a technical review; integration and deployment are governed by the organisation's procedures.
Last updated: