diff --git a/skills/postmortems/LICENSE.txt b/skills/postmortems/LICENSE.txt new file mode 100644 index 00000000..4dae6811 --- /dev/null +++ b/skills/postmortems/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted under this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing + the origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on your own behalf and on your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/skills/postmortems/SKILL.md b/skills/postmortems/SKILL.md new file mode 100644 index 00000000..bf027bcc --- /dev/null +++ b/skills/postmortems/SKILL.md @@ -0,0 +1,231 @@ +--- +name: postmortems +description: Guide for creating comprehensive, blameless incident postmortems that help teams learn from incidents, identify root causes, and prevent future occurrences. Use when conducting post-incident reviews, writing postmortem reports, or analyzing incidents to improve system reliability. +license: Complete terms in LICENSE.txt +--- + +# Incident Postmortems + +Guide users through creating effective, blameless postmortems through human-AI collaboration. Act as an active guide, walking users through three stages: Information Gathering, Analysis & Root Cause, and Report Generation. + +## When to Offer This Workflow + +**Trigger conditions:** +- User mentions writing a postmortem: "write a postmortem", "create an incident report", "analyze this outage" +- User mentions an incident: "we had an outage", "there was an incident yesterday" +- User wants to review an incident: "help me understand what happened", "analyze this incident" + +**Initial offer:** +Offer the user a structured workflow for creating a postmortem. Explain the three stages: + +1. **Information Gathering**: User provides incident details, timeline, and impact data while Claude asks clarifying questions +2. **Analysis & Root Cause**: Iteratively analyze the incident, identify root causes, and generate action items +3. **Report Generation**: Create a comprehensive postmortem report using the template + +Explain that this approach ensures completeness, blameless analysis, and actionable outcomes. Ask if they want to try this workflow or prefer to work freeform. + +If user declines, work freeform. If user accepts, proceed to Stage 1. + +## Stage 1: Information Gathering + +**Goal:** Collect all relevant incident information to enable thorough analysis. + +### Initial Questions + +Start by asking for basic incident information: + +1. What happened? (Brief description) +2. When did it occur? (Start time, end time, duration) +3. What was the severity level? (If unknown, help assess based on impact) +4. Which services/systems were affected? +5. How was the incident detected? +6. How was it resolved? + +Inform them they can answer in shorthand or provide information however works best. + +### Timeline Construction + +Ask for a chronological sequence of events. Encourage them to provide: +- First detection/alert +- Investigation steps +- Mitigation attempts +- Key decisions made +- Resolution steps + +**What to do:** +- Organize scattered information into a coherent timeline +- Identify gaps and ask clarifying questions +- Use role-based language (e.g., "the on-call engineer") not names +- Highlight key decisions and turning points + +### Impact Assessment + +Request impact metrics: +- User impact (affected users, error rates, feature degradation) +- Business impact (revenue, SLA breaches, customer complaints) +- Technical metrics (downtime, latency, throughput) + +**What to do:** +- Quantify impact from provided data +- Structure metrics clearly +- Help identify what metrics might be missing + +### Additional Information + +Ask if they have: +- System logs, monitoring dashboards, or error reports +- Communication records (internal updates, customer notifications) +- Relevant code changes, configuration changes, or deployments +- Related incidents or similar past incidents + +**If integrations are available** (e.g., monitoring tools, incident management systems), mention these can be used to pull in data directly. + +**Exit condition:** +Sufficient information when you have a clear timeline, impact metrics, and resolution details. You should be able to understand what happened, when, and the consequences. + +**Transition:** +Ask if there's any more information they want to provide, or if it's time to move on to analysis. + +## Stage 2: Analysis & Root Cause + +**Goal:** Identify root causes, contributing factors, and generate comprehensive action items. + +### Root Cause Analysis + +Analyze root causes using techniques from [references/root-cause-analysis.md](references/root-cause-analysis.md). Based on information provided in the conversation: + +1. **Synthesize available information**: Review what the user has shared about the incident +2. **Apply 5 Whys**: Analyze the chain of "whys" from available information, ask targeted questions only when information is missing +3. **Build Causal Chain**: Construct symptom → immediate cause → contributing factor → root cause +4. **Apply Systems Thinking**: Consider technical, process, and organizational layers + +**What to do:** +- Analyze root causes proactively from conversation context +- Present your analysis and ask for confirmation or clarification +- Only ask targeted questions about specific gaps, not the entire chain +- Help identify contributing factors beyond immediate cause +- Frame causes in terms of systems and processes, not individuals +- Suggest alternative explanations and "second stories" + +**Blameless principles:** +- Always reframe individual actions in terms of system/process failures +- Use role-based language, not names +- Ask "why did the system allow this" not "why did this person do this" + +If user provides information that blames individuals, automatically reframe it in blameless terms. + +### Action Items Generation + +Generate action items using guidelines from [references/action-items.md](references/action-items.md). + +**What to do:** +- Generate actionable, specific, bounded action items +- Categorize by: investigate, mitigate, repair, detect, mitigate future, prevent +- Ensure comprehensive coverage across all categories +- Suggest owners and deadlines based on context (user can adjust) +- Prioritize actions that address root causes + +**Action item quality:** +- **Actionable**: Phrase as a sentence starting with a verb +- **Specific**: Define scope narrowly +- **Bounded**: Indicate how to tell when it's finished + +### Lessons Learned + +Help identify: +- What went well during the incident response +- What could be improved +- Systemic improvements needed + +**Exit condition:** +Root cause identified, action items generated across all categories, and lessons learned captured. + +**Transition:** +Ask if they want to refine the analysis or action items, or if ready to generate the report. + +## Stage 3: Report Generation + +**Goal:** Create a comprehensive, well-structured postmortem report. + +### Report Structure + +Use the template in `templates/postmortem_template.md` as a starting point. The simplified template focuses on: + +1. Issue Overview +2. Where It Went Wrong +3. Why It Went Wrong (Root Cause Analysis) +4. Impact +5. Resolution +6. Action Items +7. Pre-Release Checklist (for future release reviews) +8. Lessons Learned + +### Drafting the Report + +**If access to artifacts is available:** +Use `create_file` to create an artifact with the complete postmortem report. + +**If no access to artifacts:** +Create a markdown file in the working directory (e.g., `postmortem-YYYY-MM-DD.md`). + +Fill in all sections based on the information gathered and analysis completed. Ensure: +- Consistency and completeness +- Professional formatting +- Blameless language throughout +- Clear, actionable language + +### Review and Refinement + +After drafting, ask user to review the report. Request feedback on: +- Accuracy of information +- Completeness of analysis +- Quality of action items +- Clarity and tone + +Use `str_replace` to make edits based on feedback. Never reprint the whole doc. + +**Continue iterating** until user is satisfied. + +### Final Checks + +Before completion, review the entire document for: +- Flow and consistency +- Redundancy or contradictions +- Blameless language +- Actionable, specific action items +- Complete root cause analysis + +**Exit condition:** +User is satisfied with the postmortem report and it's ready for sharing. + +## Tips for Effective Guidance + +**Tone:** +- Be direct and procedural +- Explain rationale briefly when it affects user behavior +- Don't try to "sell" the approach - just execute it + +**Handling Deviations:** +- If user wants to skip a stage: Ask if they want to skip this and work freeform +- If user seems frustrated: Acknowledge and suggest ways to move faster +- Always give user agency to adjust the process + +**Information Management:** +- Throughout, if information is missing, proactively ask +- Don't let gaps accumulate - address them as they come up +- Help organize scattered information as it's provided + +**Quality over Speed:** +- Don't rush through stages +- Each iteration should make meaningful improvements +- The goal is a postmortem that actually helps prevent future incidents + +## References + +- **Root Cause Analysis**: See [references/root-cause-analysis.md](references/root-cause-analysis.md) for detailed techniques +- **Action Items**: See [references/action-items.md](references/action-items.md) for categories and guidelines +- **Template**: Use `templates/postmortem_template.md` when generating reports + +## Keywords + +postmortem, post-mortem, incident review, post-incident review, blameless postmortem, root cause analysis, incident analysis, outage analysis, incident report, 5 whys, action items, incident response, reliability, SRE diff --git a/skills/postmortems/references/action-items.md b/skills/postmortems/references/action-items.md new file mode 100644 index 00000000..33b7a3d7 --- /dev/null +++ b/skills/postmortems/references/action-items.md @@ -0,0 +1,43 @@ +# Action Item Categories and Guidelines + +## Categories + +Generate action items across these categories to ensure comprehensive coverage: + +| Category | Question to Ask | Examples | +|----------|----------------|----------| +| **Investigate this incident** | "What happened to cause this incident and why?" | "Analyze logs from [timeframe] to identify all error patterns" | +| **Mitigate this incident** | "What immediate actions did we take to resolve this specific event?" | "Roll back deployment v1.2.3 to v1.2.2" | +| **Repair damage from this incident** | "How did we resolve immediate or collateral damage?" | "Restore corrupted user data from backup timestamped [date]" | +| **Detect future incidents** | "How can we decrease time to accurately detect similar failures?" | "Add alerting for all cases where this service returns >1% errors" | +| **Mitigate future incidents** | "How can we decrease severity/duration of future incidents like this?" | "Implement graceful degradation when database connections exceed 80% capacity" | +| **Prevent future incidents** | "How can we prevent a recurrence of this sort of failure?" | "Add automated pre-submit check for schema changes" | + +## Quality Guidelines + +Ensure each action item is: + +- **Actionable**: Phrase as a sentence starting with a verb +- **Specific**: Define scope narrowly +- **Bounded**: Indicate how to tell when it's finished + +**Example improvements:** +- ❌ "Investigate monitoring for this scenario" +- ✅ "Add alerting for all cases where this service returns >1% errors" + +## Third-Party Dependencies + +When incidents involve third-party services, use this framework: + +1. **Did the 3rd party violate our expectations?** + - Review and assess their RCA + - Suggest adjusting expectations and increasing resilience + - Identify alternative solutions if expectations are unacceptable + +2. **Did the 3rd party meet expectations, but our service failed anyway?** + - Identify where our service needs to increase resilience + - Suggest specific resilience improvements + +3. **Do we not have clear expectations?** + - Help establish expectations with the 3rd party + - Suggest how to share expectations with teams diff --git a/skills/postmortems/references/root-cause-analysis.md b/skills/postmortems/references/root-cause-analysis.md new file mode 100644 index 00000000..934f25d7 --- /dev/null +++ b/skills/postmortems/references/root-cause-analysis.md @@ -0,0 +1,60 @@ +# Root Cause Analysis Techniques + +## Approach + +Analyze root causes based on information provided in the conversation. You can synthesize information from multiple messages, ask clarifying questions when needed, and provide analysis proactively rather than requiring strict question-answer sequences. + +## 5 Whys + +Use iterative "why" questions to dig deeper into root causes. You can: + +- **Analyze from conversation**: If the user has already provided information about what happened, analyze it and identify the chain of "whys" yourself +- **Ask when needed**: Only ask "why" questions if information is missing or unclear +- **Present the chain**: Show the full 5 Whys chain once you have enough information + +**Example:** +If user says "The service failed because database connection timed out", you can analyze: +1. Why did the service fail? → Database connection timeout +2. Why did the connection timeout? → Connection pool exhausted (infer or ask if unclear) +3. Why was the pool exhausted? → Long-running queries blocking connections (infer or ask) +4. Why were there long-running queries? → Missing index on frequently queried column (infer or ask) +5. Why was the index missing? → Database migration script didn't include index creation (root cause) + +Present this analysis and ask for confirmation or clarification if needed. + +## Causal Chain + +Build a chain of causation from symptom to root cause based on available information: + +``` +Symptom → Immediate Cause → Contributing Factor → Root Cause +``` + +Identify each link from the conversation context. If a link is unclear, ask a specific question about that link rather than going through the whole chain step-by-step. + +## Systems Thinking + +Analyze across multiple layers based on what the user has shared: + +- **Technical**: Code, infrastructure, configuration +- **Process**: Deployment, monitoring, on-call procedures +- **Organizational**: Training, documentation, communication + +For each layer, identify gaps or issues that contributed to the incident. If information is missing for a layer, ask targeted questions about that specific layer. + +## Blameless Reframing + +When users provide information that blames individuals, automatically reframe in blameless terms: + +- ❌ "John deployed the buggy code" +- ✅ "The deployment process allowed code without sufficient tests to reach production" + +Always frame causes in terms of systems and processes, not individuals. Ask: "Why did the system/process allow this?" rather than "Why did this person do this?" + +## Analysis Workflow + +1. **Synthesize available information**: Review what the user has shared about the incident +2. **Identify gaps**: Determine what information is missing for a complete root cause analysis +3. **Ask targeted questions**: Only ask about specific gaps, not the entire chain +4. **Present analysis**: Show your root cause analysis and causal chain +5. **Validate and refine**: Ask if the analysis makes sense or if anything is missing diff --git a/skills/postmortems/templates/postmortem_template.md b/skills/postmortems/templates/postmortem_template.md new file mode 100644 index 00000000..05d5aedd --- /dev/null +++ b/skills/postmortems/templates/postmortem_template.md @@ -0,0 +1,130 @@ +# Postmortem: [Issue Title] + +## Issue Overview + +**What happened:** [Brief description of what went wrong] + +**Impact scope:** [Which services/features/users were affected] + +--- + +## Where It Went Wrong + +[Describe specifically where the problem occurred, including:] +- The system/service/feature that failed +- The specific location (code module, configuration, process, etc.) +- The symptoms (error messages, abnormal behavior, etc.) + +**Examples:** +- User login service exhausted connection pool during peak hours +- Database migration script missing index creation step +- New feature release didn't check dependency service version compatibility + +--- + +## Why It Went Wrong + +### Immediate Cause + +[The direct cause that led to the problem] + +### Root Cause + +[The root cause identified through 5 Whys analysis] + +**Why existing safeguards didn't prevent this:** +- [Gaps or deficiencies in monitoring/testing/processes] + +### Causal Chain + +``` +[Symptom] + ↓ +[Immediate Cause] + ↓ +[Root Cause] +``` + +--- + +## Impact + +### User Impact + +- [What users experienced/observed] +- [Affected features/services] + +### Business Impact + +- [Business metrics impact, if applicable] + +### Technical Impact + +- [System performance, stability, or other technical consequences] + +--- + +## Resolution + +### Immediate Fixes + +1. [Emergency measures taken] + +### Long-term Solutions + +1. [Long-term measures to prevent recurrence] + +--- + +## Action Items + +[Each action item should be: Actionable (verb + outcome), Specific (narrow scope), Bounded (clear completion criteria)] + +| Action Item | Owner | Priority | Status | +|-------------|-------|----------|--------| +| [Specific, actionable item] | [Owner] | [High/Medium/Low] | [Open/In Progress/Done] | + +**Priority Actions:** [List 2-3 most critical action items that address the root cause] + +--- + +## Pre-Release Checklist + +**Before future releases, verify these issues are resolved or prevented:** + +- [ ] [Check item 1: Related to this issue] +- [ ] [Check item 2: Related to this issue] +- [ ] [Check item 3: Related to this issue] + +**Examples:** +- [ ] Does the database migration script include all necessary index creation? +- [ ] Is dependency service version compatibility checked before new feature releases? +- [ ] Are appropriate monitoring and alerts in place? + +--- + +## Lessons Learned + +### What Went Well + +1. [Positive aspects of the incident response] + +### What Could Be Improved + +1. [Areas for improvement] + +### Systemic Improvements + +1. [Systemic changes needed, such as processes, tools, documentation] + +--- + +## Related Links + +- [Related code changes] +- [Related documentation] +- [Related monitoring/logs] + +--- + +*This postmortem follows blameless principles, focusing on systems, processes, and roles rather than individuals to promote learning and continuous improvement.*