Writing skills
A skill teaches the agent one kind of work: a folder with a SKILL.md, which holds the instructions, and any helper
files those instructions use, such as a script or a template. The agent sees a one-line index of the skills it may use.
When a task calls for a skill, the agent loads that skill's instructions, and it runs the skill's helpers from where
they are, read-only. A skill needs no code in the product, so an installation can carry, for example, a skill for each
kind of report its people ask for.
This page describes skills as the product handles them today, and what does not exist yet.
What exists today, and what does not
- Skills are folders on the server. There is no Skills page in the web app and no API to upload, import, list or delete skills; someone with access to the host puts the folders in place.
- A task sees the installation's skills and its owner's own skills, never those of the people a workspace is shared with.
- Tasks on a microVM installation (
backend = "firecracker") get no skills yet: only the Docker backend mounts them. - Managing skills in the product (a Skills page, versions, upload and download, shared skills) is a proposal (ADR-0036), not built.
A skill's folder
quarter-report/ the folder: its name is the skill's name
├── SKILL.md front matter, then the instructions
└── summarise.py a helper file (any number, in subfolders too)
SKILL.md starts with front matter of exactly two keys, name and description, between two lines of ---; the
instructions follow:
---
name: quarter-report
description: Summarise a quarter's sales CSV into totals per region and month, with a short written summary.
---
# Quarter report
1. Run the helper on the CSV the person gave ...
The checks a folder must pass, or it is left out (the reason is shown, see Checking a skill):
| Rule | Bound |
|---|---|
| The name | 1 to 64 characters: lowercase letters, digits and -; exactly the folder's name |
| The description | 1 to 280 characters on one line, no control characters. It is what the agent reads when it decides whether to use the skill, so say what the skill does and when to use it |
| The front matter | Only name and description, each once, as key: value on one line. The value is taken as written, so do not put it in quotes, and nothing else of YAML (lists, several lines) is read |
SKILL.md | At most 16 KiB, UTF-8 |
| The folder | At most 1 MiB in all, and at most 1,000 files and folders |
| Links | No symbolic link anywhere: not the folder, not SKILL.md, not any file inside |
A plain file next to the skill folders is ignored; a folder without a SKILL.md is reported as one.
How the agent uses a skill
- At the start of each run, the runtime reads the skill folders and puts an index into the agent's instructions:
one line per skill,
- <name> (<install or user>): <description>, in name order, at most 8 KiB. Only the index is in the prompt, so many skills cost little. - When it decides to use one, the agent calls the
skilltool with the skill's name. The tool answers with the skill's folder, the instructions after the front matter, and the absolute paths of its helper files (up to 100 listed, the rest counted). It checks the folder again first: a skill changed since the run started is refused for the rest of that run, and a change takes effect at the next run. - To run a helper, the agent uses the shell tool with the helper's absolute path, for example
python3 /skills/install/quarter-report/summarise.py. The skills are mounted read-only, so a helper cannot be changed and must write its output elsewhere, normally into the workspace (/workspace).
A helper runs like any other command of the agent: as the sandbox's user, with the programs the task's environment has (a Python helper needs an environment with Python, such as Workstation), and with only the internet access the installation allows. Do not put keys or passwords in a skill: the agent can read every file of it.
Where skills come from
| Tier | Folder on the host | In the sandbox | Who sees it |
|---|---|---|---|
The installation's (install) | the folder [skills] root names in gateway.toml | /skills/install/<name> | Every task |
A person's own (user) | skills/users/<the person's id>/ under the storage root, created empty on first use | /skills/user/<name> | That person's tasks only |
When both tiers have a skill of the same name, the person's own is used and the installation's is reported as
shadowed. A run takes at most 64 skills, by name order; the rest are reported as over the limit. A person's id is the
id that GET /api/v1/auth/me answers.
Set up the installation's folder
The installation's folder is optional and is set up once, by an administrator on the host: [skills] root in
gateway.toml, the same path in TQA_SKILLS_ROOT in compose.env, and the skills overlay
(-f deploy/compose/skills.yml) added to every Compose command. The folder must be readable by the container account
1000, and must not be, contain or sit inside the installation's directory or the storage root. The install guide's
Skills section has each step and the command that sets the owner on a rootless
daemon.
Which skills a task is offered
An agent profile chooses under Skills offered:
All skills, No skills, or Only these skills with their names. A profile whose tools leave out Use skills
(the skill tool) offers no skills at all, since there would be no way to load one. A task without a profile is
offered every skill it can see.
Checking a skill
After a run, the task's Context tab (next to Files and Changes) lists the skills the agent could use, each with its description, marked For everyone (the installation's) or Yours, and under Not loaded the folders that were left out. An administrator also sees each one's reason (See what the agent loaded). The reasons:
| Code | Why the folder was left out |
|---|---|
missing_manifest | No SKILL.md in the folder |
bad_front_matter | The front matter is not exactly name and description between two --- lines, or the description is empty, too long or has a control character |
name_mismatch | The name is not valid, or not the folder's name |
too_large | SKILL.md over 16 KiB, or the folder over 1 MiB or 1,000 entries |
symlink | The folder or something in it is a symbolic link |
not_utf8 | SKILL.md is not UTF-8 |
shadowed | A skill of the same name in the person's own tier is used instead |
over_limit | More than 64 skills; this one was past the limit |
A worked example
Not yet run on a real install. This skill is written from the rules above and has not been used by an agent on an installation yet. Its helper was run on a sample CSV outside the product.
A skill that turns a sales CSV (columns date, region and amount) into totals per region and month. Its folder,
quarter-report/, holds two files.
quarter-report/SKILL.md:
---
name: quarter-report
description: Turn a sales CSV with date, region and amount columns into totals per region and month, and a short summary.
---
# Quarter report
Use this when the person asks for a quarter's or a period's sales totals from a CSV file.
1. Find the CSV in the workspace (often in `uploads/`). Check that it has the columns `date` (YYYY-MM-DD), `region`
and `amount`; if a column is missing or named differently, ask before going on.
2. Run the helper with the CSV and an output path in the workspace:
`python3 <this skill's folder>/summarise.py <the CSV> report/totals.csv`
It writes the totals per region and month and prints the grand total and the rows it could not read.
3. Read `report/totals.csv` and write `report/summary.md`: the grand total, the largest and smallest region, and the
month-on-month change per region, in plain sentences. Name the rows the helper could not read, if any.
4. Answer with the two files' paths and the grand total.
quarter-report/summarise.py:
"""Totals per region and month from a sales CSV (date, region, amount). Usage: summarise.py <input.csv> <output.csv>"""
import csv
import sys
from collections import defaultdict
from pathlib import Path
source, target = Path(sys.argv[1]), Path(sys.argv[2])
totals = defaultdict(float)
skipped = []
with source.open(newline="", encoding="utf-8") as handle:
for number, row in enumerate(csv.DictReader(handle), start=2):
try:
amount = float(row["amount"])
region, month = row["region"].strip(), row["date"].strip()[:7]
except (AttributeError, KeyError, TypeError, ValueError):
skipped.append(number)
continue
if not region or len(month) != 7 or month[4] != "-" or not (month[:4] + month[5:]).isdigit():
skipped.append(number)
continue
totals[(region, month)] += amount
target.parent.mkdir(parents=True, exist_ok=True)
with target.open("w", newline="", encoding="utf-8") as handle:
writer = csv.writer(handle)
writer.writerow(["region", "month", "total"])
for (region, month), total in sorted(totals.items()):
writer.writerow([region, month, f"{total:.2f}"])
print(f"grand total: {sum(totals.values()):.2f}")
print(f"rows not read: {', '.join(map(str, skipped)) if skipped else 'none'}")
To offer it to every task on a Docker installation, copy the folder into the installation's skills folder on the host and make account 1000 its owner, as Skills shows. The next run of any task lists it in its index; check it in the task's Context tab. To try it as one person first, put it in that person's own folder instead.