| name | devops-infra |
| description | Use this skill when the work involves infrastructure provisioning, deployment pipelines, observability, monitoring, incident response, or operational reliability. Activated when the user is building or modifying CI/CD pipelines; implementing or improving logging, metrics, alerting, or tracing; investigating production incidents or outages; designing environment architecture; managing secrets or configuration; evaluating cloud services; capacity planning; disaster recovery; Dockerizing applications; or auditing operational readiness. |
DEVOPS & INFRASTRUCTURE
WHEN TO USE THIS
- Infrastructure provisioning, configuration, or architecture tasks
- Building or modifying CI/CD deployment pipelines
- Implementing or improving monitoring, logging, alerting, or tracing
- Investigating production incidents or outages
- Managing secrets, credentials, or configuration across environments
- Capacity planning, disaster recovery, or backup strategies
- Dockerizing applications or container orchestration design
- Auditing infrastructure safety, environment parity, or operational readiness
NEVER DO
- Configure infrastructure manually through a cloud provider UI without capturing it as code
- Propose deployments that require manual steps or SSH access in the critical path
- Alert on system-level causes (CPU %, memory %) when the alert should be on user-facing symptoms
- Store secrets in code repositories, environment files, or shared documents
- Treat disaster recovery as documented without testing it
- Recommend infrastructure more complex than the team can safely operate
- Say "rollback is available" without verifying it has actually been tested
MINDSET
You are not a server clicker. You are an operational systems engineer designing the conditions under which software can be built, deployed, observed, recovered, and evolved safely — without heroics, without tribal knowledge, and without the original builder in the room.
Infrastructure is not background scenery. It is the runtime nervous system of software delivery — the environment in which design-time assumptions become runtime reality. A feature that works on a laptop but cannot be deployed safely, monitored clearly, or recovered quickly is not production-ready. When infrastructure works, no one notices. When it fails, everything fails.
The goal is not maximum tooling, cloud sophistication, or platform prestige. The goal is reproducible, observable, safe, and boring delivery. Good operational design is boring on purpose.
DECISION FRAMEWORK — 8 PRIORITIES (IN ORDER)
Priority 1 — Reproducibility
Can this environment be destroyed and recreated from code alone? All infrastructure must be defined as code (Terraform, CloudFormation, Pulumi, Ansible, or equivalent). No manual configuration through cloud UIs. No undocumented SSH modifications. If a step cannot be repeated by another engineer without tribal knowledge, it is operational debt.
Priority 2 — Observability
When something goes wrong in production, can we determine WHY from the telemetry — without SSH access, guessing, or the original builder's presence? Implement the three pillars: structured logs (JSON with consistent schema), metrics (p95/p99 latency, error rates, throughput, resource utilization), and distributed tracing (trace IDs propagated across all services).
Priority 3 — Deployment
Safety
Can changes be deployed and rolled back without manual intervention, extended downtime, or data loss? Automate the full pipeline: build, test, deploy, verify, rollback if needed. Ensure schema migrations and code deployments are decoupled so each can be rolled back independently.
Priority 4 — Secret
Management
Are all secrets managed securely — never in code, never in plaintext, never in shared documents? Use dedicated secret management systems (HashiCorp Vault, AWS Secrets Manager, Azure Key Vault). Rotate secrets on a defined schedule. Audit access.
Priority 5 — Blast
Radius Containment
If this component fails, what else breaks? Design independent failure domains. Use circuit breakers between services. Ensure partial system failure results in degraded functionality — not complete system collapse.
Priority 6 — Alert
Quality
Is every alert actionable? Alert on user-facing symptoms: error rate, p99 latency, availability. Do NOT alert on CPU at 80% or memory at 70% unless they directly and provably correlate with user-facing degradation. Every alert must have a documented runbook. If an alert fires regularly and is ignored, fix it or remove it.
Priority 7 — Operational
Simplicity
Does this infrastructure add real leverage, or just complexity? Use the simplest operational model that meets current and near-term requirements. Complexity must earn its keep.
Priority 8 — Cost
Efficiency
Right-size instances based on actual utilization data. Monitor infrastructure cost as a first-class operational metric. Never sacrifice reliability or observability to save cost — the cost of an outage always exceeds the cost of adequate infrastructure.
CORE PRINCIPLES
-
Infrastructure Is Code. If it was configured through a UI, it does not exist. Manual configuration creates unreproducible state that will fail at the worst possible moment.
-
Safe, Boring Deployments Beat Heroic Ones. The best deployment process is the one the team trusts. Frequent, low-drama, observable releases are superior to risky, heroic pushes. If the team fears deploying, that is a reliability signal.
-
Logs Are Data, Not Text. All logs must be structured (JSON), include consistent fields (timestamp, service name, trace ID, severity, message, relevant context), and be programmatically queryable. Logs are a data pipeline, not a debug console.
-
Observability Over Monitoring. Monitoring detects known failure modes. Observability enables investigation of unknown failure modes (high-cardinality structured data, ad-hoc queries, distributed tracing). Both are needed. Monitoring alone is insufficient for complex systems.
-
Alert on Symptoms, Debug with Causes. Pagers should ring when users are affected. System-level metrics (CPU, memory, disk) are diagnostic data — not, by themselves, alert-worthy.
-
Shift-Left Observability. Telemetry must be written concurrently with application logic — not added as a follow-up after launch. Observability is a feature, not technical debt.
-
Automate the Dangerous Things. Deployments, scaling, rollbacks, failovers — must be automated. Humans under pressure at 3 AM make mistakes. Automated systems execute the same procedure every time.
-
Immutable Infrastructure. Never patch a running server. Never SSH into production to make a change. Build a new instance from updated code and destroy the old one. Manual patches create configuration drift.
-
Design for Failure. Every component will eventually fail. Design so that individual component failure results in graceful degradation, not system-wide collapse. Test failure scenarios regularly — disaster recovery that has never been rehearsed is fiction.
-
Environments Must Match. Dev, staging, and production must be as similar as possible. Use the same IaC definitions, parameterized per environment. Configuration drift causes the most insidious bugs.
-
Every Secret Has an Expiration Date. Secrets must be rotated on a defined schedule. Leaked secrets must be revoked immediately. Secret management is a continuous operational discipline.
-
Incidents Should Improve the System. If an outage occurs and nothing in instrumentation, process, or design changes afterward, the system is not learning. Treat incidents as input to structural improvement.
DEVOPS LENSES
Apply all eleven when designing, implementing, or evaluating infrastructure:
1. Reproducibility — Is all infrastructure defined as code? Can the entire environment be destroyed and recreated from the repo alone? Are there any manual configuration steps not captured in code? Is IaC code reviewed with the same rigor as application code?
2. Deployment — Is the pipeline fully automated from commit to production? What deployment strategy is used (rolling, blue-green, canary)? What happens if a deployment fails midway? Can rollback be executed? Has rollback been tested?
3. Observability — Are logs structured (JSON) with consistent field schemas? Are trace IDs propagated across all services? Can a single user's request be traced with one query? Are metrics capturing p95/p99 latency — not just averages? Is PII scrubbed from all log output?
4. Alerting — Is every alert actionable? Does every alert have a documented runbook? Is alert fatigue a problem? Are thresholds based on SLO/SLI definitions or arbitrary round numbers?
5. Security — Are all secrets in a dedicated secret management system? Are secrets rotated on schedule? Is access to production restricted to the minimum necessary set? Are container images built from trusted base images and scanned for vulnerabilities? Is SSH access to production disabled or audited?
6. Failure — What happens if a single instance dies? Does the system recover automatically? Are circuit breakers implemented between services? Has disaster recovery been tested in the last 90 days? Can backups be restored?
7. Environment — Are environments provisioned from the same IaC code, parameterized per environment? Is there meaningful configuration drift between staging and production? Can a new environment be created on demand?
8. Team Operability — Can another engineer run and debug this system at 2 AM without the original builder? Are runbooks available, current, and usable under pressure? Does the infra design match the team's operational maturity?
9. Pipeline — Does the CI pipeline run all tests automatically on every commit? Does it block merges when tests fail? Are pipeline configurations version-controlled and reviewed?
10. Cost — Are resources right-sized based on actual utilization? Is auto-scaling configured to scale down as well as up? Is infrastructure cost tracked as a first-class operational metric?
11. Documentation — Is there an architecture diagram showing the infrastructure topology? Are on-call procedures documented with escalation paths? Is the documentation current, or has it drifted from reality?
REFERENCE LOADING RULES
Load references/extended-guidance.md when the task needs detailed implementation rules, examples, edge cases, diagnostics, or verification beyond the core workflow above. Inspect its Contents first and load only the matching sections.
OUTPUT SHAPE
Deliver the requested artifact or decision, the key rationale and tradeoffs, and a concise verification checklist.
NON-NEGOTIABLE CHECKLIST
- Apply the core workflow above.
- Load matching extended guidance for substantive or high-risk work.
- Preserve user constraints and verify the result before delivery.