The Assumption
There’s a common assumption about AI in engineering:
Give it a messy system, and it will fix it.
That hasn’t been my experience.
When I applied AI to a 9-year-old production system, it didn’t simplify the work.
It made one thing very clear:
If you don’t understand your system, AI will expose that immediately.
The Context
The platform I’ve been working on is built on the LEAST engine (Linking Educational And Social Technologies).
It’s a real-world system with characteristics that most engineers recognise:
- no framework
- heavy use of global variables
- manual SQL construction
- direct HTML rendering
- no automated tests
It’s not “modern” by current standards.
But it is:
- stable
- production-proven
- fully in use
And that’s the reality of most systems that matter.
The Starting Point
Before introducing AI, the system had already been:
- stabilised
- understood at a high level
- operating reliably
But there were known issues:
- inconsistent SQL handling
- potential injection risks
- uneven patterns across domains
- limited observability
Nothing unusual.
Just the accumulated reality of a long-lived system.
The Intervention
I introduced AI into the engineering workflow using tools such as:
- Anthropic Claude Code
- ChatGPT
The goal was not to rewrite the system.
It was to:
- improve it safely
- reduce risk
- increase consistency
- accelerate understanding
What Actually Happened
AI didn’t “fix” the system.
It forced me to:
1. Be Explicit About Everything
In a modern framework, a lot is implicit:
- routing
- validation
- data handling
In this system, nothing is implicit.
Every function requires:
- declared globals
- manual includes
- explicit SQL construction
AI can’t guess intent.
It needs:
- clear inputs
- clear structure
- clear expectations
Which means:
I had to understand exactly what each part of the system was doing.
2. Confront Inconsistency
Legacy systems evolve over time.
Different patterns appear:
- slightly different SQL approaches
- variations in sanitisation
- inconsistent naming
AI highlights this immediately.
Because it tries to:
- generalise patterns
- apply consistency
Where that fails, the inconsistency becomes obvious.
3. Make Decisions Instead of Assumptions
Without AI, it’s easy to work around issues:
- patch a query
- adjust a function
- move on
With AI:
- every change is amplified
- every assumption is tested
For example:
- Should all SQL be parameterised?
- What is the standard access pattern?
- Where should sanitisation occur?
AI doesn’t answer these.
It forces you to!
A Concrete Example
Take SQL handling.
Before:
- queries were constructed manually
- sanitisation was applied inconsistently
Using the platform’s helpers:
$strSafe = fn_Db_ScrapeInput(fn_Gen_LoadField("strLesson_Name"));
AI could suggest improvements.
But only if:
- the correct pattern was defined
- the intended behaviour was clear
Otherwise, it would produce:
- inconsistent fixes
- partial solutions
What Improved
Using AI in this context led to:
1. Increased Consistency
- standardised database access patterns
- clearer function structures
- reduced variation across domains
2. Reduced Risk
- improved input handling
- more consistent sanitisation
- clearer separation of concerns
3. Faster Iteration
Tasks that previously required:
- manual tracing
- repeated testing
Could now be:
- analysed quickly
- implemented confidently
What Didn’t Change
This is important.
AI did not:
- redesign the system
- introduce a framework
- remove complexity
The architecture remains:
- monolithic
- global-state driven
- manually structured
The Key Insight
AI is not a shortcut.
It’s an amplifier.
If your understanding is weak:
- it produces weak output
If your understanding is strong:
- it accelerates everything
The Real Outcome
The biggest change wasn’t technical.
It was cognitive.
Before:
- understanding was partial
- patterns were implicit
- decisions were reactive
After:
- understanding became explicit
- patterns were defined
- decisions became deliberate
Why This Matters
Most discussions about AI in engineering focus on:
- automation
- code generation
- speed
But in real systems, the constraint isn’t typing speed.
It’s understanding.
What This Enables
Once a system is:
- understood
- consistent
- structured
AI can then:
- accelerate development
- improve quality
- reduce risk
But not before.
Final Thought
AI didn’t fix my legacy system.
It forced me to understand it properly.
And once that happened:
improving it became significantly easier.






