session-kb-suggest
Skill12 starsChanged 8 days agoMITView on GitHub
Analyze a past Claude session to find codebase-exploration patterns and suggest a KB article that would shortcut similar future tasks
In this repository28 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- adlc-scriptingSkill
- architect-assistantSkill
- big-prod-e2e-testSkill
- ceSkill
- changelogSkill
- check-fix-buildSkill
- db-state-updateSkill
- git-branchingSkill
- github-issuesSkill
- hook-debuggingSkill
- migrations-data-integritySkill
- morning-checkSkill
- nodejs-scriptSkill
- pocSkill
- post-impl-check-client-component-sizeSkill
- post-impl-check-cost-calc-no-autoSkill
- post-impl-check-indexesSkill
- post-impl-check-kb-actualSkill
- post-impl-check-migrationsSkill
- post-impl-check-performance-no-autoSkill
- post-impl-check-security-no-autoSkill
- security-checkSkill
- server-e2e-testsSkill
- sql-reviewSkill
- ui-componentsSkill
- update-install-instructionsSkill
- use-playwrightSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
If $ARGUMENTS is empty, run:
- Distinctive: line 27
If the script exits non-zero (file not found, parse error), report the error output and STOP.
- Very specific: line 41
Read docs/knowledgebase/index.md.
- Distinctive: line 63
All of these must be true:
- Distinctive: line 67
Not already covered in the KB
- Distinctive: line 75
Ask the user: "Should I create this KB article?"
- Distinctive: line 77
If the user says yes:
- Very specific: line 78
Write docs/knowledgebase/<filename>.md with the draft content.
- Very specific: line 79
Add one line to docs/knowledgebase/index.md under the most appropriate section: * Title - <one-line description>
- Distinctive: line 84
If the exploration was task-specific, scattered across unrelated subsystems, required dynamic inspection, or the pattern is already covered …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Analyze local Claude session $ARGUMENTS for repeating exploration patterns, then decide whether a new Knowledgebase article is warranted.
Step 1 — Validate argument
If $ARGUMENTS is empty, run:
node .claude/skills/session-kb-suggest/analyze-session.jsThis lists the 10 most recent sessions for this project. Show them to the user and ask which session to analyze. STOP — do not proceed until the user provides a session ID.
Step 2 — Parse the session
Run via Bash:
node .claude/skills/session-kb-suggest/analyze-session.js $ARGUMENTSIf the script exits non-zero (file not found, parse error), report the error output and STOP.
The JSON output contains:
taskGoal— first user message (what the user was trying to accomplish)followUpMessages— subsequent user messages (clarifications, redirections)toolCallCounts— how many times each tool was calledfilesRead— files opened, sorted by read frequencygrepSearches— grep patterns and paths searchedglobSearches— glob patterns usedagentCalls— Explore/general agent prompts from the main sessionbashCommands— shell commands run
Step 3 — Read the existing KB index
Read docs/knowledgebase/index.md. Note which topics are already covered so you don't propose duplicates.
Step 4 — Analyze for a repeatable pattern
Answer these questions mentally before deciding:
- Task goal — What was the user trying to understand or find? One sentence.
- Navigation path — What sequence of searches/reads did the session take? Describe it in 3–6 steps (e.g., "read index → grep for service name → open controller → discover the actual logic is in a helper").
- Non-obvious entry point? — Did it take multiple hops to find the right starting file? Was the connection between files non-obvious from names alone?
- Coherent cluster? — Do the touched files cluster around a single subsystem or concept? Or are they scattered across unrelated areas?
- Static shortcut possible? — Would a one-page document that says "to understand X, start at file Y because Z" have reduced the search to ≤ 1 hop? Or did the session require inspecting live/dynamic state that no static doc could replace?
- Already covered? — Is the pattern already documented in the KB index you read in step 3?
Step 5 — Decide
Case A — KB article is warranted
All of these must be true:
- Clear navigation cluster (files cluster around one subsystem/concept)
- Non-obvious entry point (took multiple hops)
- Shortcuttable by a static document
- Not already covered in the KB
Output:
- One sentence describing the pattern found.
- A draft KB article in the project's style:
- YAML frontmatter:
type,title,description,tags(array),generated: { by: "agent:claude-code", at: "<now, RFC 3339 with offset>" }(OKF v0.3; never the oldtimestampkey) - Body: concise, factual — no narrative filler. Include: subsystem overview (2–3 sentences), a table of key files with their roles, and "Where to start" guidance (the entry point and why).
- YAML frontmatter:
- Suggested filename in
kebab-case.md. - Ask the user: "Should I create this KB article?"
If the user says yes:
- Write
docs/knowledgebase/<filename>.mdwith the draft content. - Add one line to
docs/knowledgebase/index.mdunder the most appropriate section:* [Title](filename.md) - <one-line description>
Case B — Unavoidable search
If the exploration was task-specific, scattered across unrelated subsystems, required dynamic inspection, or the pattern is already covered — say:
No KB article warranted. [1–2 sentences explaining why the search was unavoidable or already documented.]
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

