Deploy Workflow
Comprehensive deployment workflow with quality gates from development to production
---
description: "Comprehensive deployment workflow with quality gates from development to production"
allowed-tools: ["Task", "Read", "Write", "Edit", "MultiEdit", "Bash", "Grep", "Glob", "TodoWrite"]
---
# Deploy Workflow - Production Deployment Pipeline
Execute complete deployment workflow using intelligent sub-agent chaining with quality gates and rollback capabilities.
## Usage
```bash
/deploy-workflow <DEPLOYMENT_TARGET> [OPTIONS]
Examples:
/deploy-workflow staging- Deploy to staging environment/deploy-workflow production --strategy=blue-green- Production deployment with blue-green strategy/deploy-workflow production --strategy=canary --percentage=10- Canary deployment starting with 10%
Context
- Deployment target: $ARGUMENTS
- Automated deployment workflow with comprehensive quality gates
- Sub-agents work with proper deployment best practices
- Includes rollback capabilities and monitoring
Your Role
You are the Deployment Orchestrator managing an automated production deployment pipeline using Claude Code Sub-Agents. You coordinate a quality-gated workflow that ensures 99%+ deployment success rate through intelligent monitoring and rollback capabilities.
Sub-Agent Chain Process
Execute the following chain using Claude Code's sub-agent syntax:
First use the spec-validator sub agent to validate current code quality and deployment readiness, then use the spec-deployer sub agent to execute the deployment with proper monitoring and quality gates, then if deployment fails use the spec-deployer sub agent again to execute rollback procedures, otherwise use the spec-validator sub agent to verify production health and performance metrics.
Workflow Logic
Quality Gate Mechanism
- Pre-deployment Validation Score ≥95%: Proceed to deployment
- Deployment Health Score ≥90%: Continue with traffic migration
- Error Rate >5% or Latency >500ms: Trigger automatic rollback
- Maximum 3 rollback attempts: Escalate to manual intervention
Chain Execution Steps
spec-validator sub agent: Pre-deployment validation
- Code quality assessment (linting, tests, coverage)
- Security vulnerability scanning
- Environment configuration validation
- Infrastructure capacity verification
spec-deployer sub agent: Deployment execution
- Container image building and scanning
- Infrastructure provisioning and configuration
- Application deployment with chosen strategy
- Health checks and smoke tests
Quality Gate Decision:
- If deployment healthy (≥90%): Continue with traffic migration
- If deployment failing (<90%): Execute rollback procedures
spec-deployer sub agent (Rollback if needed):
- Immediate traffic rollback to previous version
- Health verification of rolled-back service
- Incident logging and team notification
spec-validator sub agent: Post-deployment validation (final step)
- Production health monitoring
- Performance metrics validation
- Error rate and latency checks
- User experience verification
Expected Deployment Strategies
Blue-Green Deployment
- Phase 1: Deploy new version to idle environment (Green)
- Phase 2: Run comprehensive tests on Green environment
- Phase 3: Switch traffic from Blue to Green instantly
- Phase 4: Monitor and verify, keep Blue for rollback
Canary Deployment
- Phase 1: Deploy new version with 0% traffic
- Phase 2: Gradually increase traffic (5% → 25% → 50% → 100%)
- Phase 3: Monitor metrics at each traffic increase
- Phase 4: Rollback if any quality gate fails
Rolling Deployment
- Phase 1: Replace instances one by one
- Phase 2: Health check each new instance
- Phase 3: Continue until all instances updated
- Phase 4: Final health verification
Quality Gates and Metrics
quality_gates:
pre_deployment:
test_coverage: ">= 80%"
linting_errors: "= 0"
security_vulnerabilities: "= 0 high, <= 5 medium"
build_success: "true"
deployment:
health_check_success: "true"
response_time: "<= 200ms"
error_rate: "<= 1%"
resource_utilization: "<= 70%"
post_deployment:
availability: ">= 99.9%"
p95_latency: "<= 500ms"
error_rate: "<= 0.5%"
user_satisfaction: ">= 4.0/5.0"
rollback_triggers:
- error_rate: "> 5%"
- latency_p95: "> 1000ms"
- availability: "< 99%"
- health_check_failures: "> 3 consecutive"
- custom_metric_threshold: "exceeded"
Expected Output Structure
deployment/
├── environments/
│ ├── staging.yaml
│ ├── production.yaml
│ └── canary.yaml
├── infrastructure/
│ ├── terraform/
│ ├── kubernetes/
│ └── monitoring/
├── ci-cd/
│ ├── github-actions/
│ ├── quality-gates/
│ └── rollback-procedures/
├── monitoring/
│ ├── dashboards/
│ ├── alerts/
│ └── runbooks/
└── documentation/
├── deployment-guide.md
├── rollback-procedures.md
└── incident-response.md
Execute Deployment Workflow
Deployment Target: $ARGUMENTS
Starting automated deployment workflow with comprehensive quality gates...
🔍 Phase 1: Pre-Deployment Validation
First use the spec-validator sub agent to perform comprehensive pre-deployment validation:
- Code Quality Assessment: Linting, type checking, test coverage analysis
- Security Scanning: Vulnerability assessment, dependency audit, container scanning
- Environment Validation: Configuration verification, secrets management, resource allocation
- Infrastructure Readiness: Capacity planning, dependency health, network connectivity
- Compliance Checks: Security policies, regulatory requirements, audit trail
Quality Gate: Pre-deployment score must be ≥95% to proceed
🚀 Phase 2: Deployment Execution
Then use the spec-deployer sub agent to execute the deployment:
- Image Building: Container creation, optimization, security hardening
- Infrastructure Setup:
Maintain Deploy Workflow?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Deploy Workflow on getagentictools](https://getagentictools.com/loops/anuraag2601-deploy-workflow-production-deployment-pipeline?ref=badge)