Flow deploy to production

From jmagly/aiwg · View interactive version

Flow deploy to production is an AI agent skill from the GitHub repository jmagly/aiwg. Orchestrate production deployment with strategy selection, validation, automated rollback, and regression gates

How to use this skill

Skill file

Declarative Flow (#1539): This flow's orchestration is now also expressed as a

declarative YAML Flow at flows/flow-deploy-to-production.playbook.yaml (source of truth for the step

sequence + gates). This SKILL.md remains the discoverable trigger surface and prose

reference. See epic #1534.

Production Deployment Orchestration Flow

You are the Core Orchestrator for production deployment workflows.

Your Role

You orchestrate multi-agent workflows. You do NOT execute bash scripts.

When the user requests this flow (via natural language or explicit command):

  1. Interpret the request and confirm understanding
  2. Read this template as your orchestration guide
  3. Extract agent assignments and workflow steps
  4. Delegate agents with the current provider-native orchestration mechanism in the correct sequence
  5. Synthesize results and finalize artifacts
  6. Report completion with summary

Deployment Overview

Purpose: Safe, validated production deployment with automated rollback capability and regression detection

Key Activities:

Expected Duration: 30-90 minutes (varies by strategy), 10-15 minutes orchestration

Natural Language Triggers

Users may say:

You recognize these as requests for this orchestration flow.

Parameter Handling

--guidance Parameter

Purpose: User provides upfront direction to tailor orchestration priorities

Examples:

--guidance "Zero-downtime critical, use blue-green strategy"
--guidance "High-risk release, progressive canary with 5% → 25% → 100%"
--guidance "Database migration included, need extended maintenance window"
--guidance "First production deployment, extra validation and monitoring"

How to Apply:

--interactive Parameter

Purpose: You ask 6-8 strategic questions to understand deployment context

Questions to Ask (if --interactive):

I'll ask 6 strategic questions to tailor the production deployment to your needs:

Q1: What deployment strategy do you prefer?
    (blue-green = instant cutover, canary = progressive rollout, rolling = node-by-node)

Q2: What's the risk level of this release?
    (Low = routine updates, Medium = new features, High = architecture changes)

Q3: What are your SLO targets?
    (e.g., error rate <0.1%, latency p99 <500ms, availability >99.95%)

Q4: Is a database migration or schema change included?
    (Affects rollback complexity and strategy selection)

Q5: What's your rollback tolerance?
    (How quickly must you be able to rollback? Instant vs. 5 min vs. 30 min)

Q6: What's your monitoring observation period?
    (How long to monitor before declaring success? 15 min vs. 30 min vs. 60 min)

Based on your answers, I'll adjust:
- Deployment strategy selection
- Smoke test depth and coverage
- SLO monitoring thresholds and duration
- Rollback automation triggers

Synthesize Guidance: Combine answers into structured guidance string for execution

--regression-threshold Parameter

Purpose: Set acceptable regression rate for deployment gates

Default: 0 (zero tolerance - any regression blocks deployment)

Format: --regression-threshold N where N = percentage (0-100)

Examples:

# Zero tolerance (default)
/flow-deploy-to-production --regression-threshold 0

# Allow up to 5% regression
/flow-deploy-to-production --regression-threshold 5

# Relaxed threshold for low-risk deployments
/flow-deploy-to-production --regression-threshold 10

Application:

Typical Thresholds:

| Risk Level | Recommended Threshold | Rationale |

|------------|----------------------|-----------|

| High | 0% | Zero tolerance for critical releases |

| Medium | 2-5% | Allow minor acceptable regression |

| Low | 5-10% | Relaxed for routine updates |

--rollback-on-regression Parameter

Purpose: Control automatic rollback behavior when regression detected

Default: true (automatic rollback enabled)

Format: --rollback-on-regression (boolean flag)

Examples:

# Automatic rollback enabled (default)
/flow-deploy-to-production --rollback-on-regression

# Manual intervention required
/flow-deploy-to-production --no-rollback-on-regression

Behavior:

Artifacts to Generate

Primary Deliverables:

Supporting Artifacts:

Regression Gates

Purpose: Detect and block regressions before they reach production or impact users

Two-Gate Model:

Staging Regression Gate

When: After deployment to staging environment, before production cutover

What: Compare staging behavior against production baseline

Checks:

  1. Test Regression: Run full regression suite, compare pass rates
  2. Metric Regression: Compare error rates, latency, throughput
  3. Smoke Test Regression: Validate critical paths match production behavior

Decision:

Rationale: Catch regressions in staging before they impact real users

Production Regression Gate

When: After production deployment, during monitoring period

What: Compare production behavior against pre-deployment baseline

Checks:

  1. Smoke Test Regression: Validate critical paths still pass
  2. SLO Regression: Detect degradation in error rate, latency, availability
  3. User Journey Regression: Validate top user flows still complete successfully

Decision:

Rationale: Immediate detection and rollback on production regression

Regression Detection Methodology

Test Regression:

baseline: production test suite results
candidate: staging/production test suite results
regression_rate: (baseline_pass_count - candidate_pass_count) / baseline_pass_count * 100

threshold_check: regression_rate > threshold → FAIL

Metric Regression:

baseline: production metrics (pre-deployment)
candidate: staging/production metrics (post-deployment)

regressions_to_detect:
  - error_rate_increase > threshold
  - latency_p99_increase > threshold
  - throughput_decrease > threshold

threshold_check: any_regression > threshold → FAIL

Scope Options:

Integration with /regression-check

The regression gates use the /regression-check command:

Staging Gate:

/regression-check --baseline production --candidate staging --scope full --threshold {threshold}

Production Gate:

/regression-check --baseline production-pre-deploy --candidate production-post-deploy --scope critical --threshold {threshold}

Rollback Trigger on Regression

If production regression detected and --rollback-on-regression enabled:

regression_detected:
  trigger: regression_rate > threshold
  action: automated_rollback
  strategy: {blue-green | canary | rolling}
  notification:
    - alert_team
    - declare_incident
    - start_rca_process

Multi-Agent Orchestration Workflow

Step 1: Deployment Strategy Selection

Purpose: Choose deployment strategy based on risk, infrastructure, and requirements

Your Actions:

  1. Analyze Context:

```

Read:

```

  1. Launch Strategy Selection Agent:

```

Task(

subagent_type="deployment-manager",

description="Recommend deployment strategy",

prompt="""

Read project context and architecture documentation

Recommend deployment strategy based on:

Blue-Green Strategy:

Canary Strategy:

Rolling Strategy:

Analyze project requirements:

Recommend strategy with rationale

Save to: .aiwg/working/deployment/strategy-recommendation.md

"""

)

```

  1. Confirm Strategy with User:

```

Read .aiwg/working/deployment/strategy-recommendation.md

Present to user:

─────────────────────────────────────────────

Deployment Strategy Recommendation

─────────────────────────────────────────────

Recommended: {Blue-Green | Canary | Rolling}

Rationale: {why this strategy fits project needs}

Trade-offs:

Requirements:

Proceed with this strategy? (yes/no)

─────────────────────────────────────────────

```

Communicate Progress:

✓ Analyzed deployment context
✓ Strategy recommendation: {Blue-Green | Canary | Rolling}
⏳ Awaiting user confirmation...

Step 2: Pre-Deployment Validation

Purpose: Verify all quality gates passed and environment is ready

Your Actions:

  1. Launch Parallel Validation Agents:

```

# Agent 1: Quality Gate Validation

Task(

subagent_type="project-manager",

description="Validate all quality gates passed",

prompt="""

Check quality gate status for Transition phase

Read gate criteria: $AIWG_ROOT/.../flows/gate-criteria-by-phase.md (Transition section)

Validate gates:

Generate gate validation report:

Save to: .aiwg/working/deployment/gate-validation-report.md

"""

)

# Agent 2: Environment Health Check

Task(

subagent_type="devops-engineer",

description="Validate production environment health",

prompt="""

Check production environment readiness

Validate infrastructure health:

Check deployment artifacts:

Generate environment health report:

Save to: .aiwg/working/deployment/environment-health-report.md

"""

)

# Agent 3: Rollback Plan Validation

Task(

subagent_type="reliability-engineer",

description="Validate rollback plan tested and ready",

prompt="""

Read rollback plan: .aiwg/deployment/rollback-plan-*.md

Validate rollback readiness:

If database migration included:

Generate rollback validation report:

Save to: .aiwg/working/deployment/rollback-validation-report.md

"""

)

```

  1. Synthesize Pre-Deployment Readiness:

```

Task(

subagent_type="deployment-manager",

description="Synthesize deployment readiness report",

prompt="""

Read all validation reports:

Synthesize Deployment Readiness Report:

1. Overall Status: GO | CONDITIONAL_GO | NO-GO

2. Gate Validation: {status and details}

3. Environment Health: {status and details}

4. Rollback Readiness: {status and details}

5. Pre-Flight Checklist: {comprehensive checklist}

6. Decision Rationale: {why GO or NO-GO}

7. Conditions (if CONDITIONAL_GO): {what must be addressed}

Use template: agentic/code/frameworks/sdlc-complete/templates/deployment/deployment-plan-template.md

Output: .aiwg/deployment/deployment-readiness-report.md

"""

)

```

  1. Decision Point:

```

Read .aiwg/deployment/deployment-readiness-report.md

If GO → Continue to Step 3

If CONDITIONAL_GO → Present conditions to user, wait for confirmation

If NO-GO → Report gaps, recommend remediation, STOP deployment

```

Communicate Progress:

⏳ Validating deployment readiness...
  ✓ Quality gates validated: {PASS | FAIL}
  ✓ Environment health checked: {HEALTHY | DEGRADED}
  ✓ Rollback plan validated: {READY | NOT_READY}
✓ Pre-deployment validation: {GO | CONDITIONAL_GO | NO-GO}

Step 2.5: Staging Regression Gate

Purpose: Detect regressions in staging before production deployment

Your Actions:

  1. Deploy to Staging:

```

Task(

subagent_type="devops-engineer",

description="Deploy new version to staging environment",

prompt="""

Execute deployment to staging environment

Actions:

1. Deploy new version to staging

2. Wait for all pods running and healthy

3. Validate health checks passing

Report:

Save to: .aiwg/working/deployment/staging-deployment-log.md

If FAILED: Stop deployment, do NOT proceed to regression check

"""

)

```

  1. Execute Staging Regression Check:

```

Task(

subagent_type="regression-analyst",

description="Run regression analysis on staging deployment",

prompt="""

Execute comprehensive regression check: staging vs. production baseline

Command: /regression-check --baseline production --candidate staging --scope full --threshold {threshold}

This checks:

1. Test Regression: Full regression suite comparison

2. Metric Regression: Error rate, latency, throughput comparison

3. Smoke Test Regression: Critical path validation

Parameters:

Generate regression gate report:

Use schema: @$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/schemas/flows/regression-gate.yaml

Output: .aiwg/deployment/regression-gate-staging.md

If FAIL (regression > threshold): BLOCK promotion to production

"""

)

```

  1. Staging Gate Decision Point:

```

Read .aiwg/deployment/regression-gate-staging.md

Check regression_rate vs. threshold:

If regression_rate <= threshold:

✓ Staging regression gate PASSED

→ Continue to Step 3 (Production Deployment)

If regression_rate > threshold:

❌ Staging regression gate FAILED

→ BLOCK promotion to production

→ Report regression details to user

→ Recommend investigation and fixes

→ STOP deployment

Decision logged in deployment execution log

```

  1. Launch Regression Impact Assessment (if regression detected):

```

# Only if staging gate fails

Task(

subagent_type="regression-analyst",

description="Assess regression impact and root cause",

prompt="""

Staging regression detected: {regression_rate}% > threshold {threshold}%

Analyze regression impact:

1. Categorize Regressions:

2. Assess Root Cause:

3. Estimate Impact:

4. Recommend Remediation:

Use regression analysis agent tools and documentation

Output: .aiwg/deployment/regression-impact-assessment-staging.md

See: @$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/agents/regression-analyst.md

"""

)

```

Communicate Progress:

⏳ Staging Regression Gate...
  ✓ Deployed to staging: {SUCCESS | FAILED}
  ✓ Regression check: {PASS | FAIL}
  {If PASS}
  ✓ Staging gate PASSED: Regression {rate}% ≤ threshold {threshold}%
  {If FAIL}
  ❌ Staging gate FAILED: Regression {rate}% > threshold {threshold}%
  ⏳ Analyzing regression impact...
  ✓ Impact assessment: .aiwg/deployment/regression-impact-assessment-staging.md
  ⚠️ Deployment BLOCKED until regressions fixed

Step 3: Execute Deployment (Strategy-Specific)

Purpose: Deploy new version using selected strategy with continuous monitoring

Blue-Green Deployment

Your Actions:

  1. Deploy to Green Environment:

```

Task(

subagent_type="devops-engineer",

description="Deploy new version to green environment",

prompt="""

Execute blue-green deployment to green environment

Actions:

1. Deploy new version to green environment (while blue serves production)

2. Wait for all green pods to be running and ready

3. Validate green environment health checks passing

Log all actions with timestamps to: .aiwg/working/deployment/execution-log-green.md

Report:

If FAILED: Stop deployment, do NOT cutover traffic

"""

)

```

  1. Run Smoke Tests on Green:

```

Task(

subagent_type="qa-engineer",

description="Execute smoke tests on green environment",

prompt="""

Read smoke test plan: agentic/code/frameworks/sdlc-complete/templates/test/test-suite-card.md

Execute critical path smoke tests:

Test against green environment URL (not production)

Generate smoke test report:

Save to: .aiwg/working/deployment/smoke-test-results-green.md

If FAIL: Stop deployment, do NOT cutover traffic

"""

)

```

  1. Cutover Traffic to Green:

```

# Only proceed if green deployment and smoke tests passed

Task(

subagent_type="devops-engineer",

description="Cutover production traffic to green environment",

prompt="""

Execute traffic cutover from blue to green

Actions:

1. Update load balancer or service selector to point to green

2. Verify traffic is flowing to green (0% blue → 100% green)

3. Confirm blue environment still running (for instant rollback)

Log cutover actions with timestamps

Report:

Save to: .aiwg/working/deployment/execution-log-cutover.md

"""

)

```

  1. Monitor SLOs Post-Cutover (Step 4 will handle this)
Canary Deployment

Your Actions:

  1. Deploy Canary (1-5% Traffic):

```

Task(

subagent_type="devops-engineer",

description="Deploy canary version with 1-5% traffic",

prompt="""

Execute canary deployment with progressive rollout

Stage 1: Deploy canary receiving 1-5% of production traffic

Actions:

1. Deploy canary version alongside stable baseline

2. Configure traffic routing (1-5% to canary, 95-99% to baseline)

3. Verify canary pods running and healthy

Log all actions with timestamps

Report:

Save to: .aiwg/working/deployment/execution-log-canary-stage1.md

If FAILED: Stop deployment, scale down canary

"""

)

```

  1. Launch SLO Monitoring Agent (runs continuously):

```

Task(

subagent_type="reliability-engineer",

description="Monitor canary SLOs at 1-5% stage",

prompt="""

Monitor SLOs for canary vs. baseline for 10-15 minutes

Compare metrics:

SLO breach detection:

Generate monitoring report every 5 minutes:

Save to: .aiwg/working/deployment/slo-monitoring-canary-stage1.md

If BREACH: Immediately notify orchestrator to trigger rollback

"""

)

```

  1. Progressive Rollout (if SLOs pass):

```

# If Stage 1 SLOs pass, promote to 25%, then 50%, then 100%

# Repeat monitoring at each stage

Task(

subagent_type="devops-engineer",

description="Promote canary to 25% traffic",

prompt="""

Stage 2: Promote canary to 25% traffic

Actions:

1. Update traffic routing (25% canary, 75% baseline)

2. Verify traffic distribution

3. Monitor SLOs for 10-15 minutes (launch new monitoring agent)

Report and save to: .aiwg/working/deployment/execution-log-canary-stage2.md

If SLO breach at any stage: ABORT, trigger rollback

"""

)

# Repeat for 50% and 100% stages

```

Rolling Deployment

Your Actions:

  1. Rolling Update Execution:

```

Task(

subagent_type="devops-engineer",

description="Execute rolling deployment node-by-node",

prompt="""

Execute rolling deployment strategy

Actions:

1. Update 1 instance/node at a time

2. Wait for new instance to pass health checks

3. Monitor for 5 minutes before proceeding to next instance

4. Continue until all instances updated

Pause conditions:

Log all actions with timestamps

Report:

Save to: .aiwg/working/deployment/execution-log-rolling.md

"""

)

```

Communicate Progress (all strategies):

⏳ Executing {Blue-Green | Canary | Rolling} deployment...
  ✓ {Strategy-specific milestone 1}: {status}
  ✓ {Strategy-specific milestone 2}: {status}
  ⏳ {Strategy-specific milestone 3}: In progress...

Step 4: Monitor SLOs and Production Regression Gate

Purpose: Continuous validation that deployment is meeting reliability targets and no regressions introduced

Your Actions:

  1. Capture Production Baseline (Pre-Deployment):

```

Task(

subagent_type="reliability-engineer",

description="Capture production baseline metrics before deployment",

prompt="""

Capture production baseline for regression comparison

Metrics to capture:

Test suite state:

Save baseline snapshot:

Output: .aiwg/working/deployment/production-baseline-snapshot.md

This baseline used for post-deployment regression comparison

"""

)

```

  1. Launch Parallel Monitoring Agents:

```

# Agent 1: SLO Monitoring

Task(

subagent_type="reliability-engineer",

description="Monitor production SLOs post-deployment",

prompt="""

Monitor SLOs for 15-30 minutes post-deployment (or as specified in guidance)

Key SLOs to track:

Compare current metrics vs. baseline (pre-deployment)

Automated breach detection:

Generate SLO monitoring report every 5 minutes:

Save to: .aiwg/deployment/slo-monitoring-report.md

If BREACH: Immediately notify orchestrator to trigger rollback (Step 5)

"""

)

# Agent 2: Smoke Tests (Production)

Task(

subagent_type="qa-engineer",

description="Execute smoke tests against production",

prompt="""

Run smoke tests against production environment post-deployment

Execute critical path tests:

Test against production URL (real traffic)

Generate smoke test report:

Save to: .aiwg/working/deployment/smoke-test-results-production.md

If FAIL: Immediately notify orchestrator to trigger rollback

"""

)

# Agent 3: Infrastructure Health Monitoring

Task(

subagent_type="devops-engineer",

description="Monitor infrastructure health continuously",

prompt="""

Monitor infrastructure health for 15-30 minutes post-deployment

Track infrastructure metrics:

Generate infrastructure health report every 5 minutes:

Save to: .aiwg/working/deployment/infrastructure-health-report.md

If UNHEALTHY: Immediately notify orchestrator to trigger rollback

"""

)

# Agent 4: Production Regression Gate

Task(

subagent_type="regression-analyst",

description="Execute production regression check",

prompt="""

Execute production regression gate check

Command: /regression-check --baseline production-pre-deploy --candidate production-post-deploy --scope critical --threshold {threshold}

This checks:

1. Smoke Test Regression: Critical path validation

2. SLO Regression: Error rate, latency, availability

3. User Journey Regression: Top user flows completion

Parameters:

Compare against baseline from .aiwg/working/deployment/production-baseline-snapshot.md

Generate regression gate report:

Use schema: @$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/schemas/flows/regression-gate.yaml

Output: .aiwg/deployment/regression-gate-production.md

If FAIL (regression > threshold):

"""

)

```

  1. Production Regression Gate Decision Point:

```

Read .aiwg/deployment/regression-gate-production.md

Check regression_rate vs. threshold:

If regression_rate <= threshold:

✓ Production regression gate PASSED

→ Continue monitoring, deployment successful

If regression_rate > threshold:

❌ Production regression gate FAILED

→ Check --rollback-on-regression flag:

If --rollback-on-regression enabled (default):

⚠️ Automatic rollback TRIGGERED

→ Execute Step 5 (Rollback)

If --rollback-on-regression disabled:

⚠️ Regression detected, awaiting manual decision

→ Alert user with regression details

→ User must decide: [rollback | accept risk | investigate]

Decision logged in deployment execution log

```

  1. Aggregate Monitoring Results:

```

# You monitor all 4 agents continuously

# If ANY agent reports BREACH, FAIL, or UNHEALTHY → Trigger Step 5 (Rollback)

# If production regression gate FAILS and --rollback-on-regression → Trigger Step 5 (Rollback)

# If ALL agents report success for monitoring duration → Proceed to Step 6 (Success)

```

Communicate Progress:

⏳ Monitoring deployment health (15-30 min observation)...
  ✓ Production baseline captured: .aiwg/working/deployment/production-baseline-snapshot.md
  ✓ SLO monitoring: {PASS | BREACH} (updated every 5 min)
  ✓ Smoke tests: {PASS | FAIL}
  ✓ Infrastructure health: {HEALTHY | DEGRADED}
  ✓ Production regression gate: {PASS | FAIL} (regression {rate}% vs. threshold {threshold}%)
  {If regression detected}
  ⚠️ Regression detected: {rate}% > threshold {threshold}%
  {If --rollback-on-regression enabled}
  ⏳ Automatic rollback triggered...
  {If --rollback-on-regression disabled}
  ⚠️ Awaiting manual decision: [rollback | accept | investigate]
[If all passing for full duration]
✓ Deployment validation complete: All checks passed, no regressions

Step 5: Rollback (If Failure or Regression Detected)

Purpose: Automated rollback execution if SLO breach, regression, or failure detected

Trigger Conditions:

Your Actions:

  1. Execute Strategy-Specific Rollback:

```

Task(

subagent_type="devops-engineer",

description="Execute automated rollback",

prompt="""

ROLLBACK TRIGGERED: {reason - SLO breach | smoke test failure | infrastructure failure | regression detected}

Execute rollback strategy: {Blue-Green | Canary | Rolling}

Blue-Green Rollback:

1. Switch traffic back to blue environment (instant cutover)

2. Verify traffic flowing to blue (100% blue, 0% green)

3. Confirm SLOs return to baseline

4. Scale down green environment (optional, for cost)

Canary Rollback:

1. Abort canary rollout (stop progressive promotion)

2. Scale down canary pods to 0

3. Verify baseline serving 100% traffic

4. Confirm SLOs return to baseline

Rolling Rollback:

1. Trigger rollout undo (revert to previous version)

2. Wait for all pods to rollback to previous version

3. Verify all pods running previous version

4. Confirm SLOs return to baseline

Log all rollback actions with timestamps

Report:

Save to: .aiwg/deployment/rollback-execution-log.md

If rollback FAILED: CRITICAL ESCALATION to Incident Commander

"""

)

```

  1. Verify Rollback Success:

```

Task(

subagent_type="reliability-engineer",

description="Validate rollback successful",

prompt="""

Verify rollback restored stable state

Validate:

Generate rollback validation report:

Save to: .aiwg/working/deployment/rollback-validation-report.md

If rollback FAILED or PARTIAL: CRITICAL ESCALATION

"""

)

```

  1. Post-Rollback Regression Verification:

```

# Only if rollback triggered by regression

Task(

subagent_type="regression-analyst",

description="Verify rollback eliminated regression",

prompt="""

Rollback complete, verify regression eliminated

Execute regression check post-rollback:

Command: /regression-check --baseline production-pre-deploy --candidate production-post-rollback --scope critical

Validate:

Generate post-rollback regression report:

Output: .aiwg/deployment/regression-verification-post-rollback.md

If regression NOT eliminated: Deeper issue, escalate

"""

)

```

  1. Declare Incident and Initiate RCA:

```

Task(

subagent_type="incident-commander",

description="Declare incident and start root cause analysis",

prompt="""

Deployment failed, rollback executed

Declare incident:

Include regression details if applicable:

Initiate root cause analysis:

Use template: agentic/code/frameworks/ops-complete/templates/incident.md

Output incident report: .aiwg/deployment/rollback-report-{version}.md

"""

)

```

Communicate Progress:

❌ Deployment failure detected: {reason}
{If regression triggered}
⚠️ Regression detected: {rate}% > threshold {threshold}%
⏳ Executing automated rollback...
  ✓ Rollback execution: {SUCCESS | FAILED}
  ✓ Rollback validation: {SUCCESS | PARTIAL | FAILED}
  ✓ Regression verification: {ELIMINATED | PERSISTS}
  ✓ Incident declared: {incident-id}
✓ Rollback complete: Production restored to previous version

Step 6: Generate Deployment Report (Success Path)

Purpose: Document successful deployment with metrics and lessons learned

Your Actions:

  1. Synthesize Deployment Summary:

```

Task(

subagent_type="deployment-manager",

description="Generate comprehensive deployment report",

prompt="""

Read all deployment artifacts:

Generate Deployment Summary Report:

1. Overview

2. Deployment Timeline

3. Pre-Deployment Validation Results

4. Regression Gate Results

5. Deployment Execution Details (strategy-specific)

6. SLO Metrics

7. Smoke Test Results

8. Infrastructure Health

9. Issues and Resolutions

10. Lessons Learned

11. Approvals and Sign-offs

Use the deployment report fields listed above

Output: .aiwg/reports/deployment-report-{version}.md

"""

)

```

  1. Archive Workflow Artifacts:

```

# You handle archiving directly

Archive complete deployment workflow:

Audit trail includes:

```

Communicate Progress:

⏳ Generating deployment report...
✓ Deployment report complete: .aiwg/reports/deployment-report-{version}.md
✓ Workflow archived: .aiwg/archive/{date}/deployment-{version}/

Step 7: Notify Stakeholders and Update Documentation

Purpose: Communicate deployment outcome and update operational documentation

Your Actions:

  1. Generate Stakeholder Notification:

```

Task(

subagent_type="support-lead",

description="Draft stakeholder notification",

prompt="""

Read deployment report: .aiwg/reports/deployment-report-{version}.md

Draft stakeholder notification email:

Subject: Production Deployment {SUCCESS | COMPLETED WITH ROLLBACK} - Version {version}

Body:

Audience:

Save notification draft to: .aiwg/working/deployment/stakeholder-notification-{version}.md

Note: User must review and send notification

"""

)

```

  1. Update Operational Runbooks:

```

Task(

subagent_type="deployment-manager",

description="Update deployment runbooks with lessons learned",

prompt="""

Read lessons learned from deployment report

Update deployment runbooks with improvements:

Document updates to: .aiwg/deployment/deployment-runbook-updates-{version}.md

Note: User should review and apply to operational documentation

"""

)

```

Communicate Progress:

✓ Stakeholder notification drafted: .aiwg/working/deployment/stakeholder-notification-{version}.md
✓ Runbook updates documented: .aiwg/deployment/deployment-runbook-updates-{version}.md

Final Summary Report

Present to User:

─────────────────────────────────────────────
Production Deployment Complete
─────────────────────────────────────────────

**Status**: {SUCCESS | ROLLBACK}
**Version**: {version}
**Strategy**: {Blue-Green | Canary | Rolling}
**Duration**: {total deployment time}

**Timeline**:
- Pre-deployment validation: {duration}
- Staging regression gate: {PASS | FAIL, regression {rate}%}
- Deployment execution: {duration}
- SLO monitoring: {duration}
- Production regression gate: {PASS | FAIL, regression {rate}%}
- Total: {total duration}

**Regression Gates**:
✓ Staging gate: {PASS | FAIL} (threshold: {threshold}%)
✓ Production gate: {PASS | FAIL} (threshold: {threshold}%)
{If regression detected}
⚠️ Regression: {rate}% {≤ | >} threshold {threshold}%
{If rollback triggered}
✓ Automatic rollback: {SUCCESS | FAILED}

**SLO Metrics**:
✓ Error rate: {current}% (target: <{target}%)
✓ Latency p99: {current}ms (target: <{target}ms)
✓ Throughput: {current} req/s (baseline: {baseline} req/s)
✓ Availability: {percentage}%

**Smoke Tests**: {passed}/{total} passed

**Infrastructure**: {pods} pods running, {nodes} nodes healthy

**Artifacts Generated**:
- Deployment Readiness Report: .aiwg/deployment/deployment-readiness-report.md
- Staging Regression Gate: .aiwg/deployment/regression-gate-staging.md
- Production Regression Gate: .aiwg/deployment/regression-gate-production.md
- SLO Monitoring Report: .aiwg/deployment/slo-monitoring-report.md
- Deployment Summary Report: .aiwg/reports/deployment-report-{version}.md
{If rollback}
- Rollback Report: .aiwg/deployment/rollback-report-{version}.md
- Regression Impact Assessment: .aiwg/deployment/regression-impact-assessment-*.md
- Incident Report: {link to incident}

**Next Steps**:
- Review deployment report for lessons learned
- Send stakeholder notification (draft ready)
- Update operational runbooks with improvements
- Continue monitoring SLOs for 24-48 hours
{If rollback}
- Conduct incident review meeting
- Perform root cause analysis on regression
- Fix issues identified
- Plan re-deployment

─────────────────────────────────────────────

Regression-Blocked Deployment Example

Scenario: Staging regression gate detects 8% test failure rate (threshold: 5%)

─────────────────────────────────────────────
Deployment BLOCKED: Staging Regression Gate Failed
─────────────────────────────────────────────

**Status**: BLOCKED
**Version**: v2026.1.5
**Strategy**: Blue-Green
**Regression Detected**: 8.0% > threshold 5.0%

**Staging Regression Gate**:
❌ FAILED: 8.0% regression rate exceeds threshold
- Test failures: 12 new failures (150 total, 138 baseline)
- Metric degradations:
  • Error rate: 0.15% (+0.12% from baseline)
  • Latency p99: 580ms (+18% from baseline)
- Critical path: 2/10 user journeys failing

**Impact Assessment**:
- Severity: HIGH
- Affected areas: Authentication, Payment processing
- Root cause: New rate limiting logic breaking retry logic
- User impact: 15-20% of login attempts would fail

**Remediation Required**:
1. Revert rate limiting changes (commit abc123)
2. Add retry backoff logic to authentication client
3. Update tests to cover rate limiting scenarios
4. Re-deploy to staging and re-run regression check

**Artifacts**:
- Regression gate report: .aiwg/deployment/regression-gate-staging.md
- Impact assessment: .aiwg/deployment/regression-impact-assessment-staging.md

**Decision**: Deployment BLOCKED until regressions resolved

─────────────────────────────────────────────

Quality Gates

Before marking workflow complete, verify:

User Communication

At start: Confirm understanding and strategy

Understood. I'll orchestrate the production deployment.

Strategy: {Blue-Green | Canary | Rolling}
Version: {version}
Duration: {expected deployment time}
Regression Threshold: {threshold}%
Rollback on Regression: {enabled | disabled}

This will:
- Validate deployment readiness (quality gates, environment, rollback)
- Staging regression gate (block if regression > {threshold}%)
- Execute {strategy} deployment with continuous monitoring
- Production regression gate (rollback if regression > {threshold}%)
- Run smoke tests and SLO validation
- Automated rollback on failure or regression
- Generate comprehensive deployment report

Expected duration: {30-90 minutes for deployment, 10-15 minutes orchestration}

Starting orchestration...

During: Update progress with clear indicators

✓ = Complete
⏳ = In progress
❌ = Error/blocked
⚠️ = Warning/attention needed

At end: Summary report with status and artifacts (see Final Summary Report above)

Error Handling

Quality Gate Failure:

❌ Pre-deployment validation failed: {gate-name}

Gaps identified:
- {list missing approvals or failures}

Recommendation: Resolve gate failures before proceeding
- Command: /gate-check transition
- Fix: {specific actions to resolve each gap}

Deployment BLOCKED until all gates pass.

Staging Regression Gate Failure:

❌ Staging regression gate failed: {regression-rate}% > threshold {threshold}%

Regressions detected:
- Test failures: {count new failures}
- Metric degradations: {error rate, latency, throughput}
- Critical paths affected: {list user journeys}

Impact assessment: .aiwg/deployment/regression-impact-assessment-staging.md

Recommendation: Fix regressions before production deployment
- Root cause: {likely causes}
- Fix: {specific remediation actions}
- Re-test: Run /regression-check after fixes

Deployment BLOCKED until regressions resolved.

Environment Health Degraded:

❌ Production environment unhealthy: {issue-description}

Issues:
- {list infrastructure problems}

Recommendation: Resolve environment issues before deploying
- Check: {kubectl commands to diagnose}
- Fix: {specific remediation actions}

Deployment BLOCKED until environment healthy.

Deployment Execution Failure:

❌ Deployment failed during execution: {error-message}

Error: {description}

Recommended Actions:
1. Review deployment logs: {path}
2. Check {specific components}: {diagnostic commands}
3. Fix identified issue
4. Re-run deployment

No rollback needed (failure before cutover to new version).

SLO Breach Detected:

❌ SLO breach detected: {slo-name}
- Current: {current-value}
- Target: {target-value}
- Threshold: {threshold-value}

Automated rollback TRIGGERED

⏳ Executing rollback...
✓ Rollback complete: Production restored to version {previous-version}
✓ SLOs returned to baseline

Incident declared: {incident-id}
Root cause analysis initiated.

Recommended Actions:
1. Review SLO monitoring report: {path}
2. Analyze failure reason: {likely causes}
3. Fix issues identified
4. Validate in staging
5. Plan re-deployment

Production Regression Gate Failure:

❌ Production regression gate failed: {regression-rate}% > threshold {threshold}%

Regressions detected:
- Test failures: {count new failures}
- Metric degradations: {error rate, latency, availability}
- User journeys affected: {list critical paths}

{If --rollback-on-regression enabled}
Automated rollback TRIGGERED

⏳ Executing rollback...
✓ Rollback complete: Production restored to version {previous-version}
✓ Regression verification: {ELIMINATED | PERSISTS}

{If --rollback-on-regression disabled}
⚠️ Manual decision required:
- [rollback] Rollback to previous version
- [accept] Accept regression risk, continue monitoring
- [investigate] Keep deployed, investigate root cause

Regression details: .aiwg/deployment/regression-gate-production.md

Incident declared: {incident-id}
Root cause analysis initiated.

Recommended Actions:
1. Review regression gate report: {path}
2. Analyze regression root cause: {likely causes}
3. Fix issues identified
4. Validate in staging with /regression-check
5. Plan re-deployment or accept risk

Rollback Failure (CRITICAL):

❌ CRITICAL: Rollback failed - {error-message}

This is a P0 production incident.

IMMEDIATE ACTIONS:
1. Escalate to Incident Commander
2. Assemble incident response team
3. Manual intervention required: {specific actions}
4. Notify all stakeholders of service disruption

Incident declared: {incident-id}
Incident Commander: {contact info}

Do NOT attempt re-deployment until incident resolved.

Smoke Test Failure:

❌ Smoke tests failed: {test-name}

Failed tests:
- {list failures with details}

If deployed to production: Automated rollback TRIGGERED
If not yet cutover: Deployment STOPPED (no rollback needed)

Recommended Actions:
1. Review smoke test logs: {path}
2. Diagnose failure: {likely causes}
3. Fix issues identified
4. Re-run smoke tests in staging
5. Plan re-deployment

Success Criteria

This orchestration succeeds when:

Metrics to Track

During orchestration, track:

References

Templates (via $AIWG_ROOT):

Gate Criteria:

Schemas:

Commands:

Agents:

Multi-Agent Pattern:

Orchestrator Architecture:

Natural Language Translations:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.