commands-create-slash-command

Creates and updates Agent Zero slash commands using YAML config and text or Python content files.

19.1k|3.8k|Updated Jun 10, 2024
One-click install
npx skills add https://github.com/agent0ai/agent-zero --skill commands-create-slash-command
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: commands-create-slash-command
Source: https://github.com/agent0ai/agent-zero/tree/main/plugins/_commands/skills/commands-create-slash-command
Command: npx skills add https://github.com/agent0ai/agent-zero --skill commands-create-slash-command

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Authoring reusable slash commands for Agent Zero's built-in Commands plugin requires knowing the exact file layout, config keys, and scope folders, which is error-prone when done by hand.

Core Features & Use Cases

  • File-backed command authoring: Creates a <slug>.command.yaml config plus a .txt template or .py script content file with the required name, description, and type keys.
  • Scope resolution: Places commands in the project scope (usr/projects/<project>/.a0proj/plugins/_commands/commands/) or the global fallback scope (usr/plugins/_commands/commands/).
  • Safe editing: Loads existing command files first and preserves unknown YAML keys when updating.
  • Use Case: Ask the agent to create a /explain-code command, and it writes the YAML config and text template in the correct scope, then reports the saved paths and the /explain-code invocation.

Quick Start

Ask the agent to create a new slash command named explain-code that explains the code snippet passed after the command.

Frequently Asked Questions about commands-create-slash-command

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a slash command in Agent Zero?

Create a `<slug>.command.yaml` config file with name, description, and type keys, plus a matching `.txt` template or `.py` script in the commands folder. The command is then invoked as `/slug` in chat.

What is the difference between text and script slash commands?

Text commands use a `.txt` template with placeholders like {raw} for trailing input. Script commands use a `.py` file implementing `run(payload)` and can optionally set `include_history` in the YAML config.

Where are Agent Zero slash command files stored?

Project-scoped commands live in `usr/projects/<project>/.a0proj/plugins/_commands/commands/`, while global commands live in `usr/plugins/_commands/commands/`. Project scope takes precedence when both exist.

How do I pass arguments to a slash command template?

Use placeholders in the template such as {raw} for the full trailing input, {args.positional.0} for positional arguments, or {args.flags.some_flag} for named flags. The `argument_hint` config key documents expected input.

What happens when editing an existing slash command?

The existing command file is loaded first and any unknown YAML keys are preserved during the update. Only the intended config values and template or script content are modified before saving back to the same scope.