From selfskill
Mine the user's past Claude Code sessions for repeated multi-step workflows and write each one as a new SKILL.md in ~/.claude/skills. Use when the user says "mine my skills", "selfskill", "generate skills from my history", runs /selfskill, or wants to turn how they actually work into reusable skills.
How this skill is triggered — by the user, by Claude, or both
Slash command
/selfskill:selfskill-mineThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Turn the user's own transcript history into personalized Claude Code skills. Read local `.jsonl` files from `~/.claude/projects/`, find workflows they repeat, and write one `SKILL.md` per workflow into `~/.claude/skills/`.
Turn the user's own transcript history into personalized Claude Code skills. Read local .jsonl files from ~/.claude/projects/, find workflows they repeat, and write one SKILL.md per workflow into ~/.claude/skills/.
Runs entirely inside this session — no external service, no separate API key. Nothing leaves the machine.
/selfskill~/.claude/skills/ from their own workDon't use this for installing community skills (point to a marketplace) or authoring one skill by hand.
min_occurrences — min sessions a workflow must appear in (default 3)max_skills — max skills to generate this run (default 10)dry_run — preview only, write nothing (default false)incremental — only mine sessions newer than the last run (default true)transcripts_dir (default ~/.claude/projects) · output_dir (default ~/.claude/skills)One line back to the user, e.g.:
Mining
~/.claude/projectsfor workflows that repeat ≥3×, writing up to 10 skills to~/.claude/skills/. Incremental: on. Dry run: off.
~/.claude/skills/.selfskill/state.json if it exists: { "version":1, "lastRunAt": <ms>, "generatedSkills": [slugs] }. Missing/unreadable → treat as first run (lastRunAt: 0).~/.claude/skills/*/SKILL.md to list slugs that already exist on disk. Union with generatedSkills → the known set. Never regenerate a skill already in the known set; never overwrite an existing skill.**/*.jsonl under the transcripts dir. Empty → stop, tell the user there's nothing to mine.incremental and lastRunAt > 0, keep only files modified after lastRunAt. If that leaves nothing, stop and tell them to re-run with incremental off for a full pass.Reading 60 full transcripts at once will blow the context window and silently truncate. Instead, work in batches of ~10 files:
.jsonl files are large; the head holds the opening prompt + first tool calls, which is what identifies a workflow).From the summaries, find multi-step sequences appearing at least min_occurrences times — e.g. "run migrations → restart dev server → smoke-test endpoint", "open PR → wait for CI → squash merge", "scaffold shadcn component → wire variants → hook to form".
Per cluster record: a kebab-case slug, a one-sentence when-to-use, 3–7 concrete steps (with the exact commands the user actually runs), and the count of sessions it came from. Rank by occurrences × step count; keep at most max_skills. Drop any cluster whose slug is in the known set (step 2). None left → report and suggest lowering min_occurrences.
For each surviving cluster, write to the Anthropic skill spec:
---
name: <slug>
description: <one sentence, present tense, starts with a verb>
---
# <Title Case Name>
## When to use
- <trigger>
- <trigger>
## Steps
1. <concrete action / exact command>
2. ...
## Notes
- Mined from <N> of your past sessions.
- <caveat or related skill>
Rules: frontmatter name == slug · description one verb-first sentence · valid markdown, not wrapped in fences · only encode steps actually visible in the transcripts — do not invent · reference the real commands they run.
With Write, create ~/.claude/skills/<slug>/SKILL.md. If dry_run, write nothing — print proposed paths + a preview of each instead. If a slug somehow collides, suffix -v2, -v3 rather than overwrite.
Unless dry_run, write ~/.claude/skills/.selfskill/state.json with version:1, lastRunAt = now (epoch ms), and generatedSkills = previous list ∪ newly written slugs. This is what makes the next run incremental.
/help to load the new skills."selfskill npm CLI (npx selfskill mine) mirrors this for headless/CI use (it does use your own ANTHROPIC_API_KEY).Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub abhiyan100/self-skill --plugin selfskill