# Dexto Commands (File Prompts) This directory contains File Prompts β€” reusable prompt templates that work like Claude Code's custom slash commands. ## Prompt Types in Dexto Dexto supports four types of prompts, each with different capabilities: ### 1. πŸ“ File Prompts (Commands) Location: - Local: `commands/` - Global: `~/.dexto/commands` Format: Markdown files with frontmatter Arguments: Positional placeholders (`$1`, `$2`, `$ARGUMENTS`) Best for: Simple, file-based prompts you can version control ### 2. πŸ”Œ MCP Prompts Source: Connected MCP servers Format: Defined by MCP protocol Arguments: Named arguments (e.g., `report_type: "metrics"`) Best for: Complex prompts from external services (GitHub, databases, etc.) ### 3. ⚑ Starter Prompts Source: Built into Dexto Format: Hardcoded in code Arguments: Varies by prompt Best for: Common operations provided out-of-the-box ### 4. ✨ Custom Prompts Source: Created at runtime via API/UI Format: Stored in database Arguments: Positional placeholders like File Prompts Best for: User-created prompts that need persistence --- **Custom Commands (Create, Use, Manage)** Custom commands are prompts you create at runtime. They live in the local database (not on disk) and are available to the active agent across sessions. They support the same placeholder behavior as file prompts: - `$1..$9` and `$ARGUMENTS` positional placeholders - `$$` escapes a literal dollar - `{{name}}` named placeholders (when you declare `arguments`) - If no placeholders are used in the template: arguments/context are appended at the end Create via Web UI - Open the β€œCreate Custom Prompt” modal in the web UI - Provide `name`, optional `title`/`description`, and the prompt `content` - Use `$1..$9`/`$ARGUMENTS`/`{{name}}` placeholders in `content` - Optionally attach a resource file; it will be stored and included when the prompt runs Create via API - POST `POST /api/prompts/custom` with JSON: ``` { "name": "research-summary", "title": "Research Summary", "description": "Summarize research papers with key findings", "content": "Summarize in style $1 with length $2.\n\nContent:\n$ARGUMENTS", "arguments": [ { "name": "style", "required": true }, { "name": "length", "required": true } ], "resource": { "base64": "data:application/pdf;base64,...", "mimeType": "application/pdf", "filename": "paper.pdf" } } ``` - Declaring `arguments` is optional but recommended; it enables inline argument hints in the slash UI and required-arg validation. - The `resource` field is optional; attached data is stored in the blob store and sent alongside the prompt when executed. Delete via API - `DELETE /api/prompts/custom/:name` Preview resolution (without sending to LLM) - `GET /api/prompts/:name/resolve?context=...&args={...}` - `context` becomes `_context` for positional flows - `args` is a JSON string for structured argument values Argument Handling Summary - Positional tokens typed after `/name` appear in `args._positional` and are expanded into `$1..$9` and `$ARGUMENTS`. - Named args can be declared in `arguments` and referenced as `{{name}}`. - If the template contains any placeholders ($1..$9, $ARGUMENTS, or {{name}}), arguments are considered deconstructed and are NOT appended. - If the template contains no placeholders, providers append at the end: - `Context: <_context>` if provided, otherwise - `Arguments: key: value, ...` --- ## Creating File Prompts ### Basic Structure Create a `.md` file in this directory with frontmatter: ```markdown --- description: Short description of what this prompt does argument-hint: [required-arg] [optional-arg?] --- # Prompt Title Your prompt content here using $1, $2, or $ARGUMENTS placeholders. ``` ### Frontmatter Fields | Field | Required | Description | Example | |-------|----------|-------------|---------| | `description` | βœ… Yes | Brief description shown in UI | `"Summarize text with style and length"` | | `argument-hint` | ⚠️ Recommended | Argument names for UI hints | `"[style] [length]"` | | `name` | ❌ Optional | Override filename as command name | `"quick-summary"` | | `category` | ❌ Optional | Group prompts by category | `"text-processing"` | | `id` | ❌ Optional | Unique identifier | `"summarize-v2"` | ### Argument Placeholders File prompts support Claude Code's positional argument system: | Placeholder | Expands To | Use Case | |-------------|------------|----------| | `$1`, `$2`, ..., `$9` | Individual arguments by position | Structured parameters | | `$ARGUMENTS` | Remaining arguments after `$1..$9` | Free-form text content | | `$$` | Literal dollar sign | When you need `$` in output | ### Examples #### Example 1: Structured Arguments Only ```markdown --- description: Translate text between languages argument-hint: [from-lang] [to-lang] [text] --- Translate from $1 to $2: $3 ``` Usage: `/translate english spanish "Hello world"` Expands to: ``` Translate from english to spanish: Hello world ``` #### Example 2: Mixed Structured + Free-form ```markdown --- description: Analyze code with focus area argument-hint: [file] [focus] --- Analyze the code in **$1** focusing on: $2 Full input for context: $ARGUMENTS ``` Usage: `/analyze utils.ts performance "function slow() { ... }"` Expands to: ``` Analyze the code in **utils.ts** focusing on: performance Full input for context: utils.ts performance function slow() { ... } ``` #### Example 3: Free-form Only ```markdown --- description: Improve any text argument-hint: [text-to-improve] --- Please improve the following text: $ARGUMENTS ``` Usage: `/improve "This sentence not good"` Expands to: ``` Please improve the following text: This sentence not good ``` --- ## Usage in the UI ### Invoking File Prompts 1. Type `/` in chat β€” opens slash command autocomplete 2. Select your prompt β€” shows inline argument hints 3. Provide arguments β€” positional order matters! ### Argument Display The UI shows: - `` β€” Required argument - `` β€” Optional argument - Hover tooltip β€” Argument description (if provided) Example UI display for summarize: ``` /summarize