Skip to content

prompter (generate)

The main command for generating prompts. Can be invoked as prompter or prompter generate.

Usage

Terminal window
prompter [base-prompt] [flags]

Modes

  • Interactive mode (default) prompts for a base prompt and lets you select templates
  • Non-interactive mode (--yes) uses only arguments and flags
Terminal window
# Interactive
prompter
# Non-interactive
prompter "explain this function" --yes

Inputs

Base Prompt

Passed as arguments and joined with spaces:

Terminal window
prompter "explain this code"
prompter explain this code # Same as above

Clipboard

Append clipboard text or use it as the base prompt:

Terminal window
# Append clipboard
prompter "explain this output" --clipboard
# Use clipboard as base prompt (if no prompt provided)
prompter --clipboard

Piped Input

Any stdin content is appended at the end:

Terminal window
# Pipe command output
git diff | prompter "explain these changes"
# Pipe file content
cat error.log | prompter "analyze this error"
# Pipe test output
bun test | prompter "summarize this failure" --yes

Templates

By Name

Terminal window
prompter --template code-review
prompter --template code-review --template security

By Flag

Template flags are automatically generated based on the markdown file name and can also be set in template frontmatter.

More information in Templates.

Terminal window
# If template has flag: "code-review"
prompter --code-review
# If template has shorthand: "r"
prompter -r

Use prompter --help to see all available template flags.

Including dynamically generated template flags.

Built-in Flags

Built-in Shorthand Flags

Because templates dynamically generate flags as a part of my primary workflows with prompter, the built-in flag shorthands are defaulted to use capital case for the root comamnd.

All shorthands can be remapped in the Config.

Help

Prompter is designed to do a lot of things. And do weird things with the flag manipulation.

You can check the builtin and dynamically generated flags with the --help flag. For any command.

Terminal window
prompter --help

Short form:

Terminal window
prompter -H

Context Flags

Files

Include specific files (repeatable):

Terminal window
prompter "review these" --file main.go
prompter "review these" --file main.go --file utils.go

Short form:

Terminal window
prompter "review these" -F main.go -F utils.go

Directory Path

Include the current directory path:

Terminal window
prompter "analyze the codebase" --directory

Short form:

Terminal window
prompter "analyze the codebase" -D

Directory Content

Include the current directory contents:

Terminal window
prompter "analyze the codebase" --dir-content

Warning: this will dump top level file contents into the prompt

Directory inclusion uses directory_strategy from config:

  • git - Include only tracked files
  • filesystem - Walk directory tree (respects .gitignore)

Output Flags

Target

Specify where to send the output:

Terminal window
# Copy to clipboard (default)
prompter "explain this" --target clipboard
# Print to stdout
prompter "explain this" --target stdout
# Save to file (other than history)
prompter "explain this" --target file:/tmp/prompt.txt
# Open in editor
prompter "explain this" --target editor

Short form:

Terminal window
prompter "explain this" -T stdout

Editor

Open the prompt in your editor:

Terminal window
prompter "explain this" --editor

Short form:

Terminal window
prompter "explain this" -E

How is this different than -T editor?

Dpending on your configured editor; -T clipboard -E allows you to use your editor to draft / touch up the prompt. While, still copying to the clipboard.

If the target is clipboard, and the editor is a terminal compatible editor like nvim the prompt will be copied on close.

More info in Integrations

History

Tagging

Add a tag to the history entry:

Terminal window
prompter "fix bug #123" --tag bug-123

Short form:

Terminal window
prompter "fix bug #123" -G bug-123

Search history by tag later:

Terminal window
prompter history bug-123

More info in History

Agents

Include local AGENTS.md in prompt if present:

Terminal window
prompter "explain this" --agents

Short form:

Terminal window
prompter "explain this" -A

Agent templates are also controlled by the include_agents config setting.

Mode Control

Force Interactive

Helpful if interactive_default == false

Terminal window
prompter --interactive "explain this"

Short form:

Terminal window
prompter -I "explain this"

Force Non-Interactive

Helpful if interactive_default == true

Terminal window
prompter --yes "explain this"

Short form:

Terminal window
prompter -Y "explain this"

Template Order

Templates are applied in the order they appear on the command line. The base prompt is inserted where the first non-flag argument appears.

Terminal window
# Base prompt after template
prompter --template context "explain this"
# Base prompt between templates
prompter --template before "explain this" --template after

Examples

Basic Usage

Terminal window
# Simple prompt
prompter "explain this code"
# With a specific file
prompter "review this" --file src/main.go
# Include entire directory
prompter "analyze the codebase" --directory

Using Templates

Terminal window
# Use a specific template
prompter --template code-review
# Use multiple templates
prompter --template code-review --template security-check
# Use template shorthand flags
prompter -r # Uses code-review template with shorthand 'r'

Output Targets

Terminal window
# Copy to clipboard (default)
prompter "explain this"
# Print to stdout
prompter "explain this" --target stdout
# Save to file
prompter "explain this" --target file:/tmp/prompt.txt
# Open in editor
prompter "explain this" --editor

With Context

Terminal window
# Include clipboard content
prompter "explain this output" --clipboard
# Include specific files
prompter "review these files" --file src/main.go --file src/utils.go
# Include directory with agent templates
prompter "analyze the project" --directory --agents

Tagged History

Terminal window
# Add a tag for later retrieval
prompter "fix bug #123" --tag bug-123
# Search history by tag later
prompter history bug-123

Piped Workflows

Terminal window
# Analyze test failures
npm test 2>&1 | prompter "explain these test failures" --yes
# Review git changes
git diff | prompter --code-review --yes
# Analyze logs
tail -n 100 app.log | prompter "find the error" --yes

Configuration

Override config with flags:

Terminal window
# Use custom config file
prompter --config .prompter/custom-config.toml
# Force interactive mode
prompter --interactive
# Force non-interactive mode
prompter --yes

Reserved Short Flags

These single-letter flags are reserved by Prompter:

  • -A - Agents
  • -B - Clipboard
  • -D - Directory
  • -E - Editor
  • -F - File
  • -G - Tag (history)
  • -I - Interactive
  • -T - Target
  • -V - Version
  • -Y - Yes (non-interactive)

Template shorthands cannot use these letters unless remapped in config.