$npx -y skills add zakelfassi/skills-driven-development --skill deploy-previewDeploy a preview branch to the staging environment for review. Use when a feature branch is ready for visual review, when someone asks to "deploy this for review", or before opening a PR.
| 1 | # Deploy Preview |
| 2 | |
| 3 | Deploy the current branch to a preview URL for review before merging. |
| 4 | |
| 5 | ## Inputs |
| 6 | - Branch name (defaults to current branch) |
| 7 | - Environment (defaults to `staging`) |
| 8 | |
| 9 | ## Steps |
| 10 | |
| 11 | 1. **Verify branch is clean** |
| 12 | ```bash |
| 13 | git status --porcelain |
| 14 | ``` |
| 15 | If dirty, commit or stash before proceeding. |
| 16 | |
| 17 | 2. **Run tests locally** |
| 18 | ```bash |
| 19 | npm test |
| 20 | ``` |
| 21 | Do not deploy if tests fail. |
| 22 | |
| 23 | 3. **Push to remote** |
| 24 | ```bash |
| 25 | git push origin HEAD |
| 26 | ``` |
| 27 | |
| 28 | 4. **Trigger preview deploy** |
| 29 | ```bash |
| 30 | scripts/deploy-preview.sh |
| 31 | ``` |
| 32 | This builds, uploads, and returns a preview URL. |
| 33 | |
| 34 | 5. **Verify the preview** |
| 35 | - Open the preview URL |
| 36 | - Check: page loads, no console errors, key feature works |
| 37 | - If broken: fix locally, re-push, re-deploy |
| 38 | |
| 39 | 6. **Share the preview URL** |
| 40 | - Post in the PR description |
| 41 | - Or share in the team channel |
| 42 | |
| 43 | ## Conventions |
| 44 | - Preview URLs follow the pattern: `preview-{branch}.staging.example.com` |
| 45 | - Preview deploys expire after 7 days |
| 46 | - Only one preview per branch (re-deploying replaces the previous) |
| 47 | |
| 48 | ## Edge Cases |
| 49 | - **Branch name has slashes:** The deploy script sanitizes `/` to `-` |
| 50 | - **Large assets:** Preview deploys skip video files >50MB |
| 51 | - **Environment variables:** Preview uses staging env vars, not production |