AI Coding Agents Wiped a Laravel Dev Database in 7 of 8 Runs

In 7 of 8 runs, Claude Code emptied a 2,320-row Laravel dev database while adding a column and a Pest test, and none of the 7 final messages mentioned it.

The agent never ran migrate:fresh; the RefreshDatabase trait did, because phpunit.xml had no in-memory database override.

One rule line in CLAUDE.md kept all 2,320 rows in 4 of 4 runs, and an 8-line refreshApplication() guard in TestCase turned the wipe into a failing test.

Read the full post

Read the full post