skills/audit-transcripts-for-learnings/SKILL.md
Audit past Claude Code transcripts in a chosen scope and date window to extract reusable patterns, then walk through each one to promote it into a slash command, CLAUDE.md rule, memory entry, or new skill. Use when the user wants to retrospectively mine sessions for workflow improvements, recurring corrections, validated approaches, or repeated procedures worth capturing.
npx skillsauth add preetamnath/agent-skills audit-transcripts-for-learningsInstall 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.
Retrospective audit of past Claude Code sessions. Extracts reusable patterns from transcripts in a chosen scope and date window, then walks the user through each one inline — promote to active config, reject, refine, or skip — in a single conversation.
Use AskUserQuestion to ask which transcripts to scan. No defaults — always ask.
Question: "Which transcripts should I audit?" Options:
pwd and match against ~/.claude/projects/<slug>/).~/.claude/projects/.find ~/.claude/projects -maxdepth 1 -mindepth 1 -type d | xargs -I {} sh -c 'echo "$(find {} -name "*.jsonl" -newermt "30 days ago" 2>/dev/null | wc -l) {}"' | sort -rn | head -10 to rank.)Resolve the chosen scope to a concrete list of project directories before continuing.
Project slug: when a project root is needed for path resolution, derive the slug by replacing / with - in the absolute path (e.g. /Users/x/code/Foo → -Users-x-code-Foo). Verify it exists under ~/.claude/projects/<slug>/ before writing.
Use AskUserQuestion to ask the date window. No defaults.
Question: "What date range?" Options:
YYYY-MM-DD to YYYY-MM-DD.Convert the window to an absolute start date for find -newermt.
For each project dir in scope, run:
find <project-dir> -maxdepth 1 -name "*.jsonl" -newermt "<start-date>"
Count total files and per-dir. Some .claude/projects/ subdirs contain only bash safety-classifier sidechains — short non-interactive transcripts. The scan will pick these up but they yield zero findings; that's fine.
Split the file list across 2–4 parallel general-purpose subagents with model: "sonnet", chunked roughly evenly. Each subagent's prompt:
type values matter:
user: .message.content is a string when the user typed something; an array of tool_result blocks otherwise (skip those for prompt analysis).assistant: .message.content is always an array of blocks (text, thinking, tool_use). For tool calls: .name and .input are top-level on the block.jq to scan. If uncertain on a particular project's transcripts, sample with head -3 <file> | jq ..Cap each subagent's response at ~600 words. The orchestrator (this skill) aggregates.
Merge all subagent outputs. Collapse near-duplicates (same correction expressed in different sessions = one finding with multiple evidence pointers). Frequency raises priority but doesn't gate inclusion — a single high-value insight is still a finding.
Before presenting findings, read these so you can flag overlaps:
Read based on where the skill is invoked from (not on audit scope):
Always:
~/.claude/CLAUDE.md~/.claude/commands/~/.claude/skills/ (top level only)~/Desktop/code/agent-skills/skills/If pwd is inside a project (resolve project root by walking up for the nearest .git/ or CLAUDE.md):
<project-root>/CLAUDE.md<project-root>/.claude/commands/ and <project-root>/.claude/skills/~/.claude/projects/<slug>/memory/MEMORY.md indexDo not iterate every project's CLAUDE.md when audit scope is global — only the project you're currently inside (if any).
For each finding, check if it's already covered. If yes, note it and demote the recommendation (skip-by-default or merge-with-existing rather than create-new).
Show one block:
Audit complete: <scope> · <window>
Files scanned: N · Findings: M
By suggested action:
• Promote: X
• Refine first: Y
• Skip (already covered): Z
• Reject candidates: W
By category:
• Corrections: ...
• Repeated workflows: ...
• etc.
For each finding (in this priority order: highest-frequency corrections first, then repeated workflows, then the rest):
Use AskUserQuestion:
Question: "What would you like to do with this finding?" Options (Recommended option first):
Do not ask follow-ups unless an ambiguity in the finding genuinely requires it. Keep moving.
propose-alternatives agent before re-asking.Two AskUserQuestion prompts in sequence (do not combine into multiSelect — they're sequential decisions with different option sets):
Prompt 1: "What should this become?"
Use the artifact-type matrix below. Pre-select your recommendation as option 1.
| Type | When to use | Loaded |
|---|---|---|
| Slash command (commands/*.md) | Actionable procedures invoked on-demand — debugging workflows, setup steps, code generation templates | Only when user types /command-name |
| CLAUDE.md rule | Behavioral rules Claude should always follow — coding style, response format, "always do X / never do Y" | Every session (always-on context) |
| Memory entry (memory/*.md) | Project/user context that informs decisions — who the user is, what's being worked on, external references | Every session (auto-loaded, lighter than CLAUDE.md) |
| Skill (skills/<name>/SKILL.md) | Complex multi-step capabilities with phases — rare, most patterns are better as commands or rules | When matched by skill system |
Prompt 2: "Global or project-scoped?"
If artifact type = Memory entry, skip this prompt — memory is always project-scoped.
| Scope | When |
|---|---|
| Global (~/.claude/) | Pattern applies across projects — general technique, language-level pattern, workflow preference |
| Project-scoped (<project>/.claude/ or ~/.claude/projects/<slug>/) | Pattern is specific to one tech stack, codebase, or workflow |
For findings tagged with project-specific domains (e.g. shopify, django), recommend project-scoped. For language-level or workflow patterns, recommend global.
Write the artifact at the correct path:
| Type | Global path | Project-scoped path |
|---|---|---|
| Slash command | ~/.claude/commands/<name>.md | <project-root>/.claude/commands/<name>.md |
| CLAUDE.md rule | Append to ~/.claude/CLAUDE.md | Append to <project-root>/CLAUDE.md |
| Memory entry | ~/.claude/projects/<project-slug>/memory/<name>.md + update MEMORY.md index | N/A |
| Skill | ~/Desktop/code/agent-skills/skills/<name>/SKILL.md (then update repo README) | <project-root>/.claude/skills/<name>/SKILL.md |
Steps:
agent-skills/skills/, also append a row to its README table.After all findings are processed:
Audit complete.
• Promoted: N (list with paths)
• Refined: N
• Skipped: N
• Rejected: N
If anything was promoted to ~/.claude/CLAUDE.md or to a skill, briefly remind the user that those take effect on the next session.
AskUserQuestion calls before any scanning.~/.claude/skills/learned/ — findings live in the conversation. The user explicitly chose this design.AskUserQuestion lists your recommended option first, marked (Recommended), with one-sentence reasoning embedded in the option's description.development
Judge whether a candidate fact earns a durable-doc line: keep only what a future agent would get the wrong answer without; cut anything derivable from code, setup, breadcrumb, or a restated default. TRIGGER when: user asks 'does this belong in CLAUDE.md / a rule / the docs', 'is this worth keeping/writing down', 'should this be a comment'; vetting or pruning a fact before it's filed or shaped.
testing
Audit one instruction file by composing the durable-instruction lenses over it — vet-fact (WORTH: does each fact earn a line?), place-fact (PLACE: is it in the right home?), tighten-instruction (SHAPE: tighten the line). Pick the subset the file needs: shape-only, worth+shape, or worth+place+shape. A misplaced fact can be relocated to its right home on your approval, or deferred for a durable-docs-update batch. TRIGGER when: user wants a skill file or durable doc (CLAUDE.md, a rule, ARCHITECTURE.md) audited for what to keep, where it belongs, and how it reads; user says 'refine/audit this file', 'prune and tighten this doc', 'what here is worth keeping'. For shape-only tightening, tighten-file is the leaner sibling.
development
Route a kept fact to its durable home by delivery trigger and most-local-wins — across in-file comment, nested CLAUDE.md, path-scoped rule, root CLAUDE.md, ARCHITECTURE.md, or a skill. TRIGGER when: user asks 'where should this go', 'which file/rule/home does this belong in', 'is this in the right place', 'should this be a pointer'; placing or re-homing a fact already judged worth keeping.
development
Sequence a locked spec into dependency-ordered, wave-grouped tasks. TRIGGER when: user says 'build the plan' or 'sequence this'; a spec needs slicing into parallel-safe waves.