Skip to content

Instantly share code, notes, and snippets.

@mimoo
Created February 6, 2026 22:17
Show Gist options
  • Select an option

  • Save mimoo/549124666de4fd7be8ee6c8dc8f6ccd4 to your computer and use it in GitHub Desktop.

Select an option

Save mimoo/549124666de4fd7be8ee6c8dc8f6ccd4 to your computer and use it in GitHub Desktop.
NO MORE DB PUSH !

NO MORE DB PUSH

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."
      }
    }'
  fi

And chmod +x it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment