Annoying agents. Claude, codex, gemini, they all suck, they always use db push directly with prisma and co. We don't want them to! So we must tell them to stop!!!!
Add to .claude/settings.json in your project:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/block-prisma-db-push.sh"
}
]
}
]
}
}Then create .claude/hooks/block-prisma-db-push.sh:
#!/bin/bash
INPUT=$(cat)
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command')
if echo "$COMMAND" | grep -q "prisma db push"; then
jq -n '{
hookSpecificOutput: {
hookEventName: "PreToolUse",
permissionDecision: "deny",
permissionDecisionReason: "NEVER use prisma db push — it bypasses migration history. Use bun run db:migrate:dev instead. If that fails due to drift,
ask the user."
}
}'
fiAnd chmod +x it.