Skip to content

abhiyan100/self-skill

Repository files navigation

SelfSkill

Mines your past Claude Code sessions and writes the personal skills only you would need.

Every other Claude Code tool searches a registry. SelfSkill watches how you actually work — reads your local transcripts, finds the workflows you repeat, and turns them into proper SKILL.md files in ~/.claude/skills/.

No registry. No copy-paste. Just yours.

# Option A — Claude Code plugin (zero config, uses your active Claude session)
/plugin marketplace add abhiyan100/self-skill
/plugin install selfskill@selfskill
/selfskill

# Option B — standalone npm CLI (for CI, scripts, headless)
npx selfskill mine

What it does

Claude Code stores every session you have with it as a .jsonl transcript on your machine. Those transcripts are a record of how you actually use Claude — the prompts you tend to send, the tool sequences that follow, the things you redo every week.

SelfSkill reads that history, clusters repeated multi-step workflows, and synthesizes one SKILL.md per cluster. Claude then auto-loads those skills the next time it sees a matching context.

~/.claude/projects/**/*.jsonl  ─▶  selfskill mine  ─▶  ~/.claude/skills/<your-skill>/SKILL.md

Quick start

SelfSkill ships two ways. Pick whichever fits your flow.

As a Claude Code plugin (recommended)

Zero config. No API key. Uses your active Claude Code session.

/plugin marketplace add abhiyan100/self-skill
/plugin install selfskill@selfskill
/selfskill

Inside Claude Code, the /selfskill slash command triggers the selfskill-mine skill. Claude reads your local transcripts using its built-in Read + Glob tools, clusters repeated workflows in the same session, and writes SKILL.md files using Write. Nothing leaves your machine.

Optional arguments:

/selfskill --min-occurrences 2 --max-skills 5 --dry-run

As a standalone npm CLI

For headless use, CI, or scripted runs. Requires your own ANTHROPIC_API_KEY.

# 1. set your Anthropic key
export ANTHROPIC_API_KEY=sk-ant-...

# 2. verify environment
npx selfskill init

# 3. mine your skills
npx selfskill mine

# 4. list what got written
npx selfskill list

Commands

Command Description
selfskill mine Read transcripts, cluster repeated workflows, write SKILL.md files
selfskill list List skills installed in ~/.claude/skills
selfskill init Print environment + paths SelfSkill will use

mine options

Flag Default Description
-t, --transcripts-dir <path> ~/.claude/projects Where to read .jsonl sessions from
-o, --output-dir <path> ~/.claude/skills Where to write generated SKILL.md files
-n, --min-occurrences <n> 3 Minimum times a workflow must repeat before becoming a skill
-m, --max-skills <n> 10 Max number of skills to generate per run
--model <id> claude-sonnet-4-6 Claude model used for clustering + synthesis
--all false Mine full history (default: only sessions since the last run)
--dry-run false Preview without writing files
-v, --verbose false Verbose logs

By default mine is incremental: it only looks at sessions with activity since the last run (tracked in ~/.claude/skills/.selfskill/state.json) and skips any workflow it already turned into a skill. Pass --all to re-mine everything.

How it works

┌─────────────────────────────────────────────────────────────────┐
│                       Local-only pipeline                       │
├─────────────────────────────────────────────────────────────────┤
│  1. Walk ~/.claude/projects for .jsonl files                    │
│  2. Parse each transcript into user/assistant/tool turns        │
│  3. Send session summaries to Claude → cluster workflows        │
│  4. For each cluster, call Claude → write a SKILL.md            │
│  5. Save under ~/.claude/skills/<slug>/SKILL.md                 │
└─────────────────────────────────────────────────────────────────┘

Two Claude API calls per run on average: one to cluster, N to synthesize. No background daemon. No network besides the Anthropic API.

Skill file format

SelfSkill emits standard Anthropic Agent Skills:

---
name: deploy-vercel-with-env-sync
description: Deploy the current branch to Vercel and sync env vars before pushing
---

# Deploy Vercel with Env Sync

## When to use this skill
- User asks to deploy, ship, or promote to production
- Recent commits touch `apps/web`

## Steps
1. Run `pnpm typecheck`
2. Sync env vars with `vercel env pull`
3. Promote with `vercel deploy --prod`

## Notes
- Skip env pull if `.env.local` is fresher than 24h.

Claude Code auto-discovers anything in ~/.claude/skills/.

Privacy

Everything runs on your machine. Transcripts never leave your laptop except as summaries sent to your own Anthropic account.

  • No telemetry
  • No cloud storage
  • No third-party registries

Programmatic API

import { runMine } from "selfskill";

const result = await runMine({
  minOccurrences: 2,
  maxSkills: 5,
  dryRun: true,
});

console.log(result);
// {
//   sessionsScanned: 74,
//   sessionsConsidered: 9,      // this window (incremental)
//   entriesProcessed: 8421,
//   clustersFound: 4,
//   skillsGenerated: 3,
//   skillsSkipped: 1,           // already existed
//   incremental: true,
//   outputPaths: ["/Users/me/.claude/skills/deploy-vercel-with-env-sync/SKILL.md", ...]
// }

Development

git clone https://github.com/abhiyan100/self-skill
cd selfskill
npm install
npm run build
npm run test
node dist/cli.js mine --dry-run
Script Description
npm run build Bundle CLI and library with tsup
npm run dev Watch-build during development
npm run test Run vitest suite
npm run typecheck Strict TypeScript check
npm run lint Biome lint
npm run format Biome format

Roadmap

  • ✅ Incremental mining — only process sessions since the last run (0.2.0)
  • ✅ Skip-existing dedup — never regenerate or overwrite a skill (0.2.0)
  • Per-project mining (selfskill mine --project <path>)
  • Optional embedding-based clustering for very large transcript stores
  • VS Code extension wrapper

License

MIT © Abhiyan Poudel

About

Mines your past Claude Code sessions and writes the personal skills only you would need.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors