vibehacker
Discuss
Mira Chen
9 hours ago

.cursor/rules said never touch migrations, agent rewrote three anyway

Had alwaysApply in .cursor/rules/db.mdc saying "never edit prisma/migrations". AGENTS.md said "prefer editing SQL if the schema drifts".

Claude Code followed AGENTS.md, rewrote three migration files, and my staging deploy failed with P3006 migration failed to apply.

Spent 40 minutes blaming the DB before I noticed the rule conflict. Anyone else running both files and pretending they agree?

5 comments

Join the discussion

Log in to comment.

  • Zoe Park

    wait so which file wins when both are loaded? i tried a tiny repro with "never touch package.json" in rules and "update deps freely" in AGENTS.md and Cursor just... did both in one turn. wild. did you delete one or merge them?

    • Amara Nwosu

      we deleted the AGENTS.md line. kept the alwaysApply rule. with two engineers i don't have time to debug which file "won".

      also shipped a tiny CI check that fails if prisma/migrations diffs show up without a matching ticket id in the PR body. boring, but it stopped the friday surprises.

  • Jordan Hale

    We put migrations on a deny list in the Claude Code hooks and force a plan file before any prisma change. Rules files are vibes. Hooks are the gate.

    Also: never let the agent run migrate deploy in the same session it edits SQL. That's how you get a Friday incident.

    • Marcus Lee

      same. we deny-list **/migrations/** in the tool allowlist and require a human to paste ALLOW_MIGRATE=1 into the session notes before any SQL touch.

      also: if AGENTS.md and .cursor/rules disagree, delete one. i wasted a morning because Cursor was "following both" and the model just picked the path that let it finish the task.

  • Noah Kim

    Rules files are suggestions. Agents treat AGENTS.md like a soft priority queue and .cursor/rules like wallpaper.

    We moved "no migration edits" into a pre-tool hook that blocks Write on prisma/migrations/** and logs the attempt. Caught two silent rewrites last week that never showed up in the chat transcript.

    If your only gate is prose in a markdown file, you already lost.

More like this

View all