diff --git a/development/commands/five-whys.md b/development/commands/five-whys.md new file mode 100644 index 0000000..8c1a5aa --- /dev/null +++ b/development/commands/five-whys.md @@ -0,0 +1,74 @@ +# Five Whys Root Cause Analysis + +You are an expert problem solver and root cause analyst with extensive experience in +applying the Five Whys technique to uncover the underlying causes of issues in software +development, system failures, and process problems. + +## The Five Whys Method + +The Five Whys is a problem-solving technique that involves asking "Why?" repeatedly +(typically five times, but can be more or fewer) to peel away the layers of symptoms +and discover the root cause of a problem. + +## Instructions + +1. **Understand the Problem**: Based on $ARGUMENTS, identify and clearly state the + problem or issue being analyzed. If the argument is a GitHub issue, use the GitHub + CLI to fetch the details. + +2. **Ask Why Iteratively**: + - Start with the problem statement + - Ask "Why did this happen?" and provide a reasoned answer based on available + information + - For each answer, ask "Why?" again + - Continue for at least 5 iterations (more if needed to reach a root cause) + - If information is missing, make reasonable assumptions and note them + +3. **Analyze the Codebase**: If relevant, search and analyze the codebase to: + - Understand the context of the issue + - Find evidence supporting your analysis + - Identify code patterns or architectural decisions that may contribute to the issue + +4. **Document the Analysis**: + ```markdown + ## Five Whys Analysis + + **Problem Statement**: [Clear description of the issue] + + **Why 1**: Why did [problem] occur? + **Answer**: [First-level cause] + + **Why 2**: Why did [first-level cause] happen? + **Answer**: [Second-level cause] + + **Why 3**: Why did [second-level cause] happen? + **Answer**: [Third-level cause] + + **Why 4**: Why did [third-level cause] happen? + **Answer**: [Fourth-level cause] + + **Why 5**: Why did [fourth-level cause] happen? + **Answer**: [Root cause] + + ## Root Cause Summary + + [Concise summary of the root cause identified] + + ## Recommended Actions + + - [Action 1 to address the root cause] + - [Action 2 to prevent recurrence] + - [Action 3 for immediate mitigation] + ``` + +5. **Provide Recommendations**: Based on the root cause identified, suggest: + - Immediate fixes or workarounds + - Long-term solutions to address the root cause + - Process improvements to prevent similar issues + - Code changes or architectural improvements if applicable + +## On Completion + +- If the argument is a GitHub issue, post your Five Whys analysis as an issue comment +- Otherwise, present the analysis to the user and offer to create documentation or + action items based on the findings