so i built the hook and felt safe. finally — the boring check i kept forgetting was the machine's job now. i stopped thinking about migration sync entirely 🤷♂️
a few months later, Jagan sir ran one of his analyses.... and found the migration files had drifted. again. tables missing. the exact class of bug i thought i'd killed. he ran the audit, brought it all back in line.
then the question i had no answer for: "why didn't your hook catch this?" 🙃
so i went digging. and here's the hole.
our backend and frontend are separate — separate folders, separate repos, separate ports. not a next.js app where both live under one roof. two codebases. which means two .claude/ folders. two different places a hook can live.
i'd built the hook in the backend folder. that's where the migrations are, so that's where it made sense.
but here's how i actually work: most days i open claude in the frontend folder. that's my home base. when something comes up, that's the session already running.
and the AI does nothing to save you here — claude opened in the frontend sees only the frontend. it never pauses to ask "wait, should the backend change too?" or "is there a guardrail i'm supposed to be respecting?". it just does the thing in front of it.
so back then, working from the frontend, i needed some migration changes. i told claude "go ahead and fix the backend too". it asked for access to the backend files, i gave it, it wrote the migrations, everything ran, i was happy.
except those edits happened from the frontend session. and the hook doesn't live there. so it never fired. not once. the migrations went in, the base schema didn't follow, and the drift quietly started over — past a guardrail that was sitting one folder away, working perfectly, watching a door nobody used 😮💨
the fix was almost insultingly simple — i copied the same skill and hook into the frontend folder's .claude/ too. now whichever side i'm working from, the check fires.
but the real lesson isn't "copy the hook". it's this: i automated the check so i'd stop relying on my memory. then i trusted the automation so completely that i never checked whether it even covered the way i work.
and once again, the thing that actually caught it wasn't my automation. it was Jagan sir, reading the code 🤷♂️
#buildinpublic #softwareengineering #claudecode #automation #databasemigrations #maahitatechnologies