Capture a recurring rule or pattern into context/foundation/lessons.md. Use when you spot a class of bug or design pitfall worth surfacing for future reviews and implementations.
Ships in product-shaping. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Append a single entry to context/foundation/lessons.md so future agents (and future humans) can re-read it as a prior when planning, implementing, or reviewing related work. Invoke it inline when you notice a pattern worth surfacing.
A "lesson" is a recurring rule — not a one-off bug fix. The bar is: "this would have changed the framing or the fix on past work, and will keep coming up." If it's a single-incident write-up, this is the wrong skill.
When this skill is invoked:
/shape-lesson feature flags should always have a kill date), use it as a seed for the Rule field and proceed to the interview.I'll record a recurring rule into context/foundation/lessons.md.
I'll ask four short questions and then append the entry. The four fields are:
1. Context — where this rule applies (subsystem / phase / file pattern)
2. Problem — what goes wrong without the rule
3. Rule — the rule itself, in one or two sentences
4. Applies to — which skills should weigh this most (frame / plan / implement / review)
Then wait.
CONTEXT_ROOT and exclude context/ from gitBefore reading or writing anything under context/, apply the context-root protocol documented in ../shape-init/references/context-root-protocol.md. It is idempotent — if context/ is already excluded (or if you are not inside a git repo), it is a no-op. The protocol resolves CONTEXT_ROOT to the main working tree of the repo (so worktrees share one lessons.md file) and appends context/ to the shared <git-common-dir>/info/exclude if needed. Treat context/foundation/lessons.md in the rest of this skill as $CONTEXT_ROOT/context/foundation/lessons.md. Surface a one-line git-exclude: <state> in this skill's final summary, plus a context-root: <path> line when CONTEXT_ROOT differs from cwd (so the user knows their lesson landed in the shared, worktree-spanning location).
Use AskUserQuestion to collect the four fields. You may batch them as one round of four free-form prompts (each option set is just ["I'll fill it in"] — i.e., the user picks "Other" to type the answer), or run four sequential rounds. Either form is fine; the goal is that the user, not the skill, writes the wording.
Pre-fill nothing. The user provides every field. If a freeform intent was passed in the invocation, surface it as a suggestion next to the Rule prompt — not as the default.
The four fields, with one-line guides:
frame, research, plan, implement, review. Use all if the rule cuts across the whole lifecycle.Render the proposed entry as a markdown block and show it to the user. Use AskUserQuestion to confirm:
context/foundation/lessons.md?"
header: "Confirm"
options:
The proposed entry shape (this is the canonical lesson-entry format):
## <Rule title — short imperative phrase, derived from the Rule field>
- **Context**: <Context field>
- **Problem**: <Problem field>
- **Rule**: <Rule field>
- **Applies to**: <Applies-to field>
The H2 heading IS the rule title. Keep it short — the H2 list is what future skills scan first.
If context/foundation/lessons.md does not exist, create it with this canonical 3-line header (embedded inline — no separate template file):
# Lessons Learned
> Append-only register of recurring rules and patterns. Re-read at the start of planning, implementation, and review work.
If the file exists, leave it untouched and append to the end. Do not reorder, deduplicate, or reformat existing entries — the file is append-only.
Use Edit (or Write for the bootstrap case) to land the change. After append, re-read the file and confirm the new H2 is the last section.
Print the path and the rule title:
Appended to context/foundation/lessons.md:
## <Rule title>
Stop. Do not chain into other skills. The user invoked this for a single capture; respect the scope.
/shape-init creates the /context directory skeleton; this skill owns lessons.md end-to-end.)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/product-shaping:shape-lessonfrom product-shaping
npx claudepluginhub patrykkopycinski/patryks-treadmill-claude-plugins --plugin product-shaping30 skills in this plugin
/shape-agents-mdGenerate an AGENTS.md onboarding document for AI coding agents working in this repository. Inspects the repo (package manifest, README, scripts, lint/test config, layout, commit history) and writes a concise contributor guide titled "Repository Guidelines". Use when the user invokes /shape-agents-md, asks to "create AGENTS.md", "write an agent onboarding doc", "generate contributor guide for agents", or similar. The output is optimized to be small, precise, reference-heavy, and ordered with critical rules at the top — so a future agent reads it once and stays unblocked.
/shape-archiveArchive a completed change by moving its folder into context/archive/ and stamping change.md with archived status/shape-