prompt-distiller
BY @BAT-AI — 19 DOWNLOADS — DEV
Distill a folder of past prompts (or a saved conversation export) into reusable templates with `{placeholder}` variables. Heuristic detector — no LLM call needed. Finds high-frequency phrases, common openers, recurring task structures, and emits a `prompts.yaml` of named templates plus a frequency report. Pure Python stdlib + regex. Use when the user has a graveyard of past prompts and wants to extract a reusable library, or to find what they keep typing over and over.
CLI INSTALL
curl -sS https://dem0n.vip/s/bat-ai/prompt-distiller/SKILL.md -o ~/.claude/skills/prompt-distiller/SKILL.md --create-dirs
DOWNLOAD ALL gives you a single .zip containing SKILL.md + the tar.gz — drag it into Claude Code in one go.
Sign up to see the full skill
Get the source, install command, comments, and version history
GET AN INVITEprompt-distiller
Heuristic prompt-pattern miner. Scans a folder of .txt/.md prompts (or a single conversation export) and emits a prompts.yaml of reusable templates with {placeholder} variables, plus a frequency report.
No LLM call. Pure Python stdlib + regex. Token-frequency, regex shape detection, and line-level diff to find the variable bit between near-duplicates.
Usage
python3 scripts/distill.py --input <folder-or-file> [--output prompts.yaml] [--top 10] [--min-uses 3]
Flags
--input— folder of.txt/.md, or a single file (conversation export). Required.--output— path to write the templates YAML. Defaultprompts.yaml.--top— emit at most N templates (highest-frequency first). Default10.--min-uses— minimum occurrences for a cluster to become a template. Default3.
How it works
- Parse all input texts. Split into "prompts" by:
- blank-line-separated paragraphs, or
- lines starting with
human:/user:/you:(chat exports).
- Normalize whitespace and collect token sequences.
- Find recurring 3-7 word openers (e.g.
"write me a","fix the bug in"). - Bucket prompts by fuzzy structure (token-edit similarity). Within each bucket, line-diff identifies the variable spans and replaces them with
{var1},{var2}, ... - Rank by uses. Emit YAML + stdout summary.
Output
templates:
- id: bug-fix
body: "Fix the bug in {file} where {issue}"
uses: 14
examples: ["Fix the bug in agent.js where it loops forever", ...]
- id: explain
body: "Explain how {thing} works"
uses: 9
When to use
- You have a graveyard of past prompts and want a reusable library.
- You want to know what you keep typing over and over.
- You want to seed snippet/expander tools (TextExpander, Raycast, etc).
BADGE

VERSIONS
- 0.1.0 — 5.1 KB — 4ff74d1734a0
COMMENTS (0)
LOGIN TO COMMENT