Guides manual staging validation before production deployment through smoke tests, critical user flow testing, data migration verification, and rollback capability checks...
This skill orchestrates the staging validation phase, which occurs after /ship-staging and before /ship-prod in the staging-prod deployment workflow.
Core responsibilities:
Inputs: Staging deployment (URL, deployment ID, migration results) Outputs: Validation report, sign-off decision, state.yaml update Expected duration: 30-60 minutes
Run smoke tests - Execute automated smoke test suite on staging URL
npm run test:smoke -- --url=$STAGING_URL
Verify: homepage loads (200), API health endpoint (200), database connection
Test critical user flows - Manual testing of core functionality
Verify data migrations - Check staging database for migration results
# Connect to staging database
psql $STAGING_DATABASE_URL -c "SELECT version FROM alembic_version;"
# Verify tables, columns, constraints match expectations
Test rollback capability - Execute actual rollback test
# Rollback to previous deployment
vercel rollback $PREVIOUS_DEPLOYMENT_ID
# Verify previous version is live
# Roll forward to current deployment
vercel promote $CURRENT_DEPLOYMENT_ID
Document sign-off - Update state.yaml
manual_gates:
staging_validation:
status: approved # or rejected
approver: "Your Name"
timestamp: "2025-11-19T10:30:00Z"
blockers: [] # or list of issues if rejected
Key principle: Test as if this is production. All failures must be fixed before production deployment.
See deployment-strategy.md in project docs for platform-specific rollback procedures.
Execute smoke test suite on staging environment.
Smoke Test Suite:
# Run smoke tests against staging URL
npm run test:smoke -- --url=$STAGING_URL
# Typical smoke tests include:
# - Homepage loads (HTTP 200, no errors in console)
# - API health endpoint responds (GET /api/health → 200)
# - Database connection established (health check includes DB ping)
# - Static assets load (CSS, JS, images)
# - Authentication page accessible (GET /login → 200)
Success Criteria:
If smoke tests fail:
Quality Check: Smoke tests provide quick confidence that deployment is functional, not a comprehensive test.
Manually test essential user journeys on staging.
Authentication Flow:
1. Navigate to staging URL
2. Click "Login" or navigate to /login
3. Enter test credentials (test@example.com / test-password)
4. Verify successful login (redirects to dashboard, user menu shows)
5. Click "Logout"
6. Verify successful logout (redirects to homepage, user menu gone)
7. Test password reset flow (request reset, receive email, change password)
Core Feature Flow (feature-specific):
Example for "Student Progress Dashboard" feature:
1. Login as teacher
2. Navigate to /dashboard
3. Verify student list loads (check for >0 students)
4. Click on student name
5. Verify progress details load (completion rate, lessons, grades)
6. Test filters (by class, by date range)
7. Verify data accuracy (spot-check 3 students against database)
Payment Processing Flow (if applicable):
1. Add item to cart
2. Proceed to checkout
3. Enter test payment credentials (Stripe test mode)
4. Submit payment
5. Verify success confirmation
6. Verify order appears in user account
7. Verify payment recorded in admin panel
Data CRUD Operations:
1. Create: Add new entity (student, lesson, order)
2. Read: View entity details
3. Update: Edit entity details, save changes
4. Delete: Remove entity, verify removal
5. Verify persistence: Reload page, confirm changes persisted
Success Criteria:
Quality Check: Test flows that represent 80% of user activity. Don't test every edge case.
Check that database migrations executed successfully in staging.
Migration Verification:
# Connect to staging database
psql $STAGING_DATABASE_URL
# Check migration version
SELECT version FROM alembic_version;
# Expected: Latest migration version (e.g., 4f3a2b1c5d6e)
# Verify schema changes
\d+ users # Describe users table
# Check for expected columns, constraints, indexes
# Verify data migrations
SELECT COUNT(*) FROM users WHERE email_verified IS NOT NULL;
# Check backfill operations completed
Schema Validation:
Data Validation:
Success Criteria:
If migrations failed:
Quality Check: Migrations are critical. A failed migration in production is catastrophic.
Execute actual rollback test to verify production safety net.
Rollback Test Procedure:
Step 4a: Identify Previous Deployment:
# For Vercel deployments
vercel list --limit=5
# Find previous production deployment ID
# Store IDs
CURRENT_DEPLOYMENT_ID="<current-staging-deployment>"
PREVIOUS_DEPLOYMENT_ID="<previous-production-deployment>"
Step 4b: Execute Rollback:
# Rollback to previous deployment
vercel rollback $PREVIOUS_DEPLOYMENT_ID --yes
# Or via CLI:
vercel alias set $PREVIOUS_DEPLOYMENT_ID <staging-alias>
Step 4c: Verify Previous Version Live:
1. Navigate to staging URL
2. Verify previous version is live (check version number, feature presence)
3. Test critical flow to confirm functionality
4. Document: "Rollback successful, previous version ($PREVIOUS_DEPLOYMENT_ID) is live"
Step 4d: Roll Forward:
# Restore current deployment
vercel alias set $CURRENT_DEPLOYMENT_ID <staging-alias>
Step 4e: Verify Current Version Restored:
1. Navigate to staging URL
2. Verify current version is live (feature present)
3. Test critical flow to confirm functionality
4. Document: "Roll-forward successful, current version ($CURRENT_DEPLOYMENT_ID) is live"
Success Criteria:
If rollback test fails:
Quality Check: Rollback capability is the safety net for production. Must work reliably.
Update state.yaml with validation results and approval decision.
Approval Criteria:
Sign-off as "approved" ONLY if:
- All smoke tests pass (0 failures)
- All critical user flows complete without errors
- Data migrations verified successfully
- Rollback test succeeds (rollback + roll-forward verified)
- No blocking bugs found during manual testing
Rejection Criteria:
Sign-off as "rejected" if ANY of:
- Smoke tests fail
- Critical user flows broken (authentication fails, core feature broken)
- Data migrations failed or incomplete
- Rollback test fails
- Blocking bugs found (security issue, data corruption, critical UX bug)
state.yaml Update:
Approval Example:
manual_gates:
staging_validation:
status: approved
approver: "Jane Smith"
timestamp: "2025-11-19T14:30:00Z"
validation_summary:
smoke_tests: "All passed (8/8)"
critical_flows: "All verified (authentication, dashboard, payments)"
migrations: "Version 4f3a2b verified, schema changes confirmed"
rollback_test: "Successful (rollback to dpl_abc123, roll-forward to dpl_xyz789)"
blockers: []
Rejection Example:
manual_gates:
staging_validation:
status: rejected
approver: "Jane Smith"
timestamp: "2025-11-19T14:30:00Z"
validation_summary:
smoke_tests: "1 failure (API health endpoint returned 503)"
critical_flows: "Authentication broken (login redirects to 404)"
migrations: "Verified"
rollback_test: "Not attempted (smoke tests failed)"
blockers:
- "API health endpoint failing (503 error)"
- "Login flow broken (404 on redirect)"
Next Steps After Sign-Off:
/ship-prod to deploy to production/implement, fix blockers, re-deploy to staging, re-run validationQuality Check: Sign-off must be explicit, documented, and traceable. No verbal approvals.
During validation:
Post-validation:
Bad staging validation:
Scenario:
Tester: "I checked the homepage, looks good!"
Reality: API returns 500 errors, authentication broken, database connection failing
Result: Production deployment breaks core functionality
Prevention:
Good Practice:
npm run test:smoke -- --url=$STAGING_URL
# Verifies: homepage (200), API health (200), DB connection (success), auth page (200)
Scenario:
Slack message: "Staging looks good 👍"
Result: No documented approval, unclear who approved, no timestamp, no validation summary
Prevention:
Good Practice:
manual_gates:
staging_validation:
status: approved
approver: "Jane Smith"
timestamp: "2025-11-19T14:30:00Z"
validation_summary: "All tests pass, rollback verified"
Scenario:
Tester: "Rollback should work, Vercel has rollback feature"
Reality: Rollback deployed but DNS not updated, or deployment ID incorrect, or database migration not reversible
Result: Production incident, attempted rollback fails, extended downtime
Prevention:
Good Practice:
# Actual rollback test
vercel rollback $PREVIOUS_ID
# Verify previous version live (manual test)
vercel alias set $CURRENT_ID staging
# Verify current version restored (manual test)
Scenario:
Tester: "Login is broken but we'll fix it in a hotfix"
Result: Production users cannot login, support tickets spike, revenue impacted
Prevention:
Good Practice:
status: rejected
blockers:
- "Login redirects to 404 (critical - blocks all users)"
next_steps: "Fix login redirect, re-deploy to staging, re-validate"
Scenario:
Tester: "Validated in 10 minutes, good to go"
Reality: Only tested happy path, missed edge cases, didn't verify migrations
Result: Production deployment fails on edge cases (null values, missing data, concurrent users)
Prevention:
Good Practice:
30-60 minute validation:
- 10 min: Smoke tests
- 15 min: Critical user flows (auth, core feature, payments)
- 10 min: Data migration verification
- 10 min: Rollback test
- 5 min: Document sign-off
Approach:
npm run test:smoke -- --url=$STAGING_URLBenefits:
Example:
// tests/smoke.test.js
describe("Smoke Tests", () => {
const baseURL = process.env.TEST_URL || "http://localhost:3000";
test("homepage loads", async () => {
const response = await fetch(baseURL);
expect(response.status).toBe(200);
});
test("API health endpoint responds", async () => {
const response = await fetch(`${baseURL}/api/health`);
expect(response.status).toBe(200);
const data = await response.json();
expect(data.database).toBe("connected");
});
});
Approach:
Benefits:
Example Checklist:
Authentication Flow:
- [ ] Login with valid credentials succeeds
- [ ] Login with invalid credentials fails (shows error)
- [ ] Logout succeeds (session cleared)
- [ ] Password reset email sent
- [ ] Password reset link works
- [ ] New password accepted
Approach:
Benefits:
Example:
# Rollback test
PREVIOUS_ID=$(vercel list --limit=5 | grep production | head -1 | awk '{print $1}')
vercel rollback $PREVIOUS_ID
# Manual verification: Navigate to staging, confirm previous version live
vercel alias set $CURRENT_ID staging
# Manual verification: Navigate to staging, confirm current version live
Ready to proceed when:
/ship-prod to deploy to production/implement, fix blockers, re-deploy to staging, re-run validationIssue: Critical user flow broken (authentication, core feature) Solution: Mark validation as "rejected", document blocker, return to /implement to fix, re-deploy to staging, re-validate
Issue: Data migrations not showing in staging database Solution: Check deployment logs for migration errors, verify migration scripts syntax, manually run migrations on staging if needed
Issue: Rollback test fails (previous version not live) Solution: Verify deployment IDs correct, check alias/DNS configuration, test rollback procedure manually, update deployment scripts if needed
Issue: Unclear what to test (no critical flows documented) Solution: Review spec.md for feature requirements, identify essential user workflows (authentication always critical), create flow checklist, document for future validations
Issue: Validation taking >90 minutes (too long) Solution: Focus on critical flows only (don't test every edge case), automate smoke tests (don't test manually), parallelize testing where possible, skip exhaustive testing (save for QA phase)
Deployment Procedures: Project-specific deployment documentation
.github/workflows/deploy-staging.yml for deployment automationdocs/project/deployment-strategy.md for platform-specific rollback stepsalembic/README.md for migration best practicesTesting Guides:
tests/smoke/README.md for smoke test suite documentationdocs/performance-budgets.md for performance targetsQuality Gates:
Next phase after staging validation:
/ship-prod (deploy to production, run production smoke tests, finalize)/implement (fix blockers, re-deploy to staging, re-run /validate-staging)