Learn from Session
Step 1: Review Session Context
Examine what was accomplished in this session, focusing on:
- Commands run repeatedly or permission prompts that appeared multiple times
- Friction points: wrong approaches, wasted tool calls, repeated corrections
- Knowledge gaps: things looked up that could be pre-loaded as rules
- Patterns that emerged across multiple files or tasks
- Failed approaches: things that didn't work and why (anti-patterns)
- Commands that required manual approval (check if they could be added to
permissions.allow in ~/.claude/settings.json)
Step 2: Identify Improvement Opportunities
Beyond rules updates, check for opportunities across all Claude Code configuration:
| Category |
What to look for |
| CLAUDE.md |
Universal conventions, workflow preferences, common pitfalls, anti-patterns ("tried X, doesn't work because Y, do Z instead") |
| Memory topic files |
Domain-specific knowledge → route to the right topic file (check memory/ dir for existing files; keep MEMORY.md for universal rules and pointers only) |
| Slash Commands |
Repetitive multi-step tasks (3+ commands), common workflows |
| Skills |
Domain-specific guidance, code review rules, conventions |
| Agents |
Specialized workflows, multi-step analysis tasks |
| Hooks |
Pre-commit checks, build verification, auto-formatting |
| Permissions |
Commands that required manual approval — check against existing allowlist in ~/.claude/settings.json under permissions.allow |
Step 3: Output Structured Findings
Present results in this format. Each finding must be concrete — include the specific command, file, or pattern observed.
## Session Summary
**What we did:**
- [Brief bullet points of main accomplishments]
**Patterns observed:**
- [Recurring actions, questions, or friction points]
---
## Extracted Learnings
- Ran `arc lint -a` 4 times after editing — add a PostToolUse hook for auto-formatting
- `buck test` failed twice because target was `test_foo` not `foo_test` — add naming convention to CLAUDE.md
- Permission prompt for `jf submit` appeared 3 times — add to allowlist
---
## Improvement Opportunities
### Rules Updates
- [specific rule text to add or change, with target file path]
### Anti-Patterns Discovered
- **[What was tried]** → [Why it failed] → [Do this instead]
- Target file: [which memory/CLAUDE.md file to add this to]
### Memory Updates
- [specific entry to add/update] → Target: [topic file name]
### Slash Commands
- **`/[name]`** — [use case], Priority: [High/Medium/Low]
### Skills
- **`[name]`** — [domain], Priority: [High/Medium/Low]
### Hooks
- **[name]** — [type], Priority: [High/Medium/Low]
### Permissions
- **`Bash(command:pattern*)`** — [what it does], approved N times (in allowlist: yes/no)
Step 4: Offer to Apply
After presenting findings, ask:
"Would you like me to apply any of these changes now? I can:
- Update memory files (MEMORY.md or topic files)
- Add permissions to settings.json
- Create/update CLAUDE.md entries"
Apply only the changes the user approves. Do NOT auto-apply without confirmation.
For complex CLAUDE.md rule edits, use /llm-rules-updater instead.
Related Skills
/llm-rules-updater: Create or update LLM rules (rules file discovery, format-aware editing, diff submission)
/learn-from-history: Extract patterns from past session transcripts
/analyze-diffs: Extract patterns from Phabricator diffs
/project-rule-evaluator: Audit CLAUDE.md files for quality and structure
Do Not
- Suggest improvements for one-time tasks
- Be vague ("improve documentation") — always be concrete
- Ignore user's actual workflow patterns
- Suggest skills or commands that duplicate existing ones
- Suggest permissions already in the allowlist
- Route all memory updates to MEMORY.md — use topic files
1---2name: learn-from-session3description: Extract patterns and learnings from the current session. Use when asked to learn from this session, capture session learnings, or review what was accomplished. Outputs structured findings for use with /llm-rules-updater.4---567# Learn from Session8910## Step 1: Review Session Context111213Examine what was accomplished in this session, focusing on:141516- Commands run repeatedly or permission prompts that appeared multiple times17- Friction points: wrong approaches, wasted tool calls, repeated corrections18- Knowledge gaps: things looked up that could be pre-loaded as rules19- Patterns that emerged across multiple files or tasks20- Failed approaches: things that didn't work and why (anti-patterns)21- Commands that required manual approval (check if they could be added to `permissions.allow` in `~/.claude/settings.json`)222324## Step 2: Identify Improvement Opportunities252627Beyond rules updates, check for opportunities across all Claude Code configuration:282930| Category | What to look for |31|----------|-----------------|32| **CLAUDE.md** | Universal conventions, workflow preferences, common pitfalls, anti-patterns ("tried X, doesn't work because Y, do Z instead") |33| **Memory topic files** | Domain-specific knowledge → route to the right topic file (check `memory/` dir for existing files; keep MEMORY.md for universal rules and pointers only) |34| **Slash Commands** | Repetitive multi-step tasks (3+ commands), common workflows |35| **Skills** | Domain-specific guidance, code review rules, conventions |36| **Agents** | Specialized workflows, multi-step analysis tasks |37| **Hooks** | Pre-commit checks, build verification, auto-formatting |38| **Permissions** | Commands that required manual approval — check against existing allowlist in `~/.claude/settings.json` under `permissions.allow` |394041## Step 3: Output Structured Findings424344Present results in this format. Each finding must be concrete — include the specific command, file, or pattern observed.454647```markdown48## Session Summary495051**What we did:**52- [Brief bullet points of main accomplishments]535455**Patterns observed:**56- [Recurring actions, questions, or friction points]575859---606162## Extracted Learnings636465- Ran `arc lint -a` 4 times after editing — add a PostToolUse hook for auto-formatting66- `buck test` failed twice because target was `test_foo` not `foo_test` — add naming convention to CLAUDE.md67- Permission prompt for `jf submit` appeared 3 times — add to allowlist686970---717273## Improvement Opportunities747576### Rules Updates77- [specific rule text to add or change, with target file path]787980### Anti-Patterns Discovered81- **[What was tried]** → [Why it failed] → [Do this instead]82 - Target file: [which memory/CLAUDE.md file to add this to]838485### Memory Updates86- [specific entry to add/update] → Target: [topic file name]878889### Slash Commands90- **`/[name]`** — [use case], Priority: [High/Medium/Low]919293### Skills94- **`[name]`** — [domain], Priority: [High/Medium/Low]959697### Hooks98- **[name]** — [type], Priority: [High/Medium/Low]99100101### Permissions102- **`Bash(command:pattern*)`** — [what it does], approved N times (in allowlist: yes/no)103```104105106## Step 4: Offer to Apply107108109After presenting findings, ask:110> "Would you like me to apply any of these changes now? I can:111> - Update memory files (MEMORY.md or topic files)112> - Add permissions to settings.json113> - Create/update CLAUDE.md entries"114115116Apply only the changes the user approves. Do NOT auto-apply without confirmation.117For complex CLAUDE.md rule edits, use `/llm-rules-updater` instead.118119120## Related Skills121122123- **`/llm-rules-updater`**: Create or update LLM rules (rules file discovery, format-aware editing, diff submission)124- **`/learn-from-history`**: Extract patterns from past session transcripts125- **`/analyze-diffs`**: Extract patterns from Phabricator diffs126- **`/project-rule-evaluator`**: Audit CLAUDE.md files for quality and structure127128129## Do Not130131132- Suggest improvements for one-time tasks133- Be vague ("improve documentation") — always be concrete134- Ignore user's actual workflow patterns135- Suggest skills or commands that duplicate existing ones136- Suggest permissions already in the allowlist137- Route all memory updates to MEMORY.md — use topic files138139140