Deploy
Deployment orchestration and environment management. Handles deploy commands, env vars, CI/CD pipelines, promote/rollback procedures. Platform-agnostic: supports Vercel, Docker, Fly.io, Railway, and custom CI/CD. Use when deploying, setting up pipelines, or managing environments.From its SKILL.md
npx -y skills add chrsmay/codebrain-plugin --skill deployAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.2 KB, as published. Nobody here has run it
CodeBrain Deploy
Deployment orchestration and environment management. Platform-agnostic.
Usage
/codebrain:deploy [target]
- If target provided: deploy to that environment (staging, production)
- If no target: auto-detect from project config and ask
Pre-Deploy Checklist
Before any deployment, verify:
-
Build passes locally
npm run build 2>&1 | tail -5 # Should exit 0 with no errors -
Tests pass
npm test 2>&1 | tail -10 -
Environment variables are set
- Check
.env.exampleor.env.samplefor required vars - Verify all required vars are set in the target environment
- Never commit
.env.localor files containing secrets
- Check
-
No uncommitted changes
git status --porcelain # Should be empty -
Branch is up to date
git pull --rebase origin main
Platform Detection
Auto-detect deployment platform from project files:
| File | Platform |
|---|---|
vercel.json or .vercel/ | Vercel |
Dockerfile | Docker (+ any orchestrator) |
fly.toml | Fly.io |
railway.json | Railway |
netlify.toml | Netlify |
.github/workflows/deploy* | GitHub Actions (custom) |
Procfile | Heroku-compatible |
Deployment by Platform
Vercel
# Preview deployment
vercel
# Production deployment
vercel --prod
# Promote a preview to production (no rebuild)
vercel promote <deployment-url>
# Rollback to previous production
vercel rollback
# Pull environment variables
vercel env pull .env.local
# View deployment logs
vercel logs <deployment-url>
# Inspect deployment details
vercel inspect <deployment-url>
Docker
# Build image
docker build -t myapp:latest .
# Test locally
docker run -p 3000:3000 --env-file .env.local myapp:latest
# Push to registry
docker push registry.example.com/myapp:latest
Fly.io
# Deploy
fly deploy
# View logs
fly logs
# Scale
fly scale count 2
# Rollback
fly releases list
fly deploy --image registry.fly.io/myapp:v<N>
GitHub Actions CI/CD
# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm test
- run: npm run build
# Platform-specific deploy step here
Environment Variable Management
Hierarchy (most specific wins)
.env— base defaults (committed, no secrets).env.local— local overrides (gitignored, has secrets).env.production— production-specific (committed, no secrets).env.production.local— production secrets (gitignored)
Required vs Optional
Check for required variables before deploy:
# Extract required vars from code
grep -rh "process.env\.\w\+" --include="*.ts" --include="*.js" | \
grep -oP 'process\.env\.(\w+)' | sort -u
Compare against what's set in the target environment.
Rollback Procedure
-
Identify the last working deployment
vercel ls --limit 5 # or equivalent -
Rollback immediately (don't debug in production)
vercel rollback # or equivalent -
Verify rollback succeeded
- Check health endpoints
- Run smoke tests against production
- Check error monitoring (Sentry, etc.)
-
Investigate the failure separately
- Use
/codebrain:observeor/codebrain:investigate - Fix in a branch, test, then re-deploy
- Use
Post-Deploy Verification
After every deployment:
- Health check — hit the health endpoint
- Smoke test — test critical user flows
- Error monitoring — check Sentry/error tracker for new errors
- Performance — check response times haven't degraded
- Logs — watch logs for the first few minutes
Deployment Report Template
# Deployment Report
**Target:** [staging | production]
**Platform:** [Vercel | Docker | Fly.io | ...]
**Date:** [ISO date]
**Commit:** [short SHA + message]
**URL:** [deployment URL]
## Pre-Deploy Checks
| Check | Status |
|-------|--------|
| Build | PASS |
| Tests | PASS |
| Env Vars | PASS |
| Clean working tree | PASS |
## Deployment
- Command: `vercel --prod`
- Duration: [time]
- Status: SUCCESS | FAILED
## Post-Deploy Verification
| Check | Status | Notes |
|-------|--------|-------|
| Health endpoint | PASS | 200 OK in 120ms |
| Smoke tests | PASS | All critical flows work |
| Error monitoring | PASS | No new errors |
| Performance | PASS | p95 latency < 500ms |