Skills
Save a procedure once as a skill, as a guide the agent follows or as a program kcode runs.
A skill is a reusable procedure with a name. kcode has two kinds.
| Kind | What runs | Suits |
|---|---|---|
| Guide skill | The agent follows a Markdown guide with its tools. | Steps that need judgment. |
| Script skill | kcode runs a Lua program in a sandbox and checks its input and its result. | Steps that must be exact every time. |
Where skills live
| Place | Reach |
|---|---|
~/.kcode/skills/ |
Every project. |
<project>/.kcode/skills/ |
One project, once the project is trusted. |
A plugin’s skills/ folder |
Wherever the plugin loads. |
kcode loads a new or changed skill without a restart. /skills lists the loaded ones.
Running a skill
/<name> runs a skill, and the text after the name is its argument. The agent also runs a skill on its own when a task fits the skill’s description.
A guide skill
<project>/.kcode/skills/triage/SKILL.md:
---
name: triage
description: >-
Morning triage: what changed since yesterday, what fails, and
what to pick up first.
---
# Morning triage
1. Run `git log --since=yesterday --oneline` and sum up the changes.
2. Run the project's tests and list each failure with its file.
3. End with the three things to pick up first, most urgent first.
Report only: change no files.
In a guide, $ARGUMENTS stands for the text typed after the name, and $1, $2 for its words. Scripts and templates beside SKILL.md belong to the skill, and the guide tells the agent when to run them.
A script skill
A SKILL.md that names an entry file is a script skill. kcode checks the input against input_schema, runs the Lua file, and checks the result against output_schema:
---
name: next-version
description: Work out the next release version and its
changelog section from Conventional Commit subjects.
entry: run.lua
capabilities:
fs.read: [package.json, Cargo.toml]
input_schema:
type: object
required: [commits]
properties:
commits:
type: array
items: {type: string}
---
A script reaches files, hosts or other tools only through the capabilities it declares. A script skill: next version shows the whole bundle with its tests, and A guide skill: video frames shows a guide with a script beside it.
Commands
A Markdown file in ~/.kcode/commands/ or <project>/.kcode/commands/ becomes a /<name> command whose body is a prompt. A command suits a prompt typed often. A skill suits a procedure with files or code of its own.