Agent skill
postmortem
Error review and recovery workflow. This skill should be used when the user points out a mistake, requests a review, pastes error logs, or asks "what went wrong". Triggers on phrases like "this is wrong", "you made a mistake", "do a postmortem", "can you review this", or when stack traces/CLI errors are provided.
Install this agent skill to your Project
npx add-skill https://github.com/yurifrl/cly/tree/main/.opencode/skill/postmortem
SKILL.md
Postmortem Mode
Structured error analysis and recovery workflow. Enter this mode when mistakes are identified or reviews requested.
Tone
- Calm, introspective, technical, structured
- Never blame user
- Assume AI may have contributed
- Acknowledge uncertainty
- Action-oriented (rollback + corrected plan)
Workflow
Step 0 — Acknowledge
Confirm entering postmortem mode. If details missing, ask for:
- Expected outcome
- Actual outcome
- Relevant logs/output
- What was changed
If user already provided details, proceed.
Step 1 — Restate Situation
Summarize in one paragraph:
- What AI previously suggested/did
- What user attempted
- What failed
Then ask: "Is this summary accurate?"
Step 2 — Classify Error
Identify failure type:
- Logic/Reasoning error
- Wrong assumption
- Wrong commands/config
- Missing dependency/environment mismatch
- API mismatch
- Miscommunication / unclear requirement
- Incomplete solution
- Unsafe or risky suggestion
Step 3 — Root Cause Analysis
Use 5 Whys or fault tree. Include:
- Direct cause (what failed)
- Contributing causes (why it was likely)
- Human/system factors
- AI factors (where AI reasoning failed)
Step 4 — Impact Analysis
- What could be affected?
- Risks (data loss, downtime, security, cost, broken workflows)?
- Immediate mitigations needed?
Step 5 — Rollback Plan
Provide safe rollback with:
- Steps
- Verification commands/checks
- Fallback if rollback fails
- What to monitor after
State explicitly:
- "This restores system to last known good state"
- "Validate state after rollback"
If rollback impossible, provide containment steps.
Step 6 — Corrective Plan
Clean corrected plan with:
- What changes from previous plan
- Step-by-step approach
- Checkpoints and validations
- Risk mitigation
- Testing strategy
Step 7 — Prevention
How to avoid in future:
- Guardrails/checks
- Automated tests
- Clearer assumptions
- Observability improvements
- Documentation improvements
Step 8 — Questions (Mandatory)
Ask at least 8 questions:
Context & Expectations
- What outcome did you expect exactly?
- What does "success" look like?
Environment 3. What environment (OS, versions, infra)? 4. What changed recently before the issue?
Execution 5. What steps did you run exactly? 6. What was the exact error output (full logs)?
Constraints 7. Any restrictions (downtime, data loss tolerance, security)? 8. Is rollback acceptable or forward-fix only?
Bonus 9. Can you share the exact diff/patch applied? 10. Any monitoring signals correlating with failure?
Output Format
## Postmortem Summary
- **What happened:**
- **Expected:**
- **Actual:**
- **Scope:**
## Error Analysis
- **Primary failure mode:**
- **Where reasoning broke:**
- **Contributing factors:**
## Root Cause (RCA)
- **Direct cause:**
- **Contributing causes:**
- **AI mistake(s):**
- **Unknowns:**
## Impact & Risk
- **Impact:**
- **Risk level:**
- **Immediate mitigation:**
## Rollback Plan
1.
2.
3.
- **Validation:**
- **Fallback:**
## Corrective Plan
1.
2.
3.
- **Validation checkpoints:**
- **Testing strategy:**
## Prevention
-
## Questions for You
1.
2.
3.
...
Rules
Must Do
- Always spell "postmortem" correctly
- Ask many questions, be introspective
- Provide rollback + corrected plan every time
- Be explicit about assumptions
- Admit uncertainty, request missing info
- Provide verification steps and safety checks
Must Not
- Be defensive
- Ignore user's claim of mistake
- Continue forward as if no error happened
- Propose risky actions without disclaimers
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
ag:changelog
Generates and updates project CHANGELOG.md from git commits, conversation decisions, and architectural changes. Auto-invoke this skill when new features are added, features are removed, or architecture changes occur.
prompt-engineering
Prompt engineering reference and workflow for creating, refining, and reviewing high-quality prompts for AI tools, agents, and skills.
ag:claudemd-update
Updates CLAUDE.md based on recent conversation history. This skill should be used when the user asks to update their CLAUDE.md, sync learnings from conversations, or review what was discussed recently.
write-skill
Create Claude Code skills with proper structure and documentation. Use when building custom skills, writing SKILL.md files, or when user asks "write a skill" or "create Claude skill".
add-module
Create new demo or utility modules following CLY project patterns. Use when adding TUI demonstration modules to modules/demo/ or utility modules to modules/, following Bubbletea/Bubbles conventions with proper Cobra CLI integration.
git-worktrees
Manage git worktrees for parallel development. Use when user mentions worktrees, parallel branches, or working on multiple branches simultaneously.
Didn't find tool you were looking for?