# Skills and commands

> Building flows · https://spoletta.com/docs/skills

Skills and commands are written once in the settings and used in many flows. A skill is instructions for a kind of work, which an agent reads when its task calls for them. A command is a prompt kept under a name, which an agent's prompt names with `/`.

## Skills

Open **Settings**, pick **Skills & commands**, and press **New skill**, at the right of *Skills*, or in its box while there are none. A skill has:

| Field | What it holds |
| --- | --- |
| Name | Lowercase letters, digits and single hyphens, such as `house-style`. Each name is used once. |
| Description | Required. What it does and when it applies. The agent decides from it whether to use the skill, so say when. |
| Instructions | What the agent should know or do, which it reads once the skill applies. |

An agent is given only the skills its process picks. In the process's panel, tick them under **Skills**, below the prompt. The agent sees each one's name and description, and reads the instructions only when its task calls for them, so a skill costs little until it is used.

> **Watch out:** If a skill a process picked is deleted, or the flow may no longer use it, the process says so, and its agent fails to run until the skill is unpicked.

## Commands

Press **New command**, at the right of *Commands*, or in its box while there are none. A command has a name, the prompt it stands for, and optionally a description and its arguments, a hint such as `[file]` shown as you pick it.

In an agent's prompt, type `/` to open a menu of commands. The arrow keys move through it, `Enter` or `Tab` puts the command in, and `Esc` closes it. When the step runs, `/name` is replaced with the command's prompt.

A command whose prompt has placeholders takes the rest of its line as arguments, split at spaces, with quoted ones keeping theirs:

| Placeholder | Stands for |
| --- | --- |
| `$1`, `$2`… | The first argument, the second… |
| `$@` or `$ARGUMENTS` | All of them |
| `${1:-default}` | The first argument, or *default* if there is none |
| `${@:2}` | The arguments from the second on |

A command `review` with the prompt `Review ${1:-the change} for bugs.` turns `/review src/app.go` into *Review src/app.go for bugs.*, and a bare `/review` into *Review the change for bugs.* A command without placeholders leaves the rest of its line as it is.

-   A command is named at the start of a line or after a space. A `/word` that isn't a command the flow may use stays as written, so a path such as `/etc/hosts` is safe.
-   Only the process's own prompt is expanded, never what its inputs or a reviewer bring.

## Who sees them

With sign-in on, a skill or command belongs to someone, as a flow does. Set it under **Who sees it** in its form, or from the pill beside it in the list:

| Who sees it | What that means |
| --- | --- |
| Only me | The default. Only you see it and use it in your flows. |
| A team | The team's members see it, change it and use it in the team's flows and their own. |
| Everyone | Everyone in the project sees it, changes it and uses it in any of its flows. Only an owner of the project can take it back. |

A flow uses only what its owner may use, so nobody's own skill reaches a flow others work on:

-   a person's flow: theirs, their teams' and everyone's;
-   a team's flow: the team's and everyone's;
-   a flow everyone owns: everyone's.

The Skills picker and the `/` menu offer only those, and a run uses nothing else. Without sign-in, everything is everyone's. See [Settings and access](https://spoletta.com/docs/admin.md).

## In setup files

**Export** and **Import** on the Flows page carry skills and commands too, in sections of their own, and a process names its skills:

```yaml
skills:
  - name: house-style
    description: How we write; use for anything a customer reads.
    content: |
      Short sentences. No jargon.
commands:
  - name: review
    arguments: "[file]"
    content: Review ${1:-the change} for bugs.
flows:
  - name: Answer a ticket
    processes:
      - name: Draft
        prompt: Draft a reply to the Ticket.
        skills: [house-style]
```

Importing adds the skills and commands the app doesn't have as everyone's, and updates those it has by name, keeping their owner. See [Setup files](https://spoletta.com/docs/setup-files.md).

## With the assistant

A flow's [assistant](https://spoletta.com/docs/assistant.md) knows which skills and commands the flow may use: it can pick skills for a process and name commands in a prompt. It doesn't write new ones; that is done in the settings.
