Deployment Patterns
Skill Profile
(Select at least one profile to enable specific modules)
Overview
Deployment patterns suitable for different scales and requirements: rolling update, blue-green, canary - without requiring full Kubernetes complexity. This skill enables zero-downtime deployments, safe rollouts with quick rollback capabilities, and right-sized deployment strategies that avoid over-engineering.
Why This Matters
- Zero downtime: Users don't notice deployment
- Safe rollouts: Release gradually, can rollback quickly
- Right-sized: Choose pattern according to needs
- Simplicity: Don't over-engineer
Core Concepts & Rules
1. Core Principles
- Follow established patterns and conventions
- Maintain consistency across codebase
- Document decisions and trade-offs
2. Implementation Guidelines
- Start with the simplest viable solution
- Iterate based on feedback and requirements
- Test thoroughly before deployment
Inputs / Outputs / Contracts
- Inputs:
- Application container image
- Health check endpoints (readiness/liveness)
- Load balancer configuration
- Database migration scripts (if applicable)
- Entry Conditions:
- Application container is built and pushed to registry
- Health check endpoints are implemented
- Load balancer is configured and accessible
- Outputs:
- Successfully deployed application instances
- Traffic routing configuration
- Deployment status and health metrics
- Artifacts Required (Deliverables):
- Docker Compose file or deployment manifest
- Load balancer configuration
- Health check implementation
- Rollback procedure documentation
- Acceptance Evidence:
- Health checks pass for all instances
- Traffic is successfully routed to new version
- No errors in application logs during deployment
- Success Criteria:
- Zero downtime during deployment (p95 latency increase < 20%)
- Rollback completes within 5 minutes
- Health check success rate = 100%
Skill Composition
Quick Start / Implementation Example
- Review requirements and constraints
- Set up development environment
- Implement core functionality following patterns
- Write tests for critical paths
- Run tests and fix issues
- Document any deviations or decisions
# Example implementation following best practices
def example_function():
# Your implementation here
pass
Assumptions / Constraints / Non-goals
- Assumptions:
- Development environment is properly configured
- Required dependencies are available
- Team has basic understanding of domain
- Constraints:
- Must follow existing codebase conventions
- Time and resource limitations
- Compatibility requirements
- Non-goals:
- This skill does not cover edge cases outside scope
- Not a replacement for formal training
Compatibility & Prerequisites
- Supported Versions:
- Python 3.8+
- Node.js 16+
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Required AI Tools:
- Code editor (VS Code recommended)
- Testing framework appropriate for language
- Version control (Git)
- Dependencies:
- Language-specific package manager
- Build tools
- Testing libraries
- Environment Setup:
.env.example keys: API_KEY, DATABASE_URL (no values)
Test Scenario Matrix (QA Strategy)
| Type |
Focus Area |
Required Scenarios / Mocks |
| Unit |
Core Logic |
Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |
| Integration |
DB / API |
All external API calls or database connections must be mocked during unit tests |
| E2E |
User Journey |
Critical user flows to test |
| Performance |
Latency / Load |
Benchmark requirements |
| Security |
Vuln / Auth |
SAST/DAST or dependency audit |
| Frontend |
UX / A11y |
Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |
Technical Guardrails & Security Threat Model
1. Security & Privacy (Threat Model)
- Top Threats: Injection attacks, authentication bypass, data exposure
2. Performance & Resources
3. Architecture & Scalability
4. Observability & Reliability
Agent Directives & Error Recovery
(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)
- Thinking Process: Analyze root cause before fixing. Do not brute-force.
- Fallback Strategy: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
- Self-Review: Check against Guardrails & Anti-patterns before finalizing.
- Output Constraints: Output ONLY the modified code block. Do not explain unless asked.
Definition of Done (DoD) Checklist
Anti-patterns / Pitfalls
- ⛔ Don't: Log PII, catch-all exception, N+1 queries
- ⚠️ Watch out for: Common symptoms and quick fixes
- 💡 Instead: Use proper error handling, pagination, and logging
Reference Links & Examples
- Internal documentation and examples
- Official documentation and best practices
- Community resources and discussions
Versioning & Changelog
- Version: 1.0.0
- Changelog:
- 2026-02-22: Initial version with complete template structure
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: amnadtaowsoam-cerebraskills-deployment-patterns3description: Deployment Patterns4---56# Deployment Patterns78## Skill Profile9*(Select at least one profile to enable specific modules)*10- [ ] **DevOps**11- [x] **Backend**12- [ ] **Frontend**13- [ ] **AI-RAG**14- [ ] **Security Critical**1516## Overview17Deployment patterns suitable for different scales and requirements: rolling update, blue-green, canary - without requiring full Kubernetes complexity. This skill enables zero-downtime deployments, safe rollouts with quick rollback capabilities, and right-sized deployment strategies that avoid over-engineering.1819## Why This Matters20- **Zero downtime**: Users don't notice deployment21- **Safe rollouts**: Release gradually, can rollback quickly22- **Right-sized**: Choose pattern according to needs23- **Simplicity**: Don't over-engineer2425---2627## Core Concepts & Rules2829### 1. Core Principles30- Follow established patterns and conventions31- Maintain consistency across codebase32- Document decisions and trade-offs3334### 2. Implementation Guidelines35- Start with the simplest viable solution36- Iterate based on feedback and requirements37- Test thoroughly before deployment383940## Inputs / Outputs / Contracts41* **Inputs**:42 - Application container image43 - Health check endpoints (readiness/liveness)44 - Load balancer configuration45 - Database migration scripts (if applicable)46* **Entry Conditions**:47 - Application container is built and pushed to registry48 - Health check endpoints are implemented49 - Load balancer is configured and accessible50* **Outputs**:51 - Successfully deployed application instances52 - Traffic routing configuration53 - Deployment status and health metrics54* **Artifacts Required (Deliverables)**:55 - Docker Compose file or deployment manifest56 - Load balancer configuration57 - Health check implementation58 - Rollback procedure documentation59* **Acceptance Evidence**:60 - Health checks pass for all instances61 - Traffic is successfully routed to new version62 - No errors in application logs during deployment63* **Success Criteria**:64 - Zero downtime during deployment (p95 latency increase < 20%)65 - Rollback completes within 5 minutes66 - Health check success rate = 100%6768## Skill Composition69* **Depends on**: [config-distribution](../69-platform-engineering-lite/config-distribution/SKILL.md)70* **Compatible with**: [observability-packaging](../69-platform-engineering-lite/observability-packaging/SKILL.md), [env-matrix-dev-stg-prod](../69-platform-engineering-lite/env-matrix-dev-stg-prod/SKILL.md)71* **Conflicts with**: Big bang deployments without staged rollout72* **Related Skills**: [rollback-strategies](../26-deployment-strategies/rollback-strategies/SKILL.md), [canary-deployment](../26-deployment-strategies/canary-deployment/SKILL.md)7374---7576## Quick Start / Implementation Example77781. Review requirements and constraints792. Set up development environment803. Implement core functionality following patterns814. Write tests for critical paths825. Run tests and fix issues836. Document any deviations or decisions8485```python86# Example implementation following best practices87def example_function():88 # Your implementation here89 pass90```919293## Assumptions / Constraints / Non-goals9495* **Assumptions**:96 - Development environment is properly configured97 - Required dependencies are available98 - Team has basic understanding of domain99* **Constraints**:100 - Must follow existing codebase conventions101 - Time and resource limitations102 - Compatibility requirements103* **Non-goals**:104 - This skill does not cover edge cases outside scope105 - Not a replacement for formal training106107108## Compatibility & Prerequisites109110* **Supported Versions**:111 - Python 3.8+112 - Node.js 16+113 - Modern browsers (Chrome, Firefox, Safari, Edge)114* **Required AI Tools**:115 - Code editor (VS Code recommended)116 - Testing framework appropriate for language117 - Version control (Git)118* **Dependencies**:119 - Language-specific package manager120 - Build tools121 - Testing libraries122* **Environment Setup**:123 - `.env.example` keys: `API_KEY`, `DATABASE_URL` (no values)124125126## Test Scenario Matrix (QA Strategy)127128| Type | Focus Area | Required Scenarios / Mocks |129| :--- | :--- | :--- |130| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |131| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |132| **E2E** | User Journey | Critical user flows to test |133| **Performance** | Latency / Load | Benchmark requirements |134| **Security** | Vuln / Auth | SAST/DAST or dependency audit |135| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |136137138## Technical Guardrails & Security Threat Model139140### 1. Security & Privacy (Threat Model)141* **Top Threats**: Injection attacks, authentication bypass, data exposure142- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII143- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager144- [ ] **Authorization**: Validate user permissions before state changes145146### 2. Performance & Resources147- [ ] **Execution Efficiency**: Consider time complexity for algorithms148- [ ] **Memory Management**: Use streams/pagination for large data149- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks150151### 3. Architecture & Scalability152- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection153- [ ] **Modularity**: Decouple logic from UI/Frameworks154155### 4. Observability & Reliability156- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`157- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`158- [ ] **Error Handling**: Standardized error codes, no bare except159- [ ] **Observability Artifacts**:160 - **Log Fields**: timestamp, level, message, request_id161 - **Metrics**: request_count, error_count, response_time162 - **Dashboards/Alerts**: High Error Rate > 5%163164165## Agent Directives & Error Recovery166*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*167168- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.169- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.170- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.171- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.172173174## Definition of Done (DoD) Checklist175176- [ ] Tests passed + coverage met177- [ ] Lint/Typecheck passed178- [ ] Logging/Metrics/Trace implemented179- [ ] Security checks passed180- [ ] Documentation/Changelog updated181- [ ] Accessibility/Performance requirements met (if frontend)182183184## Anti-patterns / Pitfalls185186* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries187* ⚠️ **Watch out for**: Common symptoms and quick fixes188* 💡 **Instead**: Use proper error handling, pagination, and logging189190191## Reference Links & Examples192193* Internal documentation and examples194* Official documentation and best practices195* Community resources and discussions196197198## Versioning & Changelog199200* **Version**: 1.0.0201* **Changelog**:202 - 2026-02-22: Initial version with complete template structure203204---205> Converted and distributed by [TomeVault](https://tomevault.io/claim/amnadtaowsoam) — claim your Tome and manage your conversions.206<!-- tomevault:4.0:skill_md:2026-04-13 -->