Production Post-Mortem Runbook Automation Script
Converts raw incident notes into an automated diagnostic script and revised, executable runbook for site reliability teams.
Use this template following major production outages or degraded states. It extracts root causes from incident logs and outputs an automated remediation shell or Python script.
Role: Staff Site Reliability Engineer specializing in automated remediation and production incident lifecycle management.
Context
- Raw incident logs and timeline: {{incident_raw_notes}}
- Impacted production subsystems: {{affected_subsystems}}
- Proposed remediation procedure: {{remediation_steps}}
- Active telemetry and observability tooling: {{telemetry_tooling}}
- Service Level Objective thresholds: {{slo_thresholds}}
- Incident escalation hierarchy: {{escalation_matrix}}
Task
Synthesize unstructured incident data from {{incident_raw_notes}} into an executive root-cause review and generate an automated diagnostic and mitigation script that executes {{remediation_steps}} during future breaches of {{slo_thresholds}}.
Method
- Dissect {{incident_raw_notes}} to establish the exact failure sequence across {{affected_subsystems}}.
- Correlate degraded performance markers with telemetry triggers defined in {{telemetry_tooling}}.
- Translate manual mitigation steps in {{remediation_steps}} into deterministic, idempotent script commands.
- Embed automated health probes that verify recovery against {{slo_thresholds}} prior to closing triage.
- Integrate fallback notifications routed directly to roles defined in {{escalation_matrix}}.
- Add strict dry-run and safety confirmation flags to prevent accidental cascading failures.
- Package the logic into an executable maintenance runbook script with detailed error handling.
Constraints
- MUST include idempotency checks and safe rollback paths in the automation script.
- MUST NOT execute destructive commands without interactive confirmation flags or dry-run validation.
- Script syntax must be directly executable in modern Linux bash or Python 3 runtime environments.
- Telemetry extraction commands must natively match queries used in {{telemetry_tooling}}.
Output format
- Section 1: Executive Post-Mortem Synthesis (3-5 bulleted root cause items)
- Section 2: Automated Diagnostic and Triage Script (bash or Python code block)
- Section 3: Mitigation Runbook Script (fully commented remediation code block)
- Section 4: Automated Verification Suite (script querying {{telemetry_tooling}} for {{slo_thresholds}})
Self-review
- Does the script completely cover all failure modes listed in {{incident_raw_notes}}?
- Are escalation paths mapped precisely to {{escalation_matrix}}?
- Are all failure recovery checks tied to quantifiable metrics from {{slo_thresholds}}?
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.