Quick Start
Prerequisites
- Node.js >= 18
Installation
Basic usage: plain skill
Create a skill file at ./skills/my-tool/SKILL.md:
---
name: my_tool
description: A demonstration skill
---
This skill provides guidance on using the my_tool tool suite.
Then load it programmatically:
import { SkillRegistry, SkillRegistryConfiguration, LoadSkillTool } from '@johannes.latzel/llm-chat-skill';
const config = new SkillRegistryConfiguration('./skills');
const registry = new SkillRegistry(config);
await registry.initialize();
const tool = new LoadSkillTool(registry);
const [result] = await tool.execute({ name: 'my_tool' });
console.log(result.result);
// "This skill provides guidance on using the my_tool tool suite."
Structured skill
A structured skill breaks its body into separate sections managed via the resource tools. Create one via set_skill by omitting the body:
import { SkillRegistry, SkillToolPackage, SetSkillTool, SetSkillResourceTool, LoadSkillTool } from '@johannes.latzel/llm-chat-skill';
const registry = new SkillRegistry();
await registry.initialize();
// Create a structured shell (no body)
const setTool = new SetSkillTool(registry);
await setTool.execute({
name: 'code_review',
description: 'Guidelines for conducting a thorough code review'
});
// Add sections
const resourceTool = new SetSkillResourceTool(registry);
await resourceTool.execute({
skill_name: 'code_review',
resourceType: 'sections',
name: 'purpose.md',
content: 'Ensure code quality.'
});
await resourceTool.execute({
skill_name: 'code_review',
resourceType: 'sections',
name: 'workflow.md',
content: '1. No debug logs\n2. Handle errors'
});
// Load it: body is auto-composed from sections
const loadTool = new LoadSkillTool(registry);
const [result] = await loadTool.execute({ name: 'code_review' });
console.log(result.result);
// "# Purpose\nEnsure code quality.\n\n# Workflow\n1. No debug logs\n2. Handle errors\n\n--- Resources ---\n\nsections/purpose.md\nsections/workflow.md"
Tutorial
The SkillToolPackage provides a tutorial via tutorial() that explains how to use the skill system tools:
import { SkillRegistry, SkillToolPackage } from '@johannes.latzel/llm-chat-skill';
const registry = new SkillRegistry();
const pkg = new SkillToolPackage(registry);
console.log(pkg.tutorial()); // Full guide content
Using the SkillToolPackage
For integration with a ChatService from @johannes.latzel/llm-chat, use the SkillToolPackage to register all eight tools at once:
import { SkillRegistry, SkillToolPackage } from '@johannes.latzel/llm-chat-skill';
const registry = new SkillRegistry(config);
await registry.initialize(service); // loads skills + wires "skills" prompt
service.tools().add(new SkillToolPackage(registry)); // registers all 8 tools
Passing a ChatService to initialize() wires the skill listing into the system prompt. See Auto-wiring into the system prompt for details.
Reading reference files
When a skill has reference documents:
import { GetSkillResourceTool } from '@johannes.latzel/llm-chat-skill';
const readTool = new GetSkillResourceTool(registry);
const guide = await readTool.execute({ skill_name: 'my_tool', resourceType: 'references', name: 'guide.md' });
See also
- Overview: package introduction
- Tools: the eight skill tools
- Skill file format: plain vs structured skills