graduation-capAI Skills

Skills are reusable markdown instruction files that can be injected into agent context automatically or loaded on demand.

circle-info

Since BoxLang AI v3.0+

Skills are reusable markdown instruction files that give agents specialized knowledge and behavior. Each skill is a focused unit of expertise — like "SQL Optimization", "BoxLang Expert", or "Code Reviewer".

🎓 What are Skills?

A skill is a markdown file (named SKILL.md) containing instructions, examples, and domain knowledge. Skills follow the Agent Skills open standard — each skill lives in its own named subdirectory under .ai/skills/.

.ai/skills/
  sql-optimizer/
    SKILL.md
  coding/
    boxlang-expert/
      SKILL.md
    code-reviewer/
      SKILL.md

Skill File Format

Each SKILL.md uses optional YAML frontmatter followed by markdown content:

---
name: SQL Optimizer
description: >
  Expert at writing and optimizing SQL queries for performance.
  Use this skill when working with database queries, indexes,
  or query performance.
---

# SQL Optimization Expert

You are an expert SQL query optimizer. When writing or reviewing queries:

1. Always consider index usage — prefer index-covered queries
2. Avoid `SELECT *` — specify only required columns
3. Use `EXPLAIN` to analyze query plans
4. Prefer JOINs over subqueries where possible
5. Use CTEs (WITH clauses) for complex multi-step logic

## Common Patterns

**Pagination:**
Use keyset pagination instead of OFFSET for large tables:
```sql
SELECT * FROM orders WHERE id > :lastId ORDER BY id LIMIT 20

Lazy-Loaded Skills (availableSkills)

Available skills form a pool that the agent can load on demand via a built-in loadSkill() tool. The agent is shown skill names and descriptions and decides which are relevant to each query. This avoids inflating the context window with unneeded instructions.

When a user asks about SQL optimization, the agent finds the sql-optimizer skill and calls loadSkill("sql-optimizer") before answering.

Combining Both

Using the aiSkill() BIF

See aiSkill() Reference for full parameter documentation.

Global Skills

Global skills are automatically injected into every agent's system context — even agents that don't explicitly declare any skills. Configure them in module settings:

Use aiGlobalSkills() to inspect the current global pool at runtime:

Fluent API

Last updated