Validate build and run smoke tests before deployment.
## Claude Code Deploy Hook
Configure Claude Code hooks for automatic deploy actions.
### .claude/hooks/deploy.json
```json
{
"hooks": {
"deploy": {
"description": "Validate build and run smoke tests before deployment.",
"command": ".claude/scripts/deploy.sh",
"timeout": 30000,
"enabled": true
}
}
}
```
### .claude/scripts/deploy.sh
```bash
#!/bin/bash
set -e
echo "Running Deploy hook..."
# Step 1: Validate environment
if [ -z "$PROJECT_ROOT" ]; then
PROJECT_ROOT=$(git rev-parse --show-toplevel)
fi
# Step 2: Run checks
cd "$PROJECT_ROOT"
# Run linting
npm run lint --quiet 2>/dev/null || echo "Lint warnings found"
# Run type checking
npm run typecheck 2>/dev/null || echo "Type errors found"
# Step 3: Report results
echo "Deploy hook completed successfully"
```
### Setup
1. Create `.claude/hooks/` directory
2. Add the JSON config file
3. Create the shell script and make executable
4. Claude Code will run this automaticallyFree to copy and use. Compatible with Claude Code, Claude 4 Opus.
Copy this prompt into your Claude Code project. Customize bracketed variables for your specific setup.
Initial release
Sign in and download this prompt to leave a review.