Documentation
¶
Overview ¶
Package slashcmd lists the slash commands an agent offers in a folder, for the chat field's `/` picker (ADR-053; contract in 03-contracts.md § Chat field pickers).
For Claude Code: a fixed list of its built-in commands, then the custom commands (`.claude/commands/**/*.md`) and skills (`.claude/skills/*/SKILL.md`) of the session's folder, of its repository's root when that is another folder, and of the user's `~/.claude`. For Codex: its built-ins and the user's prompts (`~/.codex/prompts/*.md`, typed as `/prompts:<name>`). Any other agent: none — a list that is not that agent's would type commands it does not have.
Read-only and bounded: names and descriptions only, at most MaxFiles files read, at most headBytes of each.
Index ¶
Constants ¶
const ( SourceBuiltin = "builtin" SourceProject = "project" SourceUser = "user" SourceProjectSkill = "project skill" SourceUserSkill = "user skill" )
The sources, as the picker labels them.
const MaxFiles = 400
MaxFiles bounds how many command and skill files one listing reads.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
// Name is what is typed, without the slash: "compact", "prompts:fix".
Name string `json:"name"`
Description string `json:"description,omitempty"`
// Hint is the arguments it takes, from argument-hint, when it says.
Hint string `json:"hint,omitempty"`
// Source: "builtin", "project", "user", "project skill", "user skill".
Source string `json:"source"`
}
Command is one entry of the picker.
func List ¶
List returns the commands agent ("claude" or "" for Claude Code, "codex", …) offers in dir, for a user whose home is home. Built-ins first, then the folder's, then the user's, each by name; a name already listed is not listed again (a project command shadows a user one of the same name, as in Claude Code).