Env Matrix Dev Stg Prod
Skill Profile
(Select at least one profile to enable specific modules)
Overview
Standards for managing environments (development, staging, production) including configs, data policies, and access controls that differ per environment. This skill enables environment parity, reduces "works on my machine" issues, and ensures proper safety controls and compliance.
Why This Matters
- Parity: Environments are as similar as possible, reducing "works on my machine"
- Safety: Production protected, staging for testing
- Clarity: Know what each environment can do
- Compliance: Proper access controls
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:
- Environment variable definitions (APP_ENV, environment-specific configs)
- Access control policies and role definitions
- Data sanitization/masking rules
- Secret manager configuration per environment
- Entry Conditions:
- Secret manager is configured for each environment
- Access control policies are defined
- Data sanitization pipeline is set up (for staging)
- Outputs:
- Environment-specific configuration files
- Access control matrix documentation
- Data policy documentation
- Deployment flow documentation
- Artifacts Required (Deliverables):
- Environment configuration matrix
- Access control matrix
- Data policy document
- Secret manager setup scripts
- Acceptance Evidence:
- Staging deployment flow matches production
- Secrets are separated per environment
- Access controls are enforced
- Data policies are documented and implemented
- Success Criteria:
- Staging environment is production-like (same topology, config shape)
- Zero secret reuse across environments
- All production changes go through staging first
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: env-matrix-dev-stg-prod3description: Standards for managing environments (development, staging, production) Use when this capability is needed.4---56# Env Matrix Dev Stg Prod78## 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## Overview17Standards for managing environments (development, staging, production) including configs, data policies, and access controls that differ per environment. This skill enables environment parity, reduces "works on my machine" issues, and ensures proper safety controls and compliance.1819## Why This Matters20- **Parity**: Environments are as similar as possible, reducing "works on my machine"21- **Safety**: Production protected, staging for testing22- **Clarity**: Know what each environment can do23- **Compliance**: Proper access controls2425---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 - Environment variable definitions (APP_ENV, environment-specific configs)43 - Access control policies and role definitions44 - Data sanitization/masking rules45 - Secret manager configuration per environment46* **Entry Conditions**:47 - Secret manager is configured for each environment48 - Access control policies are defined49 - Data sanitization pipeline is set up (for staging)50* **Outputs**:51 - Environment-specific configuration files52 - Access control matrix documentation53 - Data policy documentation54 - Deployment flow documentation55* **Artifacts Required (Deliverables)**:56 - Environment configuration matrix57 - Access control matrix58 - Data policy document59 - Secret manager setup scripts60* **Acceptance Evidence**:61 - Staging deployment flow matches production62 - Secrets are separated per environment63 - Access controls are enforced64 - Data policies are documented and implemented65* **Success Criteria**:66 - Staging environment is production-like (same topology, config shape)67 - Zero secret reuse across environments68 - All production changes go through staging first6970## Skill Composition71* **Depends on**: [config-distribution](../69-platform-engineering-lite/config-distribution/SKILL.md)72* **Compatible with**: [deployment-patterns](../69-platform-engineering-lite/deployment-patterns/SKILL.md), [observability-packaging](../69-platform-engineering-lite/observability-packaging/SKILL.md)73* **Conflicts with**: Sharing secrets across environments, using production data in dev/staging74* **Related Skills**: [secrets-key-management](../71-infrastructure-patterns/secrets-key-management/SKILL.md), [tenant-aware-ops](../69-platform-engineering-lite/tenant-aware-ops/SKILL.md)7576---7778## Quick Start / Implementation Example79801. Review requirements and constraints812. Set up development environment823. Implement core functionality following patterns834. Write tests for critical paths845. Run tests and fix issues856. Document any deviations or decisions8687```python88# Example implementation following best practices89def example_function():90 # Your implementation here91 pass92```939495## Assumptions / Constraints / Non-goals9697* **Assumptions**:98 - Development environment is properly configured99 - Required dependencies are available100 - Team has basic understanding of domain101* **Constraints**:102 - Must follow existing codebase conventions103 - Time and resource limitations104 - Compatibility requirements105* **Non-goals**:106 - This skill does not cover edge cases outside scope107 - Not a replacement for formal training108109110## Compatibility & Prerequisites111112* **Supported Versions**:113 - Python 3.8+114 - Node.js 16+115 - Modern browsers (Chrome, Firefox, Safari, Edge)116* **Required AI Tools**:117 - Code editor (VS Code recommended)118 - Testing framework appropriate for language119 - Version control (Git)120* **Dependencies**:121 - Language-specific package manager122 - Build tools123 - Testing libraries124* **Environment Setup**:125 - `.env.example` keys: `API_KEY`, `DATABASE_URL` (no values)126127128## Test Scenario Matrix (QA Strategy)129130| Type | Focus Area | Required Scenarios / Mocks |131| :--- | :--- | :--- |132| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |133| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |134| **E2E** | User Journey | Critical user flows to test |135| **Performance** | Latency / Load | Benchmark requirements |136| **Security** | Vuln / Auth | SAST/DAST or dependency audit |137| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |138139140## Technical Guardrails & Security Threat Model141142### 1. Security & Privacy (Threat Model)143* **Top Threats**: Injection attacks, authentication bypass, data exposure144- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII145- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager146- [ ] **Authorization**: Validate user permissions before state changes147148### 2. Performance & Resources149- [ ] **Execution Efficiency**: Consider time complexity for algorithms150- [ ] **Memory Management**: Use streams/pagination for large data151- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks152153### 3. Architecture & Scalability154- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection155- [ ] **Modularity**: Decouple logic from UI/Frameworks156157### 4. Observability & Reliability158- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`159- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`160- [ ] **Error Handling**: Standardized error codes, no bare except161- [ ] **Observability Artifacts**:162 - **Log Fields**: timestamp, level, message, request_id163 - **Metrics**: request_count, error_count, response_time164 - **Dashboards/Alerts**: High Error Rate > 5%165166167## Agent Directives & Error Recovery168*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*169170- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.171- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.172- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.173- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.174175176## Definition of Done (DoD) Checklist177178- [ ] Tests passed + coverage met179- [ ] Lint/Typecheck passed180- [ ] Logging/Metrics/Trace implemented181- [ ] Security checks passed182- [ ] Documentation/Changelog updated183- [ ] Accessibility/Performance requirements met (if frontend)184185186## Anti-patterns / Pitfalls187188* ⛔ **Don't**: Log PII, catch-all exception, N+1 queries189* ⚠️ **Watch out for**: Common symptoms and quick fixes190* 💡 **Instead**: Use proper error handling, pagination, and logging191192193## Reference Links & Examples194195* Internal documentation and examples196* Official documentation and best practices197* Community resources and discussions198199200## Versioning & Changelog201202* **Version**: 1.0.0203* **Changelog**:204 - 2026-02-22: Initial version with complete template structure205206---207> Converted and distributed by [TomeVault](https://tomevault.io/claim/amnadtaowsoam) — claim your Tome and manage your conversions.208<!-- tomevault:4.0:skill_md:2026-04-13 -->