Skip to main content

Overview

LuaSkill is the main class for defining a skill - a collection of related tools that your AI agent can use.

Constructor

new LuaSkill(config)

Creates a new skill instance.
LuaSkillConfig
required
Skill configuration object

Configuration Parameters

string
default:"unnamed-skill"
Unique identifier for the skillFormat: lowercase, alphanumeric, hyphens onlyExamples: "weather-skill", "product-catalog-skill"
string
required
Brief description (1-2 sentences) of what the skill doesThis appears in skill listings and helps users understand the skill’s purpose.
string | { base?: string; voice?: string; text?: string }
required
Detailed instructions for the AI on when and how to use the tools.String form (recommended):
  • Critical for proper tool selection
  • Write it like instructions to a smart assistant
Object form (channel-aware): Only use when you need different instructions per channel.
  • base — Always rendered, on every channel
  • voice — Appended to base on voice channels, ignored on text
  • text — Appended to base on text channels (web, WhatsApp, SMS), ignored on voice
See Channel-aware Prompts for details.
LuaTool[]
Array of tool instances to include in the skillCan be empty initially and tools added later with addTool() or addTools().
function
Optional gate for the whole skill. Return true to expose it, false to hide it.When it returns false the skill disappears completely: its tools can’t be called and its name, its context, and its tool names are left out of the agent’s prompt. The agent doesn’t know the capability exists.See Conditional Skills.

Conditional Skills

Use condition when a whole capability should be invisible to some users — tiering, entitlements, per-customer features.
A customer who isn’t enrolled talks to an agent that has never heard of a loyalty programme. There is no check_points tool to refuse, and no loyalty context to leak. How it behaves:
  • Evaluated on every message, for the current user. Results are not cached between turns, so the gate always reflects current state.
  • Runs like your tool code. Has access to all Platform APIs (User, Data, Lua, Products, etc.).
  • Absent condition means always on. Existing skills are unaffected.
  • Skill-level short-circuits tool-level. If the skill is hidden, its tools’ own condition functions never run.
If you author a skill as a LuaSkill subclass rather than a config object, declare condition as a class field or method — the semantics are identical.
Fail-closed behavior: If your condition function throws an error or times out (30s), the skill is hidden. Design for that — a flaky third-party call inside a condition will hide the capability from users who should have it. Prefer a flag you already store on the user record over a live external lookup on every message.

Skill condition vs tool condition

Both gates take the same shape. They differ in what the agent still knows about. Gate individual tools with LuaTool.condition when the rest of the skill still applies — for example, hiding cancel_order while track_order stays available.

Methods

addTool()

Adds a single tool to the skill.
LuaTool
required
Tool instance to add
Example:
Validation:
  • Tool name must be unique within the skill
  • Tool name must only contain: a-z, A-Z, 0-9, -, _
  • Throws error if validation fails

addTools()

Adds multiple tools to the skill at once.
LuaTool[]
required
Array of tool instances to add
Example:
Validation:
  • All tools validated before adding
  • Atomic operation (all or nothing)
  • Throws error if any validation fails

Examples

Basic Skill

Weather Skill

E-commerce Skill

Adding Tools Dynamically

Writing Good Context

The context field is critical for AI tool selection. Follow these guidelines:

Structure

Good Context Example

Poor Context Example

Best Practices

The context field should include:
  • Overview of skill purpose
  • When to use each tool
  • Important guidelines
  • Edge cases to handle
Think of it as training documentation for the AI.

Multi-Skill Projects

You can define multiple skills in one project:
Each skill gets its own skillId in lua.skill.yaml and can be deployed independently.

Type Definitions

Next Steps

LuaTool Interface

Learn how to implement tools

Build Your First Skill

Follow a complete tutorial

Template Guide

Explore the example project

Skills & Tools Concept

Understand the architecture