Vibe coders, this old news will happen to you sooner or later.
Unless you set up your project correctly.
Unless you set up your project correctly.
If you don’t know what I am talking about below, my advice is to hire a senior software engineer ASAP. Not just a junior engineer who can vibe code, but a senior who knows what they are doing.
I saw someone filing this as a bug to Claude Code. The bad news? This “bug” can’t be fixed. If you know the fundamentals of LLMs, you will know this is not a bug. It is a feature of LLMs by design.
An LLM is a probabilistic machine.
Even if you give it instructions not to reset your DB in CLAUDE.md, there is no guarantee it will follow them.
This is based on my own experience: I have told Claude Code not to run database migrations during development. It still does it once in a while, maybe 5% of the time—after finishing coding a feature.
Why? Because it is common practice to do this during development. The probabilistic nature of LLMs means there is a high chance it will do it even if you instruct it not to.
I run Claude Code with —dangerously-skip-permissions, but I never worry about this. Because if you set up your project properly, this is a non-issue.
Here is how you should set up your project to be “AI disaster-proof”:
-
Strict Infrastructure Isolation
-
Never, ever use your production database during development.
-
Set up another database, ideally a local one, for development.
-
Use a database framework that can generate migration files.
-
Review the migration files for any destructive statements.
-
Test the migration against a cloned production instance.
-
Apply it manually to your production environment only when you are sure.
-
Bonus: You can ask an LLM to review the migration file for risks.
-
Strict Environment Isolation
-
Never, ever put production credentials in a place where an AI agent can read them during development.
-
Your .env file should only contain local/dev credentials.
-
AI cannot delete what it cannot access.
-
Automate Daily DB Snapshots
-
Point (2) might not be possible for some platforms, or things may go wrong during DB migration.
-
If the AI manages to wipe your database (and it will), you need a way to recover.
-
Set up an automated daily snapshot of your production database.
-
If disaster strikes, restoring from yesterday’s backup turns a catastrophe into a minor annoyance.
-
Use Version Control, e.g. Git
-
This is not for the database, but for the code.
-
LLMs will mess up your code once in a while.
-
Git is your ultimate undo button for code.
-
If something breaks, roll it back.
Don’t blame the probabilistic machine. Architect your system so that probability doesn’t matter.
And sorry, there is no fix to the “bug”. It is a feature.
I repeat: If you don’t know what I’m talking about, it is time to hire a senior software engineer.
#AI #SoftwareEngineering #ClaudeCode #VibeCoding #ProgrammingTips
Enjoyed this? Subscribe for more.
Practical insights on AI, growth, and independent learning. No spam.
More in Vibe Coding
Does AI have empathy? I asked Claude a simple product question.
The answer surprised me.
Preparing for the Age of AI: NTU Panel Recap
· Duan Kai Neo- President of NTU EEE Alumni Association
AI amazes me from time to time.
Yesterday, I caught up with an old friend from my hometown, Penang.
Congrats to Cohort 3 of my Foundations of Claude Code for "surviving" the workshop.
After 3 rounds of iteration, the workshop runs much smoother now. But this cohort still threw up a few surprises.
Claude Code's auto memory makes your project less portable.
What is auto memory?
Recently, I ran a Claude Code foundations workshop for non-developers.
What I realised: the knowledge gap between developers and non-developers can be quite wide. Things I thought were obvious were not obvious to some learners.
Does AI have empathy? I asked Claude a simple product question.
The answer surprised me.
Congrats to Cohort 3 of my Foundations of Claude Code for "surviving" the workshop.
After 3 rounds of iteration, the workshop runs much smoother now. But this cohort still threw up a few surprises.
Recently, I ran a Claude Code foundations workshop for non-developers.
What I realised: the knowledge gap between developers and non-developers can be quite wide. Things I thought were obvious were not obvious to some learners.
Preparing for the Age of AI: NTU Panel Recap
· Duan Kai Neo- President of NTU EEE Alumni Association
AI amazes me from time to time.
Yesterday, I caught up with an old friend from my hometown, Penang.
Claude Code's auto memory makes your project less portable.
What is auto memory?