session-learn-extractor
Extracts the reusable pattern from the session and writes it as a DRAFT skill in skills/learned/. Triggers after 'ya quedo', 'fixed', 'shipped', 'merged' on something that took several investigation steps, or via /learn.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 18
- Forks
- 6
01 前言 Front Matter
- name
- session-learn-extractor
- metadata
- { "type": "brain-routine", "origin": "repo-deep-learn — affaan-m/ECC /learn + /skill-create (2026-05-28)", "trigger": "post-resolution (auto) or /learn (manual)" }
- description
- Extracts the reusable pattern from the session and writes it as a DRAFT skill in skills/learned/. Triggers after 'ya quedo', 'fixed', 'shipped', 'merged' on something that took several investigation steps, or via /learn.
02 资源文件 1
- 参考文档skill.json342 B
03 SKILL.md 正文
Session Learn Extractor — Pattern Capture After the Fact
Why this exists
Without it: every hard-won lesson dies in the session transcript. The next time it surfaces, the operator solves it again from scratch. Memories help (we have them) but they capture facts; skills capture reusable PROCEDURES.
With it: the moment a non-trivial problem closes, you draft a candidate skill. The operator skims, promotes the good ones, drops the noise. Brain compounds.
ECC ships this as /learn + /skill-create + an instinct system w/ confidence scoring. We adopt the simpler /learn half — the instinct layer is duplicative with our existing memories.
When to fire
Auto-trigger when ALL of these hold in the current session:
- The operator just expressed closure ("ya quedó", "done", "fixed", "shipped", "merged", "live", "✓").
- The session involved at least one of:
- ≥ 3 investigation steps (Read/Grep/Bash) before the fix
- A workaround for a library/API quirk
- A non-obvious diagnostic (logs misleading, error message wrong, etc.)
- A multi-system interaction (e.g., GH Actions + secrets + branch protection)
- There is NO existing brain skill that already covers the same procedure (quick connectome check:
python3 ~/.claude/scripts/query_connectome.py query "<problem keywords>"— if MATCH ≥ 0.5, SKIP).
Manual trigger via /learn slash command — operator-initiated whenever they feel a pattern is worth keeping.
Don't fire when
- Trivial 1-step fix (typo, single-char rename).
- Already-captured in a memory (operator may prefer memory over skill for one-off facts).
- The "fix" was an operator decision/override, not a transferable technique.
- A
learned/<slug>already exists for the same topic (would be a duplicate).
How it works (workflow)
1. Extract the kernel
Re-read the last N (≈10-30) tool calls of the session. Identify:
- Symptom — what was the visible failure or question?
- Root cause — what was actually wrong (after the dust settled)?
- Fix — what command/change resolved it?
- Generalizable trigger — what signal in future sessions should make us recall this?
2. Draft the skill
Write to ~/.claude/skills/learned/<kebab-slug>/SKILL.md with frontmatter + body:
---
name: <kebab-slug>
description: <when to use it; 1-2 sentences ending with the trigger condition>
metadata:
type: lesson-learned
status: draft
captured: <YYYY-MM-DD>
origin: session-learn-extractor (auto) | session-learn-extractor (manual /learn)
---
# <Title>
## Symptom
<what you'd observe in a future session>
## Root cause
<the actual underlying issue>
## Fix
<the specific commands/changes>
## How to recognize next time
<the diagnostic signal: an error string, a log pattern, a tool output shape>
## See also
- [[related-skill-or-memory]] (if any)
3. Hand off, don't auto-promote
DO NOT auto-move drafts from learned/ to top-level skills/. Operator reviews + promotes via:
mv ~/.claude/skills/learned/<slug> ~/.claude/skills/<slug>
# then edit metadata.status: draft → active, drop the 'captured' field
# ai-push
This keeps the brain's skills/ surface curated; learned/ is the staging area.
Output format (verbal report after writing the draft)
Single compact summary:
📝 Captured: <slug> — drafted at ~/.claude/skills/learned/<slug>/SKILL.md
Why: <1-line — what made this non-trivial>
Promote: mv ~/.claude/skills/learned/<slug> ~/.claude/skills/<slug>
Operator sees this once per closure event; never spam.
Anti-patterns (don't do these)
- Capturing trivial fixes. A typo correction is not a skill. Use the bar: "would a future me appreciate having this written down?"
- Auto-promoting drafts. Forces operator review. Curated skills are the brain's value; un-curated noise is the brain's debt.
- Duplicating existing skills. Run the connectome check first.
- Capturing client-specific procedures. Skills are GENERIC. If the lesson only makes sense for one arm, save as a memory or arm-side skill instead.
See also
- [[skill-creator]] — manual skill scaffolding (different intent; this skill auto-drafts after session, skill-creator is a tool to build from scratch)
- [[repo-deep-learn]] — sibling for external knowledge ingestion (this is internal session-knowledge)
- [[github-trending-curation]] — autonomous breadth discovery (this is reactive depth)
- [[do-not-ask-to-pause]] — fire the draft, don't ask "should I capture this?" — just do it
04 同仓库更多 Skills
yeet
Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).
wrangler
Cloudflare Workers CLI for deploying, developing, and managing Workers, KV, R2, D1, Vectorize, Hyperdrive, Workers AI, Containers, Queues, Workflows, Pipelines, and Secrets Store. Load before running wrangler commands to ensure correct syntax and best practices. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
workspace-skill-discovery
Discover and include ALL skills across the workspace — not just global ones. Use at the start of every session or when the user asks about available skills. Ensures project-level skills (under .claude/skills/ or skills/ in any repo) are never missed.
workers-best-practices
Reviews and authors Cloudflare Workers code against production best practices. Load when writing new Workers, reviewing Worker code, configuring wrangler.jsonc, or checking for common Workers anti-patterns (streaming, floating promises, global state, secrets, bindings, observability). Biases towards retrieval from Cloudflare docs over pre-trained knowledge.
winui-app
Create, build and design WinUI 3 desktop apps with C# and the Windows App SDK following Microsoft's official guidance and CommunityToolkit. Covers XAML, navigation, theming, accessibility and deployment.
windows-brain-script-portability
Scripts in ~/.claude/scripts/ that run on a Windows brain: use the python3.cmd shim and not bare python3, and reconfigure stdout to UTF-8 if you print symbols. Use it when writing a brain script or triaging a Windows-only crash.