aif-distillation
Skill10 starsChanged 6 months agoMITView on GitHub
Distill books, documents, folders, or URLs into compact, practical Agent Skills. Use when source material should become either one reusable skill package or a split set of focused skills, each with a concise SKILL.md plus detailed references and examples.
2 other projects use a version of this, 2 of them edited.
Adopted by
Most recently taken up by
- letuhao/lore-weaveedited, first seen Oct 17, 2026
- lee-to/ai-factoryedited, first seen Sep 22, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- lee-to/ai-factory★ 1.2k65% same
- letuhao/lore-weave★ 3591% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository59 other files it gives its agents.
- AGENTS.mdAGENTS.md
- site-docs/AGENTS.mdAGENTS.md
- web/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- docs/CLAUDE.mdCLAUDE.md
- web/CLAUDE.mdCLAUDE.md
- aif-architectureSkill
- aif-best-practicesSkill
- aif-build-automationSkill
- aif-ciSkill
- aif-commitSkill
- aif-dockerizeSkill
- aif-docsSkill
- aif-evolveSkill
- aif-exploreSkill
- aif-fixSkill
- aif-groundedSkill
- aif-implementSkill
- aif-improveSkill
- aif-loopSkill
- aif-planSkill
- aif-qaSkill
- aif-referenceSkill
- aif-reviewSkill
- aif-roadmapSkill
- aif-rules-checkSkill
- aif-rulesSkill
- aif-security-checklistSkill
- aif-skill-generatorSkill
- aifSkill
- aif-verifySkill
- generate-claudemdSkill
- aif-architectureSkill
- aif-best-practicesSkill
- aif-build-automationSkill
- aif-ciSkill
- aif-commitSkill
- aif-distillationSkill
- aif-dockerizeSkill
- aif-docsSkill
- aif-evolveSkill
- aif-exploreSkill
- aif-fixSkill
- aif-groundedSkill
- aif-implementSkill
- aif-improveSkill
- aif-loopSkill
- aif-planSkill
- aif-qaSkill
- aif-referenceSkill
- aif-reviewSkill
- aif-roadmapSkill
- aif-rules-checkSkill
- aif-rulesSkill
- aif-security-checklistSkill
- aif-skill-generatorSkill
- aifSkill
- aif-verifySkill
- generate-claudemdSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
26 rules. About 0 are common, 11 are distinctive, and 15 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
FIRST: Read .ai-factory/config.yaml if it exists to resolve:
- Very specific: line 28
If config.yaml doesn't exist, use defaults:
- Distinctive: line 35
Treat skill-context rules as project-level overrides for this skill.
- Very specific: line 55
If the target skill name is missing, derive a concise, general, lowercase-hyphenated name from the material topic or user goal, such as …
- Distinctive: line 57
Before any write, validate the final target skill name:
- Very specific: line 62
Treat relative --path values as relative to the current working directory.
- Very specific: line 65
Default destination for single-skill mode: <output-root>/<skill-name>/, where <output-root> is .agents/skills unless --path is present.
- Very specific: line 69
Do not save distilled skills into the package skills/ directory unless the user is explicitly developing AI Factory itself.
- Very specific: line 86
Default to single-skill mode unless --split or --split-by is present.
- Distinctive: line 89
Prefer split mode when the material contains independent goals that should trigger separately, such as reviewing, planning, diagnosing, …
- Very specific: line 91
Avoid vague lifecycle or chapter names such as framework-evolution, principles, philosophy, chapter-4, mindset, or overview unless that …
- Distinctive: line 92
Do not split into tiny skills that differ only by wording.
- Very specific: line 93
Keep every generated child skill independently useful: clear frontmatter, focused workflow, and relevant references/examples.
- Very specific: line 96
Keep target SKILL.md focused on purpose, triggers, and workflow.
- Very specific: line 99
Put detailed knowledge in references/.
- Very specific: line 100
Put reusable prompts, cases, and transformed examples in examples/.
- Distinctive: line 101
If the material teaches programming with code examples, create or update an examples file with original before/after snippets or compact …
- Distinctive: line 103
Add scripts only when the workflow needs repeatable processing.
- Very specific: line 108
Use resolved language.artifacts for generated skill content unless the source material or user explicitly requires another language.
- Distinctive: line 110
Check existing content before writing.
- Distinctive: line 111
If the target skill already has matching references or examples, update them in place.
- Distinctive: line 112
Do not create near-duplicate files with different names.
- Distinctive: line 121
If source material contained meaningful code snippets or worked examples, the generated skill must include adapted examples.
- Distinctive: line 129
Read these before generating or updating a distilled skill:
- Very specific: line 134
Use examples/REQUESTS.md for invocation patterns.
- Very specific: line 139
Read-only context: .ai-factory/config.yaml, existing AI Factory context artifacts, and existing skill files except the selected target …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Distillation
Turn source material into a useful skill. The output is not a summary dump: it is an operational skill that captures the best practices, decision rules, workflows, checks, and examples from the material.
Step 0: Load Config and Skill Context
FIRST: Read .ai-factory/config.yaml if it exists to resolve:
language.uifor prompts, questions, progress updates, and final summarieslanguage.artifactsfor generated skill package content (SKILL.md,references/,examples/)language.technical_termsfor translated artifacts; default tokeepwhen absent
If config.yaml doesn't exist, use defaults:
language.ui:enlanguage.artifacts: same aslanguage.uilanguage.technical_terms:keep
Read .ai-factory/skill-context/aif-distillation/SKILL.md - MANDATORY if the file exists.
Treat skill-context rules as project-level overrides for this skill. They apply to all generated skill files, references, examples, source-map policy, and final reports.
Inputs
Accept $ARGUMENTS as one or more:
- local files
- local directories
- URLs
- optional
--name <skill-name> - optional
--path <directory>to save generated skill package directories under a custom output root instead of.agents/skills - optional
--updateto improve an existing skill instead of creating a duplicate - optional
--redact-source-mapto skip generated source-map files and sections entirely, so exact source titles, URLs, local paths, repository paths, and link reference definitions are not written to output - optional
--splitto create several focused skills from one material set - optional
--split-by <strategy>to choose the split strategy:auto(default): infer skill boundaries from user goals, triggers, workflows, source topics, and use casesgoal: split by user goals or jobs-to-be-done, regardless of domaintopic: split by major source topics or chaptersworkflow: split by recurring actions an agent performsaudience: split by distinct user roles or implementation contexts
If the target skill name is missing, derive a concise, general, lowercase-hyphenated name from the material topic or user goal, such as clean-code-style, api-design-rules, decision-making, writing-feedback, or meeting-facilitation.
Before any write, validate the final target skill name:
- It must match
^[a-z0-9]+(?:-[a-z0-9]+)*$. - Reject empty names, overlong names,
.,.., dots, path separators (/or\), absolute paths, Windows drive paths, and hidden names. - Reject reserved
aif-*names unless the user explicitly says they are developing AI Factory itself. - Resolve the output root:
--path <directory>when present, otherwise.agents/skills. - Treat relative
--pathvalues as relative to the current working directory. Create the output root if it does not exist; reject it if it resolves to an existing file. - Resolve the final destination path and confirm it is inside the resolved output root before creating or updating files.
Default destination for single-skill mode: <output-root>/<skill-name>/, where <output-root> is .agents/skills unless --path is present.
Default destination for split mode: <output-root>/<prefix>-<child-scope>/ for each generated child skill. Every split child name must share one namespace prefix to prevent collisions with existing skills. Use --name as the preferred prefix when present; otherwise derive a concise prefix from the book title or primary material title. If --redact-source-map is present and the exact source title should not be exposed, use --name as the public namespace or derive a neutral topic prefix.
Do not save distilled skills into the package skills/ directory unless the user is explicitly developing AI Factory itself.
Workflow
- Prepare sources.
- For normal text, markdown, JSON, YAML, HTML, or code files, read directly.
- For large folders or PDFs, use
.agents/skills/aif-distillation/scripts/material-prep.pyto extract and chunk material, then clean temporary extraction artifacts with the helper after the skill is generated. - For URLs, fetch the source and any critical linked pages needed to understand the topic.
- Distill, do not copy.
- Extract transferable principles, workflows, heuristics, checklists, terminology, and failure modes.
- Inventory examples from the source, especially code snippets, before deciding the output structure.
- Group source examples by topic so coverage can be checked later.
- Preserve only short source excerpts when essential. Prefer paraphrase and cite sources.
- Convert narrative advice into agent-operable instructions and source examples into original, reusable examples.
- Choose single-skill or split-skill design.
- Default to single-skill mode unless
--splitor--split-byis present. - In split mode, resolve one shared namespace prefix before writing the boundary map. Use
--namewhen present; otherwise use a normalized book/material title. Every proposed child name must start with<prefix>-. - In split mode, create a skill boundary map before writing: proposed prefixed skill name, user-facing job, trigger description, owned source topics, references/examples needed, and overlap risks.
- Prefer split mode when the material contains independent goals that should trigger separately, such as reviewing, planning, diagnosing, rewriting, teaching, deciding, testing, facilitating, auditing, or troubleshooting.
- Name split children by the user goal or job-to-be-done, not by an abstract source theme. Choose the goal taxonomy from the material's domain: for software this may be
refactoring-review,test-design, orframework-fit-review; for writing this may beargument-editorstyle-review; for operations this may beincident-triageorrunbook-review; for management this may bedecision-brieforstakeholder-analysis; for learning this may beconcept-coachorpractice-drill. - Avoid vague lifecycle or chapter names such as
framework-evolution,principles,philosophy,chapter-4,mindset, oroverviewunless that exact name is the user's requested public taxonomy. - Do not split into tiny skills that differ only by wording. Merge candidates when their triggers, workflow, and reference needs substantially overlap.
- Keep every generated child skill independently useful: clear frontmatter, focused workflow, and relevant references/examples. If
--redact-source-mapis absent, include its own source map; if present, do not createreferences/SOURCE-MAP.mdor a source-map section.
- Default to single-skill mode unless
- Design the target skill package.
- Keep target
SKILL.mdfocused on purpose, triggers, and workflow. - Make the generated skill self-explanatory from its directory name and frontmatter. The description must start with an action verb and say what the skill reviews, improves, generates, or checks.
- Near the top of every generated
SKILL.md, answer in plain language: what this skill does, when to use it, and what output it should produce. A user should not need to inspect the source material to understand why the skill exists. - Put detailed knowledge in
references/. - Put reusable prompts, cases, and transformed examples in
examples/. - If the material teaches programming with code examples, create or update an examples file with original before/after snippets or compact code patterns. Do not omit code examples only because verbatim copying is inappropriate.
- For book-scale or broad code material, cover every major code-facing topic with an adapted example, or state why a topic does not need one. Split examples into multiple files when one file would become a shallow sampler.
- Add scripts only when the workflow needs repeatable processing.
- Resolve
<output-root>from--pathor.agents/skillsbefore writing. Treat--pathas a parent directory for generated skill packages, not as the skill package name. - In single-skill mode, save the package under
<output-root>/<skill-name>/using the chosen concise name. - In split mode, save each child package directly under
<output-root>/<prefix>-<child-scope>/. Do not drop the shared prefix even when the child scope is clear on its own. - When
--redact-source-mapis present, do not createreferences/SOURCE-MAP.md, do not create a "Source Map" section in any generated file, and remove any emptySOURCE-MAP.mdaccidentally created during drafting. In--updatemode, leave an existing non-emptySOURCE-MAP.mdunchanged unless the user explicitly asks to remove or rewrite it. - Use resolved
language.artifactsfor generated skill content unless the source material or user explicitly requires another language.
- Keep target
- Check existing content before writing.
- If the target skill already has matching references or examples, update them in place.
- Do not create near-duplicate files with different names.
- Preserve useful existing material and add only missing or better distilled content.
- In split mode, also check existing sibling skills under
<output-root>for matching triggers. Update a matching skill with--updateinstead of creating a new near-duplicate child.
- Validate usefulness.
- The skill must tell an agent what to do, when to do it, what good output looks like, and what mistakes to avoid.
- The name and description must be invocation-ready. If a user would ask "what does this skill actually do?", rename it or rewrite the trigger before finishing.
- References must be dense and navigable.
- Examples must demonstrate decisions or transformations, not decorative filler.
- If source material contained meaningful code snippets or worked examples, the generated skill must include adapted examples. Missing adapted examples is a failure to fix before finishing.
- Example coverage must match source coverage: when
--redact-source-mapis absent, record this in the source map; when present, validate coverage internally without writing source-map files or sections. - Generated skills must include an artifact ownership/config policy section when they write or read project artifacts.
- Generated quality-gate skills must follow the
aif-gate-resultcontract from$aif-verifyreferences. - In split mode, every child skill must have a distinct activation trigger. If two children would activate for the same request and tell the agent to do the same work, merge them before finishing.
Required Supporting Guidance
Read these before generating or updating a distilled skill:
references/DISTILLATION-PROTOCOL.mdreferences/OUTPUT-STRUCTURE.mdreferences/LARGE-MATERIALS.md
Use examples/REQUESTS.md for invocation patterns.
Artifact Ownership
- Primary ownership: generated or updated skill packages under
<output-root>/<skill-name>/, or multiple direct child skill packages under<output-root>/<prefix>-<child-scope>/in split mode.<output-root>is.agents/skillsunless the user passes--path <directory>. - Read-only context:
.ai-factory/config.yaml, existing AI Factory context artifacts, and existing skill files except the selected target skill in update mode. - Config policy: config-aware for
language.ui,language.artifacts, andlanguage.technical_termsonly. Do not writeconfig.yaml.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

