|
| 1 | +--- |
| 2 | +name: retrospect |
| 3 | +description: > |
| 4 | + Review the current conversation to find agent mistakes, inefficiencies, and corrections, |
| 5 | + then propose new guidelines to add to CLAUDE.md to prevent recurrence. |
| 6 | + Triggers: /retrospect, "what went wrong", "capture lessons", "update CLAUDE.md", |
| 7 | + "add this to instructions", "remember not to do this", "update the guidelines", |
| 8 | + "add to agents.md", "end of session review", or when the user asks to capture |
| 9 | + anything from the current session into instructions. Always use this skill when |
| 10 | + the user invokes it at the end of a session — even if the session seemed smooth, |
| 11 | + there may still be patterns worth capturing. |
| 12 | +--- |
| 13 | + |
| 14 | +# Retrospect — Session Review & CLAUDE.md Updater |
| 15 | + |
| 16 | +At the end of a session, scan the conversation for lessons and update CLAUDE.md with |
| 17 | +new guidelines to prevent the same mistakes or inefficiencies from recurring. |
| 18 | + |
| 19 | +## Step 1: Scan the conversation |
| 20 | + |
| 21 | +Read through the entire current conversation and identify moments where: |
| 22 | + |
| 23 | +- The user **corrected an error** ("no, don't...", "that's wrong", "actually...", "wait...", "you shouldn't have...") |
| 24 | +- The user **redirected approach** ("instead of X, just do Y", "don't ask, just...", "skip the...", "you don't need to...") |
| 25 | +- The agent **retried something multiple times** before getting it right |
| 26 | +- The user had to **repeat themselves** about something they'd already said |
| 27 | +- The agent **asked unnecessary questions** or stalled when it could have acted |
| 28 | +- The agent **missed a convention or pattern** that was already in the codebase |
| 29 | + |
| 30 | +For each moment, note: |
| 31 | +- What the agent did wrong or inefficiently |
| 32 | +- What the user wanted instead |
| 33 | +- The underlying principle being violated or missing |
| 34 | + |
| 35 | +## Step 2: Read CLAUDE.md first |
| 36 | + |
| 37 | +Before deriving any lessons, find and read the project's CLAUDE.md (look in the current working directory, then parent directories up to home). This is essential — you need to know what's already there so you don't propose duplicates or near-duplicates. |
| 38 | + |
| 39 | +## Step 3: Derive lessons |
| 40 | + |
| 41 | +Group related corrections into concise, actionable lessons. A good lesson is: |
| 42 | +- **Specific**: About a concrete behavior, not a vague observation |
| 43 | +- **General**: Applicable beyond just this one case — think about what rule would have prevented it |
| 44 | +- **Brief**: One to two sentences max |
| 45 | +- **New**: Not already covered (even partially) by an existing rule in CLAUDE.md |
| 46 | + |
| 47 | +For each lesson, decide the best way to capture it: |
| 48 | +1. **CLAUDE.md rule** — behavioral guideline, convention, or preference |
| 49 | +2. **Skill suggestion** — if a multi-step workflow recurred that would benefit from a dedicated skill |
| 50 | +3. **Script suggestion** — if a specific repetitive task could be automated into a helper script |
| 51 | + |
| 52 | +## Step 4: Present all proposals |
| 53 | + |
| 54 | +Show the user everything at once before touching any files. Format like this: |
| 55 | + |
| 56 | +``` |
| 57 | +I found N things worth capturing from this session: |
| 58 | +
|
| 59 | +**1. [Short lesson title]** |
| 60 | + What happened: [one line description of the mistake/inefficiency] |
| 61 | + Proposed rule: "[exact text to add to CLAUDE.md]" |
| 62 | + Section: [which CLAUDE.md section this belongs in] |
| 63 | +
|
| 64 | +**2. [Short lesson title]** |
| 65 | + What happened: ... |
| 66 | + Proposed rule: "..." |
| 67 | + Section: ... |
| 68 | +
|
| 69 | +🔧 **Skill suggestion: [name]** |
| 70 | + What happened: [recurring workflow that came up] |
| 71 | + Suggestion: Create a skill to handle [description] |
| 72 | +
|
| 73 | +Which should I apply? (e.g. "1, 3", "all", "none", "1 and the skill") |
| 74 | +``` |
| 75 | + |
| 76 | +Wait for the user's response before making any changes. |
| 77 | + |
| 78 | +## Step 5: Apply confirmed rules |
| 79 | + |
| 80 | +You already read CLAUDE.md in Step 2, so you know its structure and tone. For each confirmed rule: |
| 81 | + |
| 82 | +1. **Find the most relevant existing section** — insert there rather than appending to the end. For example, a rule about error handling goes under error handling, a testing convention goes under testing patterns |
| 83 | +2. If no section fits, add a new section at the end with an appropriate heading |
| 84 | +3. **Match the existing tone and style** — look at how other rules are phrased and follow the same pattern |
| 85 | +4. Keep the addition minimal — no preamble or explanation, just the rule |
| 86 | + |
| 87 | +After all edits, show a brief summary of what was added and where. |
| 88 | + |
| 89 | +## Step 6: Handle skill/script suggestions |
| 90 | + |
| 91 | +If the user confirmed a skill suggestion, say: |
| 92 | + |
| 93 | +> "I'll kick off the skill creator for [skill name]. Here's a starting description: [brief description of what it should do]. Ready to start?" |
| 94 | +
|
| 95 | +Then invoke the `skill-creator` skill to begin the workflow. |
| 96 | + |
| 97 | +## Notes |
| 98 | + |
| 99 | +- Only analyze the current conversation — do not search past sessions |
| 100 | +- If there are no lessons to capture (session was clean), say so honestly rather than inventing guidelines |
| 101 | +- Prefer editing existing rules over adding redundant new ones if a lesson is already partially covered |
| 102 | +- Don't add rules that are already in CLAUDE.md — check carefully before proposing |
| 103 | +- Only update the project-level CLAUDE.md found via the working directory; don't mention or touch other CLAUDE.md files unless the user brings them up |
0 commit comments