Using Claude Code to Refactor Ugly FileMaker Scripts Without Breaking Production
The Script That Everyone Is Afraid To Touch
You’ve got a FileMaker script that works.
You know it works because production hasn’t caught fire. But you also know, the way developers always know, that something in there is held together with assumptions and good intentions, and one day someone is going to change a variable name and the whole thing is going to quietly do the wrong thing for three weeks before anyone notices.
That’s the script you want to refactor. And that’s exactly the script you shouldn’t hand to an AI and say “clean this up.”
Here’s how to actually use Claude Code for this without turning a maintenance task into an incident.
Give It Structure (Not Screenshots)
Claude can’t read intent from a layout. It can read logic. Paste the actual script steps; the If blocks, the Set Variable chains, the nested Case statements that made sense in 2021. What you’re handing over is a map of decisions, and the AI needs to see the decisions, not a picture of them.
Ask for the risk zones before you ask for anything cleaner.
This is the step most developers skip. Before you say “refactor this,” ask:
- Where are the assumptions in this script?
- What breaks if the found set is empty?
- What happens if this variable doesn’t get set upstream?
Let Claude surface the fragile parts first. You’ll often find that what looked like a style problem is actually a logic problem wearing a style problem’s clothes.
One Branch At A Time. Not The Whole Script.
Big rewrites kill apps. Not because the new code is wrong (sometimes it’s genuinely better), but because a script that does seven things has seven places where the refactor can introduce a regression, and you won’t find all of them in testing. Pick the ugliest branch. Refactor that. Verify it in a development copy. Then move to the next one.
The goal is to get a script that’s easier to trust, easier to hand to another developer, and easier to extend six months from now when the business changes and someone needs to add an eighth thing.
Claude Code is a capable collaborator for this kind of work. It just needs the same thing any good collaborator needs: enough context to understand what the code is actually doing, and enough discipline to not try to fix everything at once.
The most dangerous refactors aren’t the ones that fail loudly. They’re the ones that succeed silently, and change something nobody thought to test.
Recent comments
No comments yet.