~/stepanic
All posts
Claude CodeSkillsAI-nativeDeveloper toolingOpen source

I mined a Claude Code skill out of 147 of my own sessions — and the data corrected me twice

I kept retyping the same end-of-session paragraph. Instead of writing the shortcut from memory, I counted what I actually asked for across 145 projects of local transcripts. The counts disagreed with my self-image in two useful places.

At the end of almost every Claude Code session I was typing a variation of the same paragraph:

super, daj sve commitaj i pushaj, update memory fajlova i ako u ovom chatu postoji neko znanje koje nije trajno u codebaseu trajno ga spremi u markdown dokument ako i treba s mermaidjs vizualizacijama i nakon toga pripremi chat za clear

Roughly: commit and push everything, update the memory files, and if this chat produced knowledge that is not permanently in the codebase, write it into a markdown document, with mermaid diagrams if it needs them, then prepare the chat for /clear.

So on 4 August 2026 I asked for a shortcut. The interesting part is what happened next: the skill was not written from my description of my habit. It was mined out of my own transcripts, and the counts corrected me twice.

The evidence was already on disk

Claude Code stores every session as JSONL under ~/.claude/projects/. At that moment: 145 project directories, 2.5 GB. So the first step was not writing a file, it was counting one:

cd ~/.claude/projects
grep -rliE "pripremi.{0,30}chat za clear" --include=*.jsonl . | wc -l
# 147

147 sessions contained the phrase. Deduplicating the messages I had actually typed gave 119 distinct phrasings of the same request — "sve commitaj i pushaj i preimremi chat za clear", "ok, updejtaj memory fajlove i pripremi chat za clear", typos and all. That is the honest shape of a habit: not one prompt, a cloud of near-identical ones.

Then the part that actually shaped the skill — counting which steps show up in the fullest variants:

step I asked for share of variants
"prepare the chat for clear" 100%
commit + push 88%
update memory files 70%
write a markdown document 41%
mermaid diagram 12%
touch docs/ or CLAUDE.md explicitly 0%

The two things I had wrong about myself

Mermaid is not a default. I feel like I ask for diagrams constantly. I ask for them 12% of the time. Had I written the skill from memory it would have drawn a diagram on every run — faithful to my self-image, wrong about my behaviour. What went into the file instead: use mermaid when a relationship or a flow is not obvious from prose; do not draw a diagram for something that is one sentence.

The most valuable step was missing from my own prompt. The longest variants ask for a handoff prompt in the clipboard, ready to paste into a fresh session after /clear. It was even recorded in a memory file. But it had dropped out of the sentence I type, because I had started assuming it. Mining surfaced a step my habit had gone silent about, and it became step 4.

The rule in red

One line in the skill is marked with a red dot: never git add -A.

That is not a style preference, it is a near-miss written down. During the very session that produced the skill, a neighbouring repo's working copy held an unfinished .gitignore and a set of half-written shell scripts, untracked, while unrelated work was being committed. git add -A would have pushed somebody's half-done afternoon to main.

So the skill stages by name, and for any modified file the agent does not remember touching, it runs git diff and leaves it alone if it is not its own. Same paragraph forbids committing cron-written snapshots and .env, and forbids reporting "pushed" without checking the output of the push.

I think that is the general shape of a rule worth putting in a skill: not a preference, a thing that almost went wrong once.

What it actually does

Five steps, in order, autonomously to the end:

  1. Commit + push across every repo touched in the session. Work crosses repo boundaries constantly — a backend change, the dashboard that reads it, the fetcher that feeds it — and the last one is the one you forget. Staged by name, semantic commit messages whose body explains why, push verified from its output.
  2. Memory files. One fact per file, update the existing file rather than creating a duplicate, only what still holds for future sessions.
  3. Knowledge that is not in the codebase, into docs/YYYY-MM-DD-topic.md. The framing that makes this step work: not "what did we do" — git already knows that — but "what would the next pass have to rediscover". Rejected alternatives and why. The measurement that decided a threshold. The silent failure that cost an afternoon.
  4. A handoff prompt into the clipboard and printed in the reply, because the clipboard has a habit of getting lost before /clear.
  5. A summary whose most important section is what is still open or unverified.

It cannot run /clear itself. That is a built-in CLI command, so the last line tells me to type it.

Two entry points, on purpose

You can invoke it as /wrap-up. You can also just keep typing your usual sentence: the description: field contains the real phrases from those 119 variants, so the skill triggers on its own. A shortcut you have to remember is a shortcut you will forget — the whole point was to automate a habit, not to replace it with a new one to maintain.

Does it hold up

Between 4 and 26 August 2026 it fired 47 times across 11 working days, in every repo I touched, not just the one it was born in.

The failure mode it removes is not typing effort. It is the session that ends with a good measurement, a rejected approach and the reason for it, all of it alive only in a context window that is about to be cleared.

Mine your own

The method transfers to any prompt you keep retyping. Count the occurrences, dedupe the variants, count which steps appear, then write the skill against the counts instead of your recollection, and put the real phrasings into description:.

Two caveats, both of which bit me:

  • The 30-day pruning is a default, not a law. Claude Code deletes local transcripts after 30 days, but cleanupPeriodDays in ~/.claude/settings.json sets that window — I run 365. Raise it before you need the history, because the setting cannot bring back what has already gone. And for a durable copy, back the directory up too: dotclaude-sync mirrors all of ~/.claude — transcripts, settings and the memory files — into a daily git snapshot and pushes it to a private remote (Google Drive, in my case). That archive is the same one that powers the usage stats on this site.
  • The skill contaminates its own evidence. Once description: contains your trigger phrases, every session that loads the skill list contains them too, and a naive grep balloons. Re-running that first count today returns 562 sessions; filtered to messages a human actually typed it is 193. Filter to type == "user".

The skill, in English and in the Croatian original, plus the mining script: github.com/stepanic/cv/tree/main/skills/wrap-up. MIT. The part worth copying is the method, not my five steps.

Sources