A small feedback loop that nudges Claude Code to capture non-obvious learnings as reusable skills/rules at the end of every session, instead of letting them evaporate.
Three pieces:
-
Stop hook (
continuous-learning.sh) — fires when Claude tries to end its turn. On the first stop in a session it blocks and tells Claude to run/retrospectfirst. A/tmpmarker file tracks that the prompt has been delivered, so the second stop attempt (after retrospect runs, or after Claude decides there's nothing to capture) goes through cleanly. The marker expires after 5 minutes so it doesn't bleed across unrelated sessions. -
/retrospectslash command (retrospect.md) — what Claude runs when prompted. It walks through:- Updating any active plans in
.claude/plans/ - Logging non-trivial decisions
- Surfacing candidate learnings, asking the user for explicit approval, and writing them to
.claude/skills/or.claude/rules/
The hard rule baked into the command: never save a skill without explicit user approval in the same session. Silence ≠ consent. This keeps the skill library from filling up with noise.
- Updating any active plans in
-
Hook config in
settings.json— wires the hook to theStopevent.
The net effect: every session ends with a small "anything worth saving?" pass. Most of the time the answer is no. When it isn't, the learning lands in a place future Claude will actually load.
Drop the files into your Claude config:
# 1. Slash command (loaded by name when Claude or you type /retrospect)
mkdir -p ~/.claude/commands
cp retrospect.md ~/.claude/commands/retrospect.md
# 2. Hook script
mkdir -p ~/workspace/.claude/scripts
cp continuous-learning.sh ~/workspace/.claude/scripts/continuous-learning.sh
chmod +x ~/workspace/.claude/scripts/continuous-learning.shThen add the hook to ~/.claude/settings.json (merge with whatever's already there):
{
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "~/workspace/.claude/scripts/continuous-learning.sh"
}
]
}
]
}
}Adjust the script path if you don't keep things under ~/workspace/.claude.
README.md— this fileretrospect.md— the/retrospectslash command definitioncontinuous-learning.sh— the Stop hook scriptsettings-hook-snippet.json— drop-in snippet for~/.claude/settings.json
- The 5-minute marker window is long enough to absorb a real retrospect pass and short enough that it won't accidentally suppress the prompt next session.
- If the prompt becomes annoying (e.g. one-shot sessions where there's nothing to learn), the cheapest off-switch is changing
"matcher": ""to something more specific, or removing the hook entry entirely. - The skill itself is opinionated about what to save: non-obvious + reusable + verified. The bar matters — skills are loaded into context, so low-value skills are a tax on every future session.