@skill-kit/distill
v1.0.0
Published
Distill AI agent conversations into reusable Skills - Part of Skill Kit
Downloads
3
Maintainers
Readme
@skill-kit/distill
Distill AI agent conversations into reusable Skills. Part of the Skill Kit ecosystem.
Installation
# Using npm
npm install @skill-kit/distill
# Using pnpm
pnpm add @skill-kit/distill
# Using yarn
yarn add @skill-kit/distillQuick Start
CLI Usage
# Distill the most recent session
skill-distill distill --last
# Distill a specific session
skill-distill distill --session ses_abc123
# Add custom prompts
skill-distill distill --last --prompt "Focus on error handling"
# List available sessions
skill-distill list
# Show session details
skill-distill show ses_abc123Programmatic Usage
import { ClaudeSessionLoader, Distiller, SkillGenerator } from '@skill-kit/distill';
// Load a session
const loader = new ClaudeSessionLoader();
const session = await loader.getLatestSession();
// Distill into a skill
const distiller = new Distiller();
const result = await distiller.distill(session, {
userPrompts: ['Focus on error handling'],
verbose: true,
});
// Generate SKILL.md
const generator = new SkillGenerator();
const generated = await generator.generate(result.skill, {
outputDir: './skills',
});
console.log(`Generated: ${generated.skillPath}`);Features
- Session Loading: Read conversation history from Claude Code, Codex CLI, or Cursor
- Smart Filtering: Automatically filter out failed attempts and trial-and-error
- LLM Analysis: Use Claude to extract intent, steps, and parameters
- Template Generation: Generate standard SKILL.md files
- Validation: Validate generated skills against best practices
API Reference
Session Loaders
import { ClaudeSessionLoader, createSessionLoader } from '@skill-kit/distill';
// Create a loader for a specific platform
const loader = createSessionLoader('claude');
// List available sessions
const sessions = await loader.listSessions();
// Get a specific session
const session = await loader.getSession('ses_abc123');
// Get the most recent session
const latest = await loader.getLatestSession();Distiller
import { Distiller } from '@skill-kit/distill';
const distiller = new Distiller();
const result = await distiller.distill(session, {
userPrompts: ['Focus on security'], // Additional guidance
skipFailedFilter: false, // Filter failed attempts
verbose: true, // Show progress
});
// Result contains:
// - result.skill: The distilled Skill object
// - result.metadata.sessionId: Source session ID
// - result.metadata.tokenUsage: API token usage
// - result.metadata.stepsFiltered: Number of filtered stepsSkill Generator
import { SkillGenerator } from '@skill-kit/distill';
const generator = new SkillGenerator();
const result = await generator.generate(skill, {
outputDir: './skills',
overwrite: false,
includeReferences: true,
includeExamples: false,
});
// Result contains:
// - result.skillPath: Path to generated SKILL.md
// - result.files: All generated files
// - result.validation: Validation resultsConfiguration
Set your Anthropic API key:
export ANTHROPIC_API_KEY=sk-ant-xxxSupported Platforms
| Platform | Status | |----------|--------| | Claude Code | Supported | | Codex CLI | Planned | | Cursor | Planned |
License
MIT
