Install command
Provided
Automatically generates Prisma client and creates migrations when schema.prisma is modified.
Open the source and read safety notes before installing.
Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.
Decision playbook
Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.
0
78
—
No baseline selected
No major trust-signal divergence detected in the current selection.
Confirm ownership and provenance before trusting install instructions.
Source link availableRequired
Open the canonical repository and verify ownership.
Source provenance statusRequired
Marked as source-backed.
Metadata reviewed
Registry metadata indicates a reviewed listing.
Validate risk disclosures before installation or API wiring.
Safety notes presentRequired
Review the listed safety guidance before running commands.
Privacy notes presentRequired
Review data handling notes before connecting accounts or secrets.
Trust level risk gateRequired
Trust level does not block evaluation.
Check package metadata and artifact integrity signals.
Install payload available
Install or copy payload is available for review.
Package verification flag
No package verification flag provided.
Checksum metadata
No checksum provided for downloaded artifact.
Use compare context to validate trade-offs before adoption.
Compare tray has multiple entries
Add at least one more entry to compare trust differences.
Baseline comparison available
No baseline peer selected yet.
Diverging trust signals identified
No major trust-signal divergence found.
Setup at a glance
Copy-ready — paste the snippet to get started.
Install command
Provided
Config snippet
Provided
Copy snippet
Provided
Prerequisites
None
Platforms
1 listed
Difficulty
0/100
Adoption plan
Current risk score 16/100. Use staged verification before broader rollout.
Validate source and review signals before any execution.
Confirm source provenanceRequired
Source URL/provenance metadata is present.
Confirm metadata review state
Listing has review metadata.
Verify install payload
Install/config payload exists and can be inspected.
Confirm safety, privacy, and package integrity signals.
Review safety notesRequired
Safety notes are present.
Review privacy notesRequired
Privacy notes are present.
Verify package integrity metadata
No package verification/checksum metadata.
Adopt in controlled steps based on the selected plan.
Run in isolated sandbox firstRequired
Use a constrained sandbox and observe behavior across multiple tasks.
Roll out graduallyRequired
Roll out to a small cohort before wider usage.
Set monitoring and fallback
Define rollback path and monitor errors after adoption.
Evidence readiness
Required evidence gates are covered (5/6 signals complete).
Source repository/provenance is listed.
Required in this preset
Review metadata is present.
Required in this preset
Safety notes are present.
Required in this preset
Privacy notes are present.
Optional in this preset
Package integrity metadata is missing.
Optional in this preset
Install payload is available.
Required in this preset
Required evidence gates are covered for this preset.
Decision timeline
5/6 steps complete with no blocking gaps for this preset.
triage
Source/provenance metadata is available.
triage
Review metadata is available.
verify
Safety notes are available.
verify
Privacy notes are available.
verify
Package integrity metadata is missing.
rollout
Install payload is available.
No required blockers for this timeline preset.
Safety & privacy surface
1 safety and 1 privacy notes across 2 risk areas. Review closely: credentials & tokens, permissions & scopes.
#!/bin/bash
# Read the tool input from stdin
INPUT=$(cat)
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name')
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""')
if [ -z "$FILE_PATH" ]; then
exit 0
fi
# Check if this is a Prisma schema file
if [[ "$FILE_PATH" == *schema.prisma ]]; then
echo "🔄 Prisma Schema Sync - Processing schema changes..."
echo "📄 Schema file: $FILE_PATH"
# Check if Prisma is available
if ! command -v npx >/dev/null 2>&1; then
echo "⚠️ npx not found. Please install Node.js and npm"
exit 1
fi
# Step 1: Validate schema
echo "🔍 Validating Prisma schema..."
if npx prisma validate; then
echo "✅ Schema validation passed"
else
echo "❌ Schema validation failed - Please fix errors before proceeding"
exit 1
fi
# Step 2: Format schema
echo "📝 Formatting Prisma schema..."
if npx prisma format; then
echo "✅ Schema formatted successfully"
else
echo "⚠️ Schema formatting failed"
fi
# Step 3: Generate Prisma client
echo "🏗️ Generating Prisma client..."
if npx prisma generate; then
echo "✅ Prisma client generated successfully"
else
echo "❌ Prisma client generation failed"
exit 1
fi
# Step 4: Create migration (dev mode only)
if [ "$NODE_ENV" != "production" ]; then
echo "🗄️ Creating database migration..."
MIGRATION_NAME="auto_migration_$(date +%Y%m%d_%H%M%S)"
if npx prisma migrate dev --name "$MIGRATION_NAME" --create-only; then
echo "✅ Migration created: $MIGRATION_NAME"
echo "⚠️ Please review the migration before applying it to your database"
echo "💡 Apply with: npx prisma migrate dev"
else
echo "⚠️ Migration creation skipped or failed"
fi
else
echo "ℹ️ Production environment - skipping migration creation"
fi
echo ""
echo "💡 Prisma Sync Tips:"
echo " • Review generated migrations before applying"
echo " • Use 'npx prisma studio' to explore your database"
echo " • Run 'npx prisma db push' for prototyping"
echo " • Use 'npx prisma migrate reset' to reset development database"
echo ""
echo "🎯 Prisma schema sync complete!"
else
echo "ℹ️ File is not a Prisma schema file: $FILE_PATH"
fi
exit 0{
"hooks": {
"postToolUse": {
"script": "./.claude/hooks/prisma-schema-sync.sh",
"matchers": [
"write",
"edit"
]
}
}
}This hook runs on schema.prisma changes. Which Prisma command it should trigger depends on your stage — here's how the core commands differ:
| Command | What it does | Creates migration history? | Typical stage |
|---|---|---|---|
prisma generate |
Regenerates the Prisma Client and TypeScript types from the schema | No | After any schema change |
prisma migrate dev |
Creates and applies a new migration from schema changes | Yes (versioned SQL files) | Development |
prisma migrate deploy |
Applies pending committed migrations without generating new ones | Applies existing | CI/CD and production |
prisma db push |
Pushes the schema straight to the database, no migration files | No | Early prototyping only |
Rule of thumb: always generate so types stay correct; use migrate dev while iterating, migrate deploy in pipelines, and reserve db push for throwaway prototypes where migration history doesn't matter.
.claude/settings.local.json~/.claude/settings.json.claude/settings.json{
"hooks": {
"postToolUse": {
"script": "./.claude/hooks/prisma-schema-sync.sh",
"matchers": ["write", "edit"]
}
}
}
#!/bin/bash
# Read the tool input from stdin
INPUT=$(cat)
TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name')
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""')
if [ -z "$FILE_PATH" ]; then
exit 0
fi
# Check if this is a Prisma schema file
if [[ "$FILE_PATH" == *schema.prisma ]]; then
echo "🔄 Prisma Schema Sync - Processing schema changes..."
echo "📄 Schema file: $FILE_PATH"
# Check if Prisma is available
if ! command -v npx >/dev/null 2>&1; then
echo "⚠️ npx not found. Please install Node.js and npm"
exit 1
fi
# Step 1: Validate schema
echo "🔍 Validating Prisma schema..."
if npx prisma validate; then
echo "✅ Schema validation passed"
else
echo "❌ Schema validation failed - Please fix errors before proceeding"
exit 1
fi
# Step 2: Format schema
echo "📝 Formatting Prisma schema..."
if npx prisma format; then
echo "✅ Schema formatted successfully"
else
echo "⚠️ Schema formatting failed"
fi
# Step 3: Generate Prisma client
echo "🏗️ Generating Prisma client..."
if npx prisma generate; then
echo "✅ Prisma client generated successfully"
else
echo "❌ Prisma client generation failed"
exit 1
fi
# Step 4: Create migration (dev mode only)
if [ "$NODE_ENV" != "production" ]; then
echo "🗄️ Creating database migration..."
MIGRATION_NAME="auto_migration_$(date +%Y%m%d_%H%M%S)"
if npx prisma migrate dev --name "$MIGRATION_NAME" --create-only; then
echo "✅ Migration created: $MIGRATION_NAME"
echo "⚠️ Please review the migration before applying it to your database"
echo "💡 Apply with: npx prisma migrate dev"
else
echo "⚠️ Migration creation skipped or failed"
fi
else
echo "ℹ️ Production environment - skipping migration creation"
fi
echo ""
echo "💡 Prisma Sync Tips:"
echo " • Review generated migrations before applying"
echo " • Use 'npx prisma studio' to explore your database"
echo " • Run 'npx prisma db push' for prototyping"
echo " • Use 'npx prisma migrate reset' to reset development database"
echo ""
echo "🎯 Prisma schema sync complete!"
else
echo "ℹ️ File is not a Prisma schema file: $FILE_PATH"
fi
exit 0
Complete hook script that performs Prisma schema synchronization
#!/bin/bash
INPUT=$(cat)
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""')
if [ -z "$FILE_PATH" ]; then
exit 0
fi
if [[ "$FILE_PATH" == *schema.prisma ]]; then
echo "🔄 Prisma Schema Sync - Processing schema changes..."
if command -v npx >/dev/null 2>&1; then
echo "🔍 Validating Prisma schema..."
if npx prisma validate; then
echo "✅ Schema validation passed"
echo "🏗️ Generating Prisma client..."
npx prisma generate
else
echo "❌ Schema validation failed"
exit 1
fi
fi
fi
exit 0
Complete hook configuration for .claude/settings.json to enable Prisma schema synchronization
{
"hooks": {
"postToolUse": {
"script": "./.claude/hooks/prisma-schema-sync.sh",
"matchers": ["write", "edit"]
}
}
}
Enhanced hook script with schema validation, formatting, and client generation
#!/bin/bash
INPUT=$(cat)
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""')
if [[ "$FILE_PATH" == *schema.prisma ]]; then
if command -v npx >/dev/null 2>&1; then
echo "🔍 Validating Prisma schema..."
if npx prisma validate; then
echo "📝 Formatting Prisma schema..."
npx prisma format
echo "🏗️ Generating Prisma client..."
if npx prisma generate; then
echo "✅ Prisma client generated successfully"
else
echo "❌ Prisma client generation failed"
exit 1
fi
else
echo "❌ Schema validation failed"
exit 1
fi
fi
fi
exit 0
Enhanced hook script with environment detection and migration creation
#!/bin/bash
INPUT=$(cat)
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""')
if [[ "$FILE_PATH" == *schema.prisma ]]; then
if [ "$NODE_ENV" != "production" ]; then
if command -v npx >/dev/null 2>&1; then
echo "🔍 Validating Prisma schema..."
if npx prisma validate; then
echo "🏗️ Generating Prisma client..."
npx prisma generate
echo "🗄️ Creating database migration..."
MIGRATION_NAME="auto_migration_$(date +%Y%m%d_%H%M%S)"
if npx prisma migrate dev --name "$MIGRATION_NAME" --create-only; then
echo "✅ Migration created: $MIGRATION_NAME"
echo "⚠️ Please review the migration before applying it"
fi
fi
fi
else
echo "ℹ️ Production environment - skipping migration creation"
fi
fi
exit 0
Enhanced hook script with database connection validation before operations
#!/bin/bash
INPUT=$(cat)
FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""')
if [[ "$FILE_PATH" == *schema.prisma ]]; then
if command -v npx >/dev/null 2>&1; then
if [ -f ".env" ] && grep -q 'DATABASE_URL' .env; then
echo "🔍 Testing database connection..."
if npx prisma db pull --schema=prisma/schema.prisma >/dev/null 2>&1; then
echo "✅ Database connection successful"
echo "🔍 Validating Prisma schema..."
if npx prisma validate; then
echo "🏗️ Generating Prisma client..."
npx prisma generate
fi
else
echo "⚠️ Database connection failed - skipping migration creation"
echo "💡 Verify DATABASE_URL in .env file"
fi
else
echo "⚠️ DATABASE_URL not found in .env - skipping database operations"
fi
fi
fi
exit 0
Prisma client not installed or wrong version. Run: 'npm install @prisma/client' matching schema generator. Verify: 'npx prisma version' showing versions. Re-generate with full schema path. Verify Prisma installation. Test with various Prisma versions.
DATABASE_URL missing or incorrect in .env. Verify: 'echo $DATABASE_URL' showing connection. Test: 'npx prisma db pull' for connectivity. Or use '--skip-generate' flag bypassing DB. Verify database connection. Test with various database configurations.
Timestamp-based naming always creates new migration. Add check: 'git diff prisma/schema.prisma | grep "^+model"' detecting real changes. Or use 'npx prisma migrate diff' to compare first. Verify schema changes. Test with various migration scenarios.
Formatting occurs after file write completing hook execution. Move format before validation: reorder script or use: 'npx prisma format && npx prisma validate' ensuring formatted state checked. Verify script order. Test with various schema formats.
NODE_ENV not set in deployment defaulting to undefined. Export: 'export NODE_ENV=production' in shell profile. Or check: 'if [ "$NODE_ENV" = "production" ] || [ -z "$NODE_ENV" ]'. Verify environment variables. Test with various environment configurations.
Schema syntax errors or missing dependencies. Run 'npx prisma validate' to identify issues. Check @prisma/client version matches prisma version. Verify TypeScript configuration. Test with various schema configurations.
Migration created with --create-only flag requires manual application. Apply with 'npx prisma migrate dev' or 'npx prisma migrate deploy' for production. Verify migration status. Test with various migration scenarios.
Generator configuration issues or missing dependencies. Check generator block in schema.prisma. Verify @prisma/client installation. Check node_modules/.prisma directory. Verify generator configuration. Test with various generator settings.
Prisma Schema Sync - Hooks side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
Next steps differ across entries — use the actions in the table below to copy install commands and source links per resource.
| Field | Automatically generates Prisma client and creates migrations when schema.prisma is modified. Open dossier | A PostToolUse hook that reminds you to enable native query logging for PostgreSQL, Prisma, Sequelize, and TypeORM, and flags possible N+1 patterns when you edit SQL or data-access files. Open dossier | A Stop hook that terminates lingering database connections when a Claude Code session ends — via PostgreSQL pg_terminate_backend, MySQL KILL, Redis CLIENT KILL, and MongoDB connection cleanup. Open dossier | PostToolUse hook that detects writes to migration, schema, and SQL files then runs framework-specific status checks — runs knex migrate:status for Node.js projects and python manage.py showmigrations for Django projects. Open dossier |
|---|---|---|---|---|
| Next stepsDiffers | ||||
| Trust | ||||
| Review status | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed |
| Package trust | Package not verified | Package not verified | Package not verified | Package not verified |
| Source provenance | Source-backed | Source-backed | Source-backed | Source-backed |
| Submitter | — | — | — | — |
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ |
| Brand | — | — | — | — |
| Category | hooks | hooks | hooks | hooks |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | JSONbored | JSONbored | JSONbored | JSONbored |
| Added | 2025-09-19 | 2025-10-19 | 2025-09-19 | 2025-09-16 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | ✓Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling. | ✓Runs automatically after bash, write, or edit activity and inspects files that look like query, model, repository, DAO, or SQL files. Creates .claude/logs/query-performance.log and appends database command or file-analysis events. Uses grep-based heuristics for query warnings and should not be treated as proof of a performance defect. | ✓Runs at session end and forcibly terminates database backends/clients (pg_terminate_backend, KILL, CLIENT KILL); pointed at a shared or production database it can drop other users' connections — scope it to local/dev databases and confirm the target before enabling. | ✓Runs automatically after write or edit activity on migration, schema, and SQL files. Invokes knex migrate:status for Knex projects and python manage.py showmigrations for Django projects when the respective framework CLI is available. Scans raw SQL for destructive statements and reports warnings but does not apply migrations itself. |
| Privacy notes | ✓Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output. | ✓Reads query-related source files and may print file paths, query patterns, and database command strings to local hook output. Stores analyzed file paths and database command text in .claude/logs/query-performance.log. Database command text may include connection names, database names, or other operational details if typed directly into the command. | ✓Uses locally configured database credentials and connection details to issue termination commands; keep those credentials in environment variables, not in the hook. | ✓Reads migration, schema, SQL, package, and framework configuration files to infer migration state. Command output may reveal database names, migration names, table names, or schema details in the local hook output. |
| Prerequisites | — none listed | — none listed | — none listed | — none listed |
| Install | | — | | |
| Config | | | | |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.