Complete deployment workflow with pre-flight checks and validation
Comprehensive deployment workflow with safety checks, validation, and rollback planning.
This skill automatically activates when:
Ensure code meets standards:
# Run test suite
pytest tests/ -v --cov=src
# Check code formatting
black --check src/ tests/
# Run linter
flake8 src/ tests/ --max-line-length=88
# Type checking (if using)
mypy src/
Requirements:
Run security checks:
# Check for secrets
grep -r "password\s*=\s*['\"]" src/
grep -r "api[_-]?key\s*=\s*['\"]" src/
# Check dependencies
pip list --outdated
safety check # If installed
# Verify .env not committed
git ls-files | grep -E "\.env$|credentials"
Requirements:
Verify repository state:
# Check working tree
git status
# Verify on correct branch
git branch --show-current
# Check remote sync
git fetch origin
git status -sb
# View recent commits
git log --oneline -5
Requirements:
Ensure documentation is current:
# Check README
cat README.md
# Check CHANGELOG (if exists)
cat CHANGELOG.md
# Check for API documentation
ls -la docs/
Requirements:
Verify dependency manifest:
# Check requirements are up to date
pip freeze > requirements-check.txt
diff requirements.txt requirements-check.txt
# Check for unused dependencies
# (Manual review or use tool like pip-autoremove)
Requirements:
Verify environment configuration:
# Check environment variables needed
grep -r "os\.getenv\|os\.environ" src/
# Verify .env.example exists
cat .env.example
# Check configuration files
ls -la config/
Requirements:
Check database state (if applicable):
# Check for pending migrations
# (Project-specific commands)
# Verify migration scripts tested
ls -la migrations/
# Check rollback plan for migrations
Requirements:
# 1. Update from main
git checkout main
git pull origin main
# 2. Merge feature branch
git merge feature/branch-name --no-ff
# 3. Run tests one more time
pytest tests/ -v
# 4. Push to main
git push origin main
# 1. Ensure on main branch
git checkout main
git pull origin main
# 2. Create release tag
# Version: MAJOR.MINOR.PATCH (e.g., 1.2.3)
git tag -a v1.2.3 -m "Release version 1.2.3
- Feature A
- Feature B
- Bug fix C
See CHANGELOG.md for full details."
# 3. Push tag
git push origin v1.2.3
# 4. Create GitHub release (if applicable)
gh release create v1.2.3 \
--title "Release v1.2.3" \
--notes-file release-notes.md
# Project-specific deployment commands
# Examples:
# Heroku
git push heroku main
# Docker
docker build -t app:v1.2.3 .
docker push registry/app:v1.2.3
# SSH deploy
./deploy.sh production
# CI/CD
# Trigger via GitHub Actions / GitLab CI
Verify application is running:
# Check application endpoint
curl -I https://app.example.com/health
# Verify expected response
curl https://app.example.com/api/version
# Check status page
open https://status.example.com
Verify:
Run critical path tests:
# Test critical functionality
curl -X POST https://app.example.com/api/login \
-H "Content-Type: application/json" \
-d '{"username":"test","password":"test"}'
# Test key features
pytest tests/smoke/ -v
# Manual verification
# - Login works
# - Key features accessible
# - Data displays correctly
Check system health:
# View logs
tail -f /var/log/app.log
# or
kubectl logs deployment/app -f
# Check metrics dashboard
open https://grafana.example.com
# Monitor error tracking
open https://sentry.io/project/app
Monitor for:
Verify performance:
# Check response times
curl -w "@curl-format.txt" -o /dev/null -s https://app.example.com
# Load test (if applicable)
ab -n 100 -c 10 https://app.example.com/
# Check database queries
# (Project-specific monitoring)
Verify:
Immediate rollback:
# Option 1: Revert commit
git revert HEAD
git push origin main
# Option 2: Reset to previous tag
git reset --hard v1.2.2
git push origin main --force # CAUTION!
# Option 3: Redeploy previous version
# (Deployment-specific commands)
Communication:
If migrations need reversal:
# Run down migrations
# (Framework-specific commands)
# Restore from backup if needed
# (Have backup restoration procedure ready)
Safe deployments require preparation, validation, and monitoring