plugins/lessons-learned/skills/lessons-learned/SKILL.md
Use when starting, executing, or finishing non-trivial implementation tasks where reusable constraints may matter. Recall relevant lessons before work, capture reusable corrections or discoveries during and after work, and keep project memory in `docs/lessons/`.
npx skillsauth add shihyuho/skills lessons-learnedInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill to maintain a lightweight project memory loop.
Treat this file as the single source of truth for lesson-memory behavior:
trigger rules, recall flow, capture flow, limits, and validation.
README.md, references/, and phase-entry commands must not override those
rules.
Invoke this skill in these moments:
Do not trigger for:
When this skill is the primary process skill in a session:
Store all lesson artifacts under docs/lessons/ at the project root:
docs/lessons/
├── _index.md
├── api-timeout-retry-pattern.md
├── db-migration-run-order.md
└── null-check-before-save.md
Each lesson card is one atomic Zettelkasten note. Keep one reusable lesson per card.
Apply these limits everywhere in the skill package:
related links per card.confidence in the inclusive range 0.0-0.9.If another file conflicts with these limits, this file wins.
Run this phase before writing code.
docs/lessons/ does not exist, treat this as first-run state and skip recall.docs/lessons/ exists but _index.md does not, read existing card frontmatter directly for this recall pass and warn that _index.md should be rebuilt during the next capture/update maintenance pass.project for cross-cutting or repo-wide concernsmodule for package/directory-level concernsfeature for a specific flow or componentdocs/lessons/_index.md.docs/lessons/.
confidence: 0.0.confidence remain eligible and use legacy fallback.confidence: 0.0 remain in docs/lessons/ for explicit
historical lookup.tag match -> scope match -> confidence (desc) -> date (desc).
confidence is missing: derive it from
source (user-correction=0.7, bug-fix=0.5,
retrospective=0.3). If both are missing, use 0.3.related links from primary cards, loading up to 2
additional cards.confidence:
confidence because a lesson was loaded.confidence because a lesson was not loaded.confidence because a lesson was not used recently.If no cards match, continue work without lesson constraints.
Treat these as non-blocking and continue:
docs/lessons/ is missing on first run._index.md is missing, so this recall pass used direct card metadata.confidence and needs legacy fallback.related target is missing.Run this phase when any of these conditions are met:
Use this phase for both kinds of memory maintenance:
Ask: "Will this lesson save time next time a similar task appears?"
Apply this step separately for two decisions:
Skipping new-card creation does not skip corrective updates to an existing card. If current work shows that a recalled or related card needs correction, continue to Step 2 for that existing card even when no new lesson is captured.
Only capture non-obvious insights. Prioritize lessons such as:
Capture if:
Update an existing card if:
Skip if:
These skip rules apply to creating a new card. They do not block corrective
updates to an existing card when current evidence shows that the card should be
rewritten or its confidence should change.
Generate a semantic kebab-case ID that describes the lesson (e.g., api-timeout-retry-pattern) when creating a new card.
Before writing or updating a card, check for a semantically similar existing card and make the decision explicit:
decision=create when no similar card exists and a new lesson should be captured.decision=update when a similar card already covers the same lesson, or when current work corrects an existing card.Use decision=create or decision=update only when all affected cards in the
capture pass share the same outcome kind. If one capture pass both creates and
updates cards, report only the created=<n> and updated=<n> counts.
When one capture pass affects multiple cards, report created=<n> and
updated=<n> counts. If one capture pass both creates and updates cards, do
not include decision=.
Assign a scope before writing the card:
project for repo-wide constraintsmodule for package/directory-level constraintsfeature for one flow/componentAssign initial confidence by source:
user-correction: 0.7bug-fix: 0.5retrospective: 0.3Confidence changes only during capture/update, never during recall.
If the user explicitly confirms a lesson remains useful, increase confidence by
+0.1 (max 0.9).
Decrease confidence by -0.1 when later evidence shows the lesson is less
applicable.
When a lesson is partially outdated, update the card content first, then
decrease confidence only if needed.
Set confidence directly to 0.0 only when the card should no longer
participate in normal recall.
Do not decrease confidence solely because the lesson was not used recently.
Write the card to docs/lessons/<id>.md using the template in
references/card-template.md.
Before creating a new card, check semantic duplication:
When current work weakens a recalled or related card:
confidence only if the lesson's default applicability is weaker than beforeconfidence to 0.0 only when the card should no longer participate in normal recallMinimal correction-capture example:
Lessons capture report: decision=update, updated=1 (
db-migration-run-order), confidence=0.7->0.6 (weaker applicability in current config), skipped=0
Card fields:
| Field | Purpose |
|---|---|
| id | Semantic kebab-case slug, also the filename |
| date | ISO date when the lesson was captured |
| scope | project / module / feature applicability |
| tags | 3–6 lowercase tags for recall matching |
| source | user-correction / bug-fix / retrospective |
| confidence | Numeric confidence score used for recall ranking |
| related | 0–2 high-relevance lesson references using [[card-id]] |
| Title | One-line summary of the lesson |
| Context | What was happening when the mistake occurred |
| Mistake | What went wrong |
| Lesson | Extracted rule or best practice |
| When to Apply | Future situations where this lesson matters |
Task-end behavior:
Upsert one row in docs/lessons/_index.md per card ID.
If _index.md does not exist, create it with this structure:
# Lessons Index
> Auto-generated by lessons-learned skill. Do not edit manually.
| Card | Scope | Tags | Date |
|---|---|---|---|
Then keep rows sorted by Date descending (newest first).
Tell the user what was captured using a compact report, e.g.:
Lessons capture report: created=1 (
api-timeout-retry-pattern), updated=1 (db-migration-run-order), skipped=1 (obvious behavior)
If all affected cards share the same outcome kind, include decision=create or
decision=update in the report. If one capture pass both creates and updates
cards, report only the created=<n> and updated=<n> counts.
When capture or update changes confidence, include confidence transition
old->new for each affected card plus a short reason.
For new cards, use none-><value>.
If a transition reaches 0.0, explicitly state that the card is excluded from
normal recall.
Examples:
Lessons capture report: decision=create, created=1 (\api-timeout-retry-pattern`), confidence=none->0.5 (new reusable pattern)`Lessons capture report: decision=update, updated=1 (\db-migration-run-order`), confidence=0.7->0.6 (weaker applicability in current config)`Lessons capture report: decision=update, updated=1 (\legacy-bootstrap-flow`), confidence=0.1->0.0 (excluded from normal recall)`Keep this confirmation short. Prefer the decision, the affected card ID, and a one-line rule summary. Avoid dumping the full markdown card or index contents in normal output.
Use related links for high-value cards only.
Create related links when at least 2 of 4 conditions are true:
Linking constraints:
references/linking-heuristics.md.Broken related targets are non-blocking:
When to Apply.Apply these checks during capture or update. These are blocking failures unless explicitly listed as warnings elsewhere.
id slug.date format is ISO YYYY-MM-DD.scope is one of project, module, feature.tags count is 3–6.source is valid enum.confidence is numeric and in range 0.0-0.9.related count is 0–2 and every target resolves to an existing card.scope._index.md rows are ordered by Date descending (newest first).When used with other skills in the same session, follow the Trigger Contract as the single source of truth:
This is a non-replaceable step — lesson capture cannot be substituted by todo trackers, progress files, or other skill artifacts.
development
--- name: artifact-anatomy description: Defines where spec-driven working artifacts — the spec (e.g. `SPEC.md`), the plan, and the task list (e.g. `tasks/plan.md`, `tasks/todo.md`) — live on disk under `docs/specs/<id>-<slug>/`, and how those directories are numbered, scoped, and resolved so multiple specs can run in parallel without overwriting one another. Use this BEFORE creating, locating, or updating any spec, plan, or task/todo file: whenever a spec/plan/build workflow writes these artifac
development
Write a short author's briefing to hand to a code reviewer whose agent already has its own review skill, so it supplies the context that skill can't see instead of repeating how to review. Right after you finish a piece of work, it mines this session (and any kickoff implementation-notes) for what the reviewer most needs flagged — the easy-to-miss changes, the parts you're least sure about, the looks-wrong-but-intentional bits, and the blast radius — plus the exact commit range to review. Use when you've just finished work and want to hand the review off to another agent, chat, or teammate, when you want a "heads-up for the reviewer", or when packaging a change for review elsewhere. It does not perform the review and does not re-specify severity tiers or output format — that's the reviewer's own skill's job.
testing
Use when creating, rewriting, pruning, or reviewing `AGENTS.md` or `CLAUDE.md`, especially to remove repo summaries, stale rules, and other low-signal global instructions. Trigger when deciding what belongs in always-on agent files versus a task-specific skill.
development
Drive a structured tutoring workflow that turns Claude into a learning onramp accelerator — consultative diagnosis → custom syllabus → unit-by-unit guided lessons with notes/whiteboard → dynamic adjustment from an accumulating learner profile. Use when the user states a learning goal ("I want to systematically learn X", "teach me Y", "help me prep for Z exam"), uploads study materials and asks for a course plan, or signals sustained guided study (mentions tutor, syllabus, course, lessons, study plan, curriculum, 家教, 學習路徑). Skip for one-shot factual Q&A or quick code-context explanations.