> Selesai can create skills. Ask it to build one for your use case.

# Skills

Skills are self-contained capability packages that the agent loads on-demand. A skill provides specialized workflows, setup instructions, helper scripts, and reference documentation for specific tasks.

Selesai implements the [Agent Skills standard](https://agentskills.io/specification), warning about most violations but remaining lenient. Selesai allows skill names to differ from their parent directory even though the standard disallows it; that rule is suboptimal for shared skill directories used across multiple agent harnesses.

## Table of Contents

- [Locations](#locations)
- [How Skills Work](#how-skills-work)
- [Invoking Skills](#invoking-skills)
- [Skill Structure](#skill-structure)
- [Frontmatter](#frontmatter)
- [Validation](#validation)
- [Example](#example)
- [Skill Repositories](#skill-repositories)

## Locations

> **Security:** Skills can instruct the model to perform any action and may include executable code the model invokes. Review skill content before use.

Selesai loads skills from:

- Global:
  - `~/.selesai/agent/skills/`
  - `~/.agents/skills/`
- Project (only after the project is trusted):
  - `.selesai/skills/`
  - `.agents/skills/` in `cwd` and ancestor directories (up to git repo root, or filesystem root when not in a repo)
- Packages: `skills/` directories or `pi.skills` entries in `package.json`
- Settings: `skills` array with files or directories
- CLI: `--skill <path>` (repeatable, additive even with `--no-skills`)

Discovery rules:
- In `~/.selesai/agent/skills/` and `.selesai/skills/`, direct root `.md` files are discovered as individual skills
- In all skill locations, directories containing `SKILL.md` are discovered recursively
- In `~/.agents/skills/` and project `.agents/skills/`, root `.md` files are ignored

Disable discovery with `--no-skills` (explicit `--skill` paths still load).

### Using Skills from Other Harnesses

To use skills from Claude Code or OpenAI Codex, add their directories to settings:

```json
{
  "skills": [
    "~/.claude/skills",
    "~/.codex/skills"
  ]
}
```

For project-level Claude Code skills, add to `.selesai/settings.json`:

```json
{
  "skills": ["../.claude/skills"]
}
```

### Bundled pstack

Selesai Code ships the pstack workflow pack: 59 skills adapted from [pstack by Lauren Tan](https://github.com/cursor/plugins/tree/ca782ed8b3c2c521cead8e1720d55c3a5dbf2347/pstack) (upstream commit `ca782ed8b3c2c521cead8e1720d55c3a5dbf2347`, v0.15.48, MIT). The pack is generated by a reproducible offline importer; `src/skills/pstack/UPSTREAM.md` and `UPSTREAM-MANIFEST.json` record the pin and every checked adaptation. Invoke `$poteto-mode` with a goal and a check for success, or `$poteto-help` to choose a workflow. It is available by default, not an always-on mode. Invoking `$poteto-mode` authorizes subagents for that task; commits, pushes, PRs, and other side effects still need your explicit permission. Skills invoked on their own work inline unless you authorized delegation. `$setup-pstack` configures optional worker model overrides in `~/.selesai/agent/pstack-models.md` (confirmed `provider/id` values from `selesai --list-models`, or `auto`/`inherit-parent` to omit the override); it isn't required for inline work, and no model ids are bundled. Poteto playbooks say when to use each helper and link to its `SKILL.md`. The agent reads those files directly, even on follow-ups when discovery is closed. Every helper is also searchable with `skill_show`.

Delegation runs through the native `subagent` tool with two dedicated builtin agents: `poteto-agent` (writer delegate for one bounded assignment; reads the supplied `worker.md` and `poteto-mode` paths first) and read-only `comment-sicko` (comment review for `$no-comments`). The pack's restatement, test-first, and teaching skills use the collision-safe names `pstack-bro`, `pstack-tdd`, and `pstack-teach`; the bundled `bro` skill keeps its name. `$reframe` teaches expert terms for what you're building, with every cited link opened and checked. Cursor-only features (`/loop`, Custom Modes, cloud agents, Bugbot integration, `cursor-team-kit`, Benny automations, `/visualize`, `create-skill`) are explicitly unsupported and degrade visibly; the capability matrix lives in the pack's `docs/harness/selesai.md`. Helper scripts run through interpreters because seeded files are mode 0600: `bash worktree-audit.sh` (no fetch without `-f`; missing chat evidence is never `safe`), `bash log.sh`, `sh statechart` (mise/Java installs ask first), and the fail-closed `watch-pr` bootstrap. Startup seeding overwrites shipped paths but never removes stale pstack-owned extras; the source checkout's `scripts/pstack/reset-pack.mjs` provides explicit pack-scoped `reset`/`rollback` with verified backups, conflict refusal, and journal recovery.

## How Skills Work

1. At startup, Selesai scans skill locations and extracts names and descriptions
2. By default (`skillInvocation.mode: "auto"`) the system prompt carries one short pointer to `skill_show` and no skill names or descriptions. The pointer tells the agent to search before work that is not trivial: it calls `skill_show({ query })` with the task in plain words and loads a match with `skill_show({ name })`. Every registered skill is searchable. With a Token-In account the bundled Sai extension ranks the query by judging every skill (`saiAdvisory.routes.skillSearch`, see [settings](settings.md)). When Sai judged the skills and none fits, `skill_show` reports "No eligible skills match." rather than guessing. Only when Sai cannot rank (no Token-In credential, the route off, shadow mode, a timeout, a cancellation, a transport error, or nothing judged) are skills ranked by how many query words of three or more characters appear in their name or description, and one matching word is enough. Independently, the Sai recommendations route (on by default) suggests a relevant skill on an eligible turn even when the agent does not search. An extension ranker registered with `registerSkillRanker()` returns `undefined` (or throws) when it cannot rank; any array it returns, an empty one included, is authoritative, except a non-empty array naming only unknown skills, which falls back to the built-in ranking.
3. With `skillInvocation.mode: "explicit"` skills are user-invoked. The agent sees only the skills in `skillInvocation.alwaysAvailable`. A message opens every skill for that turn only when it contains the word `skill` (also `skills`, `skil`, `skils`) or names a skill with `$skill-name`. The agent then gets a hidden notice and can list or load skills. The next message closes them again unless it asks again.
4. If `skill_show` is unavailable (no codemode and `skill_show` excluded), the system prompt falls back to the full skill listing and the agent loads a skill with `read`
5. The agent follows the instructions, using relative paths to reference scripts and assets

This is progressive disclosure: only descriptions are in context, and full instructions load on demand.

Explicit requirements in the user's message (colors, materials, layout, copy, references) take precedence over a loaded skill's defaults, bans, and personas. Every loaded skill block carries this rule. A skill fills only the choices the user left open.

Subagents follow the turn that launched them. When the launching message opened skills, the child runs in `auto` mode, so it can find a skill the parent did not pass. Otherwise it gets only the skills named in its agent or chain `skills:` frontmatter or passed by the parent. Proactive skill-subagent suggestions in `subagent list` appear only on an open turn.

## Invoking Skills

Skills are invoked inline with `$skill-name` anywhere in a message. They are not registered as `/skill:name` slash commands — the `/` command list shows only extensions, prompt templates, and built-in commands.

```text
$brave-search                    # Load and execute the skill
$pdf-tools extract               # Load skill with arguments
```

Text after the skill token is kept as the user message, so arguments follow the skill normally.

### Inline Skill Picker

In interactive chat, type `$` anywhere in a prompt to open completion for available skills. Select a skill to insert `$skill-name`; on send, Selesai expands it at that position.

```text
Draft implementation plan, then $codebase-design the module.
```

## Skill Structure

A skill is a directory with a `SKILL.md` file. Everything else is freeform.

```
my-skill/
├── SKILL.md              # Required: frontmatter + instructions
├── scripts/              # Helper scripts
│   └── process.sh
├── references/           # Detailed docs loaded on-demand
│   └── api-reference.md
└── assets/
    └── template.json
```

### SKILL.md Format

````markdown
---
name: my-skill
description: What this skill does and when to use it. Be specific.
---

# My Skill

## Setup

Run once before first use:
```bash
cd /path/to/skill && npm install
```

## Usage

```bash
./scripts/process.sh <input>
```
````

Use relative paths from the skill directory:

```markdown
See [the reference guide](references/REFERENCE.md) for details.
```

## Frontmatter

Per the [Agent Skills specification](https://agentskills.io/specification#frontmatter-required):

| Field | Required | Description |
|-------|----------|-------------|
| `name` | Yes | Max 64 chars. Lowercase a-z, 0-9, hyphens. Unlike the standard, Selesai does not require this to match the parent directory because that standard requirement is suboptimal for shared skill directories. |
| `description` | Yes | Max 1024 chars. What the skill does and when to use it. |
| `license` | No | License name or reference to bundled file. |
| `compatibility` | No | Max 500 chars. Environment requirements. |
| `metadata` | No | Arbitrary key-value mapping. |
| `allowed-tools` | No | Space-delimited list of pre-approved tools (experimental). |

### Name Rules

- 1-64 characters
- Lowercase letters, numbers, hyphens only
- No leading/trailing hyphens
- No consecutive hyphens
Selesai does not require the name to match the parent directory. The Agent Skills standard does, but that requirement is suboptimal for shared skill directories used by multiple tools.

Valid: `pdf-processing`, `data-analysis`, `code-review`
Invalid: `PDF-Processing`, `-pdf`, `pdf--processing`

### Description Best Practices

The description determines when the agent loads the skill. Be specific.

Good:
```yaml
description: Extracts text and tables from PDF files, fills PDF forms, and merges multiple PDFs. Use when working with PDF documents.
```

Poor:
```yaml
description: Helps with PDFs.
```

## Validation

Selesai validates skills against the Agent Skills standard. Most issues produce warnings but still load the skill:

- Name exceeds 64 characters or contains invalid characters
- Name starts/ends with hyphen or has consecutive hyphens
- Description exceeds 1024 characters

Unknown frontmatter fields are ignored.

**Exception:** Skills with missing description are not loaded.

Name collisions (same name from different locations) warn and keep the first skill found.

## Example

```
brave-search/
├── SKILL.md
├── search.js
└── content.js
```

**SKILL.md:**
````markdown
---
name: brave-search
description: Web search and content extraction via Brave Search API. Use for searching documentation, facts, or any web content.
---

# Brave Search

## Setup

```bash
cd /path/to/brave-search && npm install
```

## Search

```bash
./search.js "query"              # Basic search
./search.js "query" --content    # Include page content
```

## Extract Page Content

```bash
./content.js https://example.com
```
````

## Skill Repositories

- [Anthropic Skills](https://github.com/anthropics/skills) - Document processing (docx, pdf, pptx, xlsx), web development
- [Pi Skills](https://github.com/badlogic/pi-skills) - Web search, browser automation, Google APIs, transcription
