@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
294 lines (216 loc) • 12.4 kB
Markdown
> senpi 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.
Senpi implements the [Agent Skills standard](https://agentskills.io/specification), warning about most violations but remaining lenient. Senpi 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)
- [Skill Commands](#skill-commands)
- [Skill Structure](#skill-structure)
- [Frontmatter](#frontmatter)
- [Carrying MCP Servers](#carrying-mcp-servers)
- [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.
Senpi loads skills from:
- Global:
- `~/.senpi/agent/skills/`
- `~/.agents/skills/`
- Project (only after the project is trusted):
- `.senpi/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 `~/.senpi/agent/skills/` and `.senpi/skills/`, direct root `.md` files are discovered as individual skills when they have valid skill frontmatter with a non-empty `description`
- In all skill locations, directories containing `SKILL.md` are discovered recursively
- In `~/.agents/skills/` and project `.agents/skills/`, root `.md` files are ignored, but nested `.md` files in grouping folders are discovered when they declare skill frontmatter
- Root Markdown files other than `SKILL.md` that do not look like skills are ignored silently
- `.gitignore`, `.ignore` and `.fdignore` files inside a skill location hide the folders and files they list. A symlinked entry is not hidden by the ignore files above it: it belongs to another tree, so a skill linked in from its own repository loads even when the location's `.gitignore` lists the link. The linked tree's own ignore files still apply inside it. To keep git ignoring a link, list it in `.git/info/exclude`; to stop loading a linked skill on purpose, exclude it with the settings `skills` array (`!pattern` or `-path`, see [Settings](settings.md))
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 `.senpi/settings.json`:
```json
{
"skills": ["../.claude/skills"]
}
```
## How Skills Work
1. At startup, senpi scans skill locations and extracts names and descriptions
2. The system prompt includes available skills in XML format per the [specification](https://agentskills.io/integrate-skills)
3. When a task matches, the agent uses `read`, or `bash` when `read` is unavailable, to load the full SKILL.md (models don't always do this; use prompting or `/skill:name` to force it)
4. The agent follows the instructions, using relative paths to reference scripts and assets
This is progressive disclosure: only descriptions are always in context, full instructions load on-demand.
## Skill Invocation
Skills register as `/skill:name` commands and also participate in the prompt-leading `$` picker:
```bash
/skill:brave-search # Load and execute the skill
/skill:pdf-tools extract # Load skill with arguments
$brave-search # Equivalent leading dollar invocation
```
Type `$` at the beginning of the interactive editor to browse commands and skills together. Selecting
a command inserts its canonical `/name ` form; selecting a skill inserts `$name `. Additional leading
`$` tokens reopen only the skill list, so multiple skills can be composed in source order.
OmO Desktop skill chips serialize as `$skill:name`. Senpi expands that explicit form even when it
appears inline. Bare inline dollar text remains literal, so `Use $HOME` and `explain $brave-search`
do not become skill invocations.
After resolving the explicit tokens, Senpi removes only those tokens and wraps the remaining text once
as the user request. Unknown tokens stay literal and duplicates are skipped. There is no limit on how
many skills one prompt composes: every invoked skill loads. Skill bodies are inlined until they total
about 128K characters; any skill past that budget is still loaded, as a reference that names its
`SKILL.md` path and tells the model to read it before acting. The first skill is always inlined.
Toggle skill commands via `/settings` in interactive mode or in `settings.json`:
```json
{
"enableSkillCommands": true
}
```
## Skill Structure
A skill is a directory with a `SKILL.md` file. Everything else is freeform.
```
my-skill/
├── SKILL.md # Required: frontmatter + instructions
├── mcp.json # Optional: MCP servers bundled with the skill
├── 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 && bun 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, Senpi 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 | Spec field for pre-approved tools. Senpi does not implement it; the field is ignored. |
| `disable-model-invocation` | No | When `true`, skill is hidden from system prompt. Users must use `/skill:name`. |
### Name Rules
- 1-64 characters
- Lowercase letters, numbers, hyphens only
- No leading/trailing hyphens
- No consecutive hyphens
Senpi 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.
```
## Carrying MCP Servers
A skill can bundle the MCP servers it uses, shipping the workflow and its
tools as one package. Servers declared by a skill register lazily with zero
active tools — they cost no prompt tokens until the skill loads, and the
tools matching the skill's `includeTools` globs activate for the session when
it does.
Declare servers in an `mcp.json` sidecar next to SKILL.md (or in a `mcp:`
frontmatter block):
```json
{
"mcpServers": {
"exa": {
"command": "npx",
"args": ["-y", "exa-mcp-server"],
"env": { "EXA_API_KEY": "${EXA_API_KEY}" },
"includeTools": ["web_search*"]
}
}
}
```
`${EXA_API_KEY}` expands from your environment for a skill you installed. A
skill from an untrusted project keeps it literal, and a skill's remote servers
never expand variables or send `bearerTokenEnv`; see
[Environment variables in skill servers](mcp.md#environment-variables-in-skill-servers).
See [Skill-carried MCP servers](mcp.md#skill-carried-mcp-servers) for the
full declaration forms, collision rules, and reveal semantics.
## Validation
Senpi 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.
Senpi also accepts `argument-hint`, hint text shown next to the skill in the slash picker,
and the boolean `requires-arguments`. A skill with an `argument-hint` expects input: picker
Enter completes `/skill:<name> ` and waits for arguments. Set `requires-arguments: false`
when the arguments are optional so Enter submits immediately. Without a hint, Enter submits
unless `requires-arguments: true` is set.
Declared skills with missing descriptions are not loaded. Malformed `SKILL.md` files and `SKILL.md` files without a description produce warnings and are not loaded. Other Markdown files without valid skill frontmatter are ignored.
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 && bun install
```
## Search
```bash
./search.js "query" # Basic search
./search.js "query" --content # Include page content
```
## Extract Page Content
```bash
./content.js https://example.com
```
````
## Bundled Skills
Senpi contributes built-in skills conditionally based on available credentials and capabilities.
**gpt-image-gen** is contributed by the `imagegen` builtin extension when image-generation credentials exist (stored OpenAI key, `OPENAI_API_KEY`, or an OpenAI-compatible gateway). It is the GPT Image 2.5 prompting guide: tool routing (native `image_generation` server tool vs. the client `generate_image` tool, which is eval-only like `bash`: hidden from the direct tool list whenever an `eval` tool exists and called as `tool.generate_image({ prompt: "..." })` inside a cell), model selection, a specificity policy (normalize specific requests, add concreteness only to generic ones), verbatim quoted text, reference roles and end-state edits, transparent assets, output formats, multi-turn refinement, and a result checklist. For `generate_image`, `model` selects `gpt-image-2.5-sunburst` (default, most capable), `gpt-image-2.5-flare` (speed), or `gpt-image-2`; `quality` accepts `auto`, `low`, `medium`, `high`, `xhigh`, or `max`; `size` accepts `auto`, presets, or validated custom dimensions; `background`, `output_format` (`png`/`jpeg`/`webp`), `output_compression` (jpeg/webp), and `moderation` shape the output, and the saved extension follows the delivered bytes. `reference_image_paths` supplies 1-5 local images; `mask_image_path` adds an alpha mask for local repaints. Only the native server tool returns a `revised_prompt`.
Skill visibility refreshes at startup and on `/reload`. Mid-session credential changes (login, environment variable updates) take effect on the tool and injector immediately but are reflected in the skill list only after the next reload.
## 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