Files
dev/docs/prompts.md
T
e469236733 Fix documentation errors for Custom Prompts named arguments and add canonical examples (#5910)
The Custom Prompts documentation (docs/prompts.md) was incomplete for
named arguments:

1. **Documentation for custom prompts was incomplete** - named argument
usage was mentioned briefly but lacked comprehensive canonical examples
showing proper syntax and behavior.

2. **Fixed by adding canonical, tested syntax and examples:**
   - Example 1: Basic named arguments with TICKET_ID and TICKET_TITLE
   - Example 2: Mixed positional and named arguments with FILE and FOCUS
   - Example 3: Using positional arguments
- Example 4: Updated draftpr example to use proper $FEATURE_NAME syntax
   - Added clear usage examples showing KEY=value syntax
   - Added expanded prompt examples showing the result
   - Documented error handling and validation requirements

3. **Added Implementation Reference section** that references the
relevant feature implementation from the codebase (PRs #4470 and #4474
for initial implementation, #5332 and #5403 for clarifications).

This addresses issue #5039 by providing complete, accurate documentation
for named argument usage in custom prompts.

---------

Co-authored-by: Eric Traut <[email protected]>
2025-11-15 09:25:46 -08:00

1.4 KiB
Raw Blame History

Custom Prompts

Save frequently used prompts as Markdown files and reuse them quickly from the slash menu.

  • Location: Put files in $CODE_HOME/prompts/ (defaults to ~/.code/prompts/; Code also reads legacy ~/.codex/prompts/).
  • File type: Only Markdown files with the .md extension are recognized.
  • Name: The filename without the .md extension becomes the slash entry. For a file named my-prompt.md, type /my-prompt.
  • Content: The file contents are sent as your message when you select the item in the slash popup and press Enter.
  • Arguments: Local prompts support placeholders in their content:
    • $1..$9 expand to the first nine positional arguments typed after the slash name
    • $ARGUMENTS expands to all arguments joined by a single space
    • $$ is preserved literally
    • Quoted args: Wrap a single argument in double quotes to include spaces, e.g. /review "docs/My File.md".
  • How to use:
    • Start a new session (Codex loads custom prompts on session start).
    • In the composer, type / to open the slash popup and begin typing your prompt name.
    • Use Up/Down to select it. Press Enter to submit its contents, or Tab to autocomplete the name.
  • Notes:
    • Files with names that collide with built‑in commands (e.g. /init) are ignored and won’t appear.
    • New or changed files are discovered on session start. If you add a new prompt while Codex is running, start a new session to pick it up.