From reflection
Mine git history, PRs, and session transcripts for novel techniques, ideas, and breakthroughs, then maintain a structured learning diary in docs/learnings.yaml. Use when 'learning diary', 'mine learnings', 'what did I learn', 'update learnings', 'track learnings', 'learning log', or when the user wants to capture what they've learned from recent work. Not for content creation or blog post writing (separate pipeline).
How this skill is triggered — by the user, by Claude, or both
Slash command
/reflection:learning-diaryThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Mine a repository's history for novel techniques, ideas, and breakthroughs. Maintain a structured YAML diary at `docs/learnings.yaml` that captures each learning as a self-contained entry a reader can understand without external context.
Mine a repository's history for novel techniques, ideas, and breakthroughs. Maintain a structured YAML diary at docs/learnings.yaml that captures each learning as a self-contained entry a reader can understand without external context.
The diary has three sections:
Read docs/learnings.yaml. If it doesn't exist or has no baseline section, this is a first run. If it exists with a baseline and mining metadata, this is an incremental run.
The baseline interview matters because it determines what counts as "novel" for this specific user. A technique obvious to a senior distributed-systems engineer might be a revelation for someone coming from frontend. Without a baseline, the diary fills with noise.
Interview the user with these questions (adapt phrasing to be conversational — these are the topics to cover, not a script):
Record the baseline as structured YAML (see format below). This only happens once — subsequent runs skip straight to mining.
After the baseline interview, ask the user for the commit range or date range to mine for this first run.
Read mining.last_commit and mining.ranges_mined from the existing file. Mine from the last commit to HEAD. If there are no new commits, say so and stop.
Before starting, show the user: "Mining from <last_commit_short> to HEAD (N commits). Proceed?"
Mine these sources in parallel where possible. Git history is always available; the others are optional — use them when the tools exist, skip gracefully when they don't.
git log <from>..<to> --pretty=format:'%H|%ai|%s' --no-merges
Read commit messages and diffs for commits that look like they involve something non-trivial. Skip routine changes (version bumps, typo fixes, dependency updates, formatting). Look for:
For promising commits, read the full diff to understand the technique.
Git diffs show what changed but not the full picture. For commits that add or significantly modify substantive files, read the full file — not just the diff hunk. Novel patterns hide everywhere: in research diaries, in skill instructions, in harness scripts, in component libraries, in config files. A diff showing "+200 lines" is a signal to read the whole file.
git diff --name-only <from>..<to>
Look at everything — docs, skill files (SKILL.md), test harnesses, scripts, code, config, component libraries. Don't filter by path or extension. For each substantive new or heavily-modified file, read it in full and look for:
gh is available)Check if gh is available: gh --version. If not, skip this step.
gh pr list --state merged --search "merged:>=<from_date>" --json number,title,body,mergedAt --limit 50
PR descriptions often contain the richest context — the problem statement, alternatives considered, and the reasoning behind the chosen approach. These are gold for learning entries.
auto search is available)Check if auto search is available: auto search --help. If not, skip this step. If available, refresh the index first: auto search index.
auto search search "<relevant_query>" --cwd <repo_path> --since <timeframe> --role assistant --limit 20
Search for sessions in this workspace that overlap with the mined time period. Session transcripts capture the process — the dead ends, the "aha" moments, the corrections. These add depth that git history alone can't provide.
Useful queries to try:
auto search stats --group-by skill --cwd <repo_path> --since <timeframe> to see which skills were used (novel skill usage = potential learning)auto search search "" --cwd <repo_path> --since <timeframe> --role user to see what the user was asking about (questions reveal learning edges)For each candidate learning, apply these filters — but note that the threshold shifts depending on how close the topic is to the user's stated frontier:
frontier (their stated learning edge), set a low bar — these are the entries the user cares about most, even if the technique seems incremental.Only filter out things that are clearly routine for the user's stated experience level (standard git usage for a git expert, basic CRUD patterns for a senior backend engineer, etc.). When in doubt about whether something is novel enough, include it — a slightly generous diary is more useful than one that filters out insights the user would have wanted to remember.
Each learning entry has these fields:
- id: L001 # sequential, zero-padded to 3 digits
title: "Short, descriptive title of the technique or insight"
date_discovered: 2026-06-10 # when the technique was first used (from commit date)
date_recorded: 2026-06-13 # when this entry was mined
category: workflow # see categories below
commits:
- abc123def
prs:
- 42
related_learnings:
- L003 # cross-reference to related entries
problem: |
What situation or challenge prompted this technique.
Include enough domain context that a reader who has never
seen this codebase understands the problem space and why
it matters. Don't assume the reader was there.
solution: |
What was actually done — the technique, pattern, or insight.
Be concrete: name the tools, show the command, describe the
pattern. Specific enough that someone could apply this in
their own project without reading the original code.
evidence: |
Where this appears in the codebase. Quote the key lines of
code, commit messages, or session excerpts that demonstrate
the technique. This anchors the entry in reality and lets
the user reconstruct the full story later if needed.
takeaway: |
The generalizable lesson — the part that transfers beyond
this project. What would you tell a colleague who faces a
similar situation? Frame it as portable advice, not project
trivia.
Use these categories (add new ones if none fit, but prefer existing):
architecture — system design, patterns, structural decisionsai-prompting — prompt engineering, skill design, agent workflowsdebugging — diagnosis techniques, surprising root causestesting — test strategies, eval approaches, quality assurancetooling — tool usage, CLI tricks, dev environmentworkflow — process improvements, automation, collaboration patternsperformance — optimization techniques, profiling insightsinfrastructure — deployment, CI/CD, environment managementWhen a new entry builds on, refines, or contradicts an earlier one, add its ID to related_learnings. This creates learning trajectories — showing how understanding evolved over time.
baseline:
recorded: 2026-06-13
summary: |
Free-text summary of the user's background and expertise.
domains:
- distributed systems
- frontend
languages:
- TypeScript
- Python
tools:
- Claude Code
- VS Code
ai_experience: |
Free-text description of AI/agent tool experience.
frontier: |
What the user is currently learning or finds challenging.
This is the most important filter — things near this
edge are the most valuable to record.
mining:
last_run: 2026-06-13T10:30:00Z
last_commit: abc123def456
ranges_mined:
- from_commit: abc123
to_commit: def456
from_date: 2026-05-01
to_date: 2026-06-13
entries_added: 5
mined_at: 2026-06-13T10:30:00Z
learnings:
# entries here, newest first
learnings list (newest first), update mining.last_commit, mining.last_run, and append to mining.ranges_mined.Write tool, not by shelling out, so the user can review the diff.Print a summary:
If zero learnings were found, that's fine — say so. Not every commit range produces novel insights.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub mistakenot/skills --plugin reflection