slashcmd

package
v0.199.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const (
	SourceBuiltin      = "builtin"
	SourceProject      = "project"
	SourceUser         = "user"
	SourceProjectSkill = "project skill"
	SourceUserSkill    = "user skill"
)

The sources, as the picker labels them.

View Source
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

func List(agent, dir, home string) []Command

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL