/agent-docs:update-knowledgefrom agent-docs
Capture learnings from current session into agent documentation. Use when the user asks to "update project knowledge", "capture session learnings", or "record improvements or postmortems".
Ships in agent-docs. 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.
Read when SKILL.md points to them.
When new knowledge is gained during development, update the appropriate knowledge files.
| File | Context loading | Purpose | Keep it... |
|---|---|---|---|
knowledge.md | Full file — always | Rules, constraints, guardrails | Concise. No code blocks. One rule per entry. |
patterns.md | Full file — always | Implementation catalog with file pointers | Short entries. Source files are authoritative. |
improvements.md | Titles only | Lessons from wrong turns | Actionable. Graduate recurring lessons to knowledge.md. |
postmortems/ | Frontmatter only | Detailed wrong-path writeups | Thorough. Full context for complex incidents. |
Good code over documentation. Before writing a patterns.md or knowledge.md entry for a pattern, ask: can this be expressed as well-written code? A shared component, named function, or clear API is better than an external doc entry. Document only constraints, non-obvious decisions, and context that cannot live in the code itself. Bug fixes already reflected in the code do not need a knowledge entry.
Generic rules only. Rules in knowledge.md must be principle-based and reusable — not tied to specific module names, function signatures, file paths, or current implementation details. Those are derivable from the code. If a rule only applies to one specific call site, it does not belong in knowledge.md.
Merge or resolve before adding. Before writing a new entry, scan existing entries for similar or conflicting content. If a similar entry exists, update or merge it. If a conflict exists, resolve it — do not let contradictory rules coexist. Prefer fewer, stronger rules over many narrow ones.
No duplication across files. A lesson appears in ONE place. If an improvement becomes a standing rule, move it to knowledge.md and remove the improvement entry. If a pattern overlaps a rule, the rule goes in knowledge.md (what/why) and the pattern goes in patterns.md (where to look).
Minimize code blocks in knowledge.md. Rules are constraints, not implementations. Prefer pointing to patterns.md or source files. Add a short code example only when it meaningfully clarifies a rule that would otherwise be ambiguous.
Prefer pointers to copies. Use file:line references instead of code snippets. Source files are authoritative — copied code goes stale.
Verify references. When referenced files are modified, check that file:line pointers are still accurate.
Graduate improvements. After an improvement entry is applied 2+ times, or when it represents a permanent constraint, extract the rule into knowledge.md and remove the improvement entry.
### [Clear, descriptive title]
**Rule:** One-line actionable constraint.
**Why:** One-line rationale (skip if self-evident).
**Reference:** `path/to/file:line` (optional)
### [Title — matches knowledge.md rule if related]
One-line description of when to use this pattern.
**Reference:** `path/to/file:line-line`
## YYYYMMDD: [Title that describes the lesson, not just the incident]
**Problem:** What went wrong
**Root Cause:** Why it happened
**Fix:** How it was resolved
**Guardrail:** What quick check prevents this next time
**Reference:** `path/to/file` or `postmortems/YYYY-MM-DD-slug.md`
knowledge.mdpatterns.mdimprovements.mdpostmortems/ (see Postmortem Workflow below)When a session includes a significant wrong path (user correction, surprising failure, or context-heavy lesson):
postmortems/YYYY-MM-DD-brief-slug.md using the postmortem template (see references/postmortem-template.md)improvements.md linking back to the postmortemknowledge.mdknowledge.md?file:line references are still accurate if those files were modified.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub fahchen/skills --plugin agent-docs2 skills in this plugin
Other plugins' skills for the same job