The Python + Scratch flow
- Pull your records into Scratch. The folder is one JSON file per record, with prose fields and structured fields sitting alongside each other.
- Ask your AI of choice (Claude, Codex, Cursor) to write a Python script that walks the folder and applies the change you want. A regex sweep across product titles. A tag normalizer. A length-capper on meta descriptions. A bulk SEO field rewrite.
- Run the script against your Scratch project folder.
- Open Scratch. Every file the script touched shows up as a diff, per record.
- If the script overreached, refine the prompt, regenerate, re-run. The originals are still there.
- Approve the diffs you want. Publish.
Why Python pairs well with Scratch
A Scratch folder is a clean, normalized substrate that Python is unreasonably good at chewing through. pathlib, json.load, a regex, json.dump, done. The AI writes the script in seconds; Python runs it deterministically across ten thousand records; Scratch gives you a per-record review surface so you can catch whatever the script got wrong before it ships.
This is the right pattern when:
- The change is mechanical and repeatable (formatting, tag cleanups, field migrations, CSV joins).
- You want the same transform to re-run on every future pull without re-prompting an LLM each time.
- You want a cheap, fast inner loop (no model calls per record, no token cost, no latency).
It's also how Scratch's optional validators work under the hood: AI-authored Python rules that fail formatting regressions before a diff ever reaches your eyes.
What stays safe
The script runs on your machine, against local files. Nothing leaves your laptop until you click publish in Scratch, per record. The original version of every record sits next to the modified one until you decide.
If the script breaks something, you reject the diffs. If it nails every record, you approve in bulk. Either way, you saw it first.