diff --git a/CHANGELOG.md b/CHANGELOG.md index 27b12204..f7a8e526 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog ## [Unreleased] +### Added + +- **`create-skill` CLI command**: Generate standalone skill packages with embedded LanceDB databases. Supports tool selection, custom preamble/description, and optional config embedding. Generated packages register as `haiku.skills` entry points. +- **`haiku.rag.skill_generator`**: Programmatic API for skill generation (`generate_skill()`, `render_templates()`) +- **`haiku.rag.skills._tools`**: Reusable tool implementations and `create_skill_tools()` factory shared by built-in and generated skills +- **Jinja2 dependency**: Added for skill template rendering + ## [0.35.0] - 2026-03-24 ### Added diff --git a/docs/cli.md b/docs/cli.md index 38f0f390..7918eee2 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -247,6 +247,64 @@ Flags: See [RLM Agent](agents/rlm.md) for details on capabilities and configuration. +## Create Skill + +Generate a standalone skill package with an embedded database: + +```bash +haiku-rag create-skill --name myskill --db /path/to/database.lancedb +``` + +The generated package is a pip-installable Python package that registers as a `haiku.skills` entry point. + +### Options + +| Flag | Description | Default | +|------|-------------|---------| +| `--name` | Skill name (lowercase Python identifier, required) | — | +| `--db` | Path to LanceDB database to embed (required) | — | +| `--description` | Skill description | Standard RAG description | +| `--tools` | Comma-separated tool names, or `all` | `all` | +| `--preamble` | Custom preamble for skill instructions | Standard RAG preamble | +| `--config-file` | Path to `haiku.rag.yaml` to embed | None | +| `--output` / `-o` | Output directory | Current directory | + +### Available Tools + +`analyze`, `ask`, `get_document`, `list_documents`, `research`, `search` + +### Example + +```bash +# Generate a skill with specific tools and custom preamble +haiku-rag create-skill \ + --name medic \ + --db /path/to/medic.lancedb \ + --tools search,ask \ + --config-file /path/to/haiku.rag.yaml \ + --description "Military medic knowledge base" \ + --preamble "You are a military medic expert." + +# Install the generated package +uv pip install -e ./medic-skill + +# Use with haiku-skills +haiku-skills chat --use-entrypoints --skill medic +``` + +### Generated Package Structure + +``` +{name}-skill/ +├── pyproject.toml +└── {name}_skill/ + ├── __init__.py # create_skill() entry point + ├── SKILL.md # Skill metadata and instructions + └── assets/ + ├── {name}.lancedb/ # Embedded database + └── haiku.rag.yaml # Optional config +``` + ## Server Start services (requires at least one flag): diff --git a/docs/skills/index.md b/docs/skills/index.md index f43210b1..ffed1e87 100644 --- a/docs/skills/index.md +++ b/docs/skills/index.md @@ -39,6 +39,32 @@ agent = Agent( result = await agent.run("What documents do we have?") ``` +## Generating Custom Skills + +Use `create-skill` to generate a standalone skill package with an embedded database: + +```bash +haiku-rag create-skill \ + --name recipes \ + --db /path/to/recipes.lancedb \ + --tools search,ask \ + --description "Recipe knowledge base" \ + --preamble "You are a recipe expert." +``` + +This generates a pip-installable package (`recipes-skill/`) that bundles the database and registers as a `haiku.skills` entry point. After installing (`uv pip install -e ./recipes-skill`), the skill is automatically discovered: + +```bash +haiku-skills list --use-entrypoints +# recipes — Recipe knowledge base + +haiku-skills chat --use-entrypoints --skill recipes +``` + +Since each generated skill is self-contained with its own database and instructions, you can generate multiple skills for different domains and run them together. The agent sees each skill's description and routes questions to the appropriate knowledge base automatically. + +See [CLI: Create Skill](../cli.md#create-skill) for all options. + ## Database Path Resolution Both skills resolve the database path in the same order: