Skip to content

Distilling Skills from Conversations — Turning Good Answers into Reusable Units

Make "that was a good answer" reproducible with one button — while avoiding the fixation trap

About This Document

Conversations that arrive at a good answer are usually discarded. Every time the same kind of task comes back, the same trial and error repeats: prompt → correction → re-correction. This page covers the design of compressing a successful conversation trace (trajectory) into a reusable unit — a Skill, a prompt template, or code.

While the Skill Design Guide and the Skill Creation Guide cover how humans write Skills, this page covers the reverse path: generating Skills from conversations.

Audience: Developers and teams who want to turn insights gained from agent interactions into assets. What are Skills is assumed as background.

Positioning of This Page

The "distillation" discussed here is Trajectory Distillation at runtime (agent layer) — distinct from Knowledge Distillation at training time (see "Untangling the Word 'Distillation'" below).

Meta Information
  • What this page fixes: The three elements extracted from a successful conversation (arguments, constraints, expected output) and the criteria for promoting them to a Skill
  • Out of scope: Distillation that changes model weights (Knowledge Distillation / Context Distillation), and how to write Skills per se (→ Skill Creation Guide)
  • Depends on: What are Skills, Memory and Knowledge
  • Common misuse: Mistaking this for "saving conversation logs as-is." The essence of distillation is throwing things away

Untangling the Word "Distillation"

"Distillation" means different things in different contexts. Distinguish these three commonly confused kinds first.

KindWhat is compressed into whatWhenLayer
Knowledge DistillationLarge model's output distribution → small model's weightsTraining timeInside the LLM
Context DistillationPrompt instructions → model weightsTraining timeInside the LLM
Trajectory DistillationConversation trace → reusable Skill / template / codeRuntimeAgent layer

NOTE

The first two are training techniques that modify model weights, closer to the territory of the sister site understanding-llm. This page covers only the third — an approach that never touches weights and produces assets re-injectable as context. No fine-tuning required, and the artifacts can be shared, version-controlled, and reviewed by a team, which makes this a good fit for agent operations.

The Problem — Good Answers Are Thrown Away

A typical conversation proceeds like this.

What is lost here is not the answer itself. It is the delta — what the initial prompt was missing. Corrections #1 and #2 are constraints that will very likely be needed again for the same kind of task, yet they vanish with the session.

IMPORTANT

A conversation trace exposes "implicit requirements specific to this user, this team, this task type." Distillation means codifying those implicit requirements as explicit constraints. This differs in purpose from saving conversation logs (Memory) — Memory records "what happened," distillation records "what to do next time."

The Mechanism — From Button to Skill

As a user experience, this takes the form of "place a button at the origin of the conversation that produced a good answer (the initial prompt); pressing it triggers distillation."

There is a reason the button belongs on the initial prompt. The initial prompt corresponds to a function signature (intent + seed of arguments), and the subsequent exchanges are effectively debugging. Saving only the approved final answer loses the context of the corrections that led there, reducing reproducibility.

Inside the Distillation Process

Distillation asks the LLM itself to perform this three-way separation.

Extraction targetSource dataWhere it goes in the Skill
Arguments (Inputs)The parts of the initial prompt that "will vary in the next task"Inputs section
ConstraintsGeneralizations of the mid-conversation correctionsConstraints (MUST / SHOULD)
Expected output (Outputs)Structure and format of the approved answerOutputs + Examples

The generated SKILL.md follows the required sections of the Skill Design Guide. Distillation only differs in how the input is produced — the quality bar is identical to human-written Skills.

Compress the Delta, Not the Conversation

The most important principle of distillation: do not summarize all three rounds of the conversation.

Two reasons:

  1. Context Rot mitigation — the distilled artifact will be re-injected into future sessions. A long Skill that includes the whole history pollutes the context by itself. Shorter Skills are stronger
  2. Generalizability — "that time we rephrased it this way" is a one-off anecdote and cannot be reused, but generalized constraints like "output as a table" or "keep technical terms in English" can

TIP

Developer analogy: summarizing the whole conversation is like "squashing the entire commit history and pasting it into the README." Extracting the delta is like "converting review comments into lint rules." Only the latter becomes an asset.

Three Output Targets — A Spectrum of Reproducibility

There is more than one place to land the distilled result. Choose among three levels depending on the nature of the task.

Output targetReproducibilitySuited forExamples
Code (true "functionization")DeterministicFully mechanizable procedures (transform, aggregate, format)Voyager's Skill Library, saving scripts the agent wrote
Skill / prompt templateHigh but probabilisticRoutine tasks that involve judgmentAgent Skills (SKILL.md), DSPy Signatures
Semantic Cache (recommendation)Re-presents past answersFAQ-style repeated questionsGPTCache, embedding search over past Q&A

IMPORTANT

When in doubt, aim for the top (code). The fewer places a probabilistic LLM judgment is involved, the higher the reproducibility. Gradual codification also works: "carve out the judgment-free parts of a Skill's procedure into a script." This principle belongs to the same lineage as Semantic Layer — delegating interpretation of meaning from LLM guesswork to deterministic definitions.

The Single-Sample Problem — No Promotion Without Evaluation

"The button was pressed = it is good" is only one sample. Freezing an answer that merely happened to be good will reproduce biased behavior in later sessions.

  • A distilled Skill SHOULD be tried on multiple similar tasks and its pass rate confirmed before registration
  • Pass criteria SHOULD be codified as the Skill's Decision Criteria (e.g., matches the expected output structure in at least 4 of 5 runs)
  • Distilled artifacts that fail evaluation MUST NOT be auto-registered

Research treats this as a central issue as well. ACE (Agentic Context Engineering) separates three roles — Generator / Reflector / Curator — where the Reflector judges what deserves to be kept based on execution feedback before the Curator applies delta updates. The common pattern is: never perform distillation (generation), evaluation (judgment), and registration (update) in a single step.

WARNING

The other trap is context collapse — repeatedly "re-summarizing" the distilled artifact erodes detail with every iteration. This is why ACE adopts delta updates instead of wholesale rewriting. Skill updates should likewise be additions or modifications of constraints, not full rewrites.

Mapping to Existing Implementations and Research

This design was rapidly systematized across research and products in 2025–2026.

Implementation / researchApproachCorrespondence to this page
Voyager (2023)Accumulates successful behaviors as executable code in a Skill LibraryPrototype of "turn into code"
ACE (2025)Evolves context via Generator / Reflector / Curator with delta updatesSeparation of distill / evaluate / register; delta updates
Trace2Skill (2026)Distills trajectory-local lessons into transferable SkillsResearch version of "extract the delta"
Skill-SD (2026)Summarizes completed trajectories into compact natural-language skills as a self-teaching signalAutomation of trajectory → Skill
SoK: Agentic Skills (2026)Systematization of skill-distillation approaches (human demos, the agent's own successes, etc.)Academic backing for this page
Claude Code /rememberPromotes conversation content into memory filesAdjacent feature on the Memory side
skill-creator (Anthropic)Creates, improves, and runs evals on SkillsImplementation example of evaluation
GPTCacheRe-presents past answers via embedding searchImplementation example of Semantic Cache

Anti-Patterns

Anti-patternWhat happensCountermeasure
Saving the whole conversation logContext Rot; re-injection cost exceeds re-derivation costExtract only the delta, discard the history
Auto-registration from one sampleAn accidental success gets frozen, reproducing biasMake the evaluation gate mandatory
Unseparated argumentsLast time's specifics (dates, project names) get baked in and misfire on other tasksExplicitly ask "what varies next time" during distillation
Re-distilling distilled artifactsContext collapse — detail erodes with repeated summarizationUpdate via deltas (add/modify constraints)
Unbounded Skill proliferationSimilar Skills pile up and discoverability dropsConsider merging with existing Skills before registration (→ Anti-Patterns)

Division of Labor with Memory

Distillation is easily confused with Memory. The criterion is: "will the same procedure be followed next time?"

MemorySkill distillation
What is keptFacts, state, relationships (what happened)Procedures, constraints, output formats (what to do next time)
How it is recalledInjected when relevantTriggered by task type
Update frequencyMay be appended every conversationOnly after passing evaluation
Example"This project uses Angular 20""Release notes are always generated with this procedure and format"

Facts go to Memory; successes that could be turned into procedures go to Skills. Many conversations touch both — promote them separately.

🔗 Going Deeper: Why Keep Only the Delta

This page covered the structure (What/How) of distilling Skills from conversations. To understand from the LLM's structural constraints why you should keep only the delta rather than the whole conversation, see the sister site.

References

  • Zhang, Q. et al. (2025). "Agentic Context Engineering: Evolving Contexts for Self-Improving Language Models." arXiv. arxiv.org/abs/2510.04618 — Generator / Reflector / Curator separation and delta updates; identifies brevity bias and context collapse
  • Wang, G. et al. (2023). "Voyager: An Open-Ended Embodied Agent with Large Language Models." arXiv. arxiv.org/abs/2305.16291 — prototype of a Skill Library accumulating successful behaviors as executable code
  • "SoK: Agentic Skills — Beyond Tool Use in LLM Agents" (2026). arXiv. arxiv.org/abs/2602.20867 — systematization of skill-distillation approaches
  • "Trace2Skill: Distill Trajectory-Local Lessons into Transferable Agent Skills" (2026). arXiv. arxiv.org/abs/2603.25158 — distilling trajectory-local lessons into transferable Skills
  • "Skill-SD: Skill-Conditioned Self-Distillation for Multi-turn LLM Agents" (2026). arXiv. arxiv.org/abs/2604.10674 — self-distillation using summaries of completed trajectories as a teacher signal
  • Bang, F. (2023). "GPTCache: An Open-Source Semantic Cache for LLM Applications." NLP-OSS @ EMNLP. github.com/zilliztech/GPTCache — Semantic Cache implementation via embedding search
  • Anthropic (2025). "Equipping agents for the real world with Agent Skills." Anthropic Engineering. anthropic.com/engineering — design philosophy of Agent Skills
  • Snell, C. et al. (2022). "Learning by Distilling Context." arXiv. arxiv.org/abs/2209.15189 — Context Distillation (referenced to distinguish it from the distillation in this page)

Next: Skill Usage GuidePrevious: Skill Creation Guide

Last updated: July 2026

Released under the MIT License.