agentleFS
DataArtDataArt/artisyn-log-hub/.claude/skills/session-kb-suggest/SKILL.md

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

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
  1. Very specific:

    If $ARGUMENTS is empty, run:

    line 11
  2. Distinctive:

    If the script exits non-zero (file not found, parse error), report the error output and STOP.

    line 27
  3. Very specific:

    Read docs/knowledgebase/index.md.

    line 41
  4. Distinctive:

    All of these must be true:

    line 63
  5. Distinctive:

    Not already covered in the KB

    line 67
  6. Distinctive:

    Ask the user: "Should I create this KB article?"

    line 75
  7. Distinctive:

    If the user says yes:

    line 77
  8. Very specific:

    Write docs/knowledgebase/<filename>.md with the draft content.

    line 78
  9. Very specific:

    Add one line to docs/knowledgebase/index.md under the most appropriate section: * Title - <one-line description>

    line 79
  10. Distinctive:

    If the exploration was task-specific, scattered across unrelated subsystems, required dynamic inspection, or the pattern is already covered …

    line 84

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.js

This 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 $ARGUMENTS

If 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 called
  • filesRead — files opened, sorted by read frequency
  • grepSearches — grep patterns and paths searched
  • globSearches — glob patterns used
  • agentCalls — Explore/general agent prompts from the main session
  • bashCommands — 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:

  1. Task goal — What was the user trying to understand or find? One sentence.
  2. 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").
  3. 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?
  4. Coherent cluster? — Do the touched files cluster around a single subsystem or concept? Or are they scattered across unrelated areas?
  5. 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?
  6. 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:

  1. One sentence describing the pattern found.
  2. 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 old timestamp key)
    • 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).
  3. Suggested filename in kebab-case.md.
  4. Ask the user: "Should I create this KB article?"

If the user says yes:

  • Write docs/knowledgebase/<filename>.md with the draft content.
  • Add one line to docs/knowledgebase/index.md under 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.]

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.