Skip to main content
The Prompts.dev CLI provides six core commands for managing prompt packages. Each command is built with Cobra and includes comprehensive flag support.

login

Authenticate with the Prompts.dev platform using OAuth.
prompt login [flags]

Flags

--provider
string
default:"github"
OAuth provider to use for authentication. Supported values: github, google

How it works

The login command:
  1. Generates a random state parameter for CSRF protection (see main.go:90-93)
  2. Starts a local callback server on 127.0.0.1:9876 (see main.go:110)
  3. Opens your browser to the OAuth provider’s login page (see main.go:135)
  4. Receives the authentication token via callback (see main.go:111-127)
  5. Stores the token in ~/.prompts/config.json with 0o600 permissions (see main.go:395-403)

Examples

prompt login

Expected output

Complete login in your browser...
Logged in successfully
The login flow times out after 2 minutes (see main.go:149-151).

init

Scaffold a new prompt package with the required file structure.
prompt init [name] [flags]

Arguments

name
string
required
The name of the prompt package to create. This will be used as the directory name.

Flags

--force
boolean
default:"false"
Overwrite existing files if they already exist

Generated files

The init command creates three files (see main.go:175-179):
name: my-prompt
description: Describe your prompt
version: 1.0.0
author: 
inputs:
  - name: product
    required: true
tags:
  - general
Defines metadata, required inputs, and tags for your prompt.
Write a high-quality prompt using {{product}}.
The actual prompt template with variable placeholders using {{variable}} syntax.
# my-prompt

Prompt package.
Human-readable documentation for your prompt package.

Examples

prompt init code-reviewer

Expected output

Initialized prompt package in code-reviewer

publish

Publish the current prompt package to the registry.
prompt publish

Requirements

  • Must be run from a directory containing prompt.yaml
  • Must be authenticated (run prompt login first)
  • Manifest must have valid name and version fields (see main.go:417-425)

How it works

The publish command:
  1. Loads and validates prompt.yaml (see main.go:205-211)
  2. Creates the prompt in the registry or finds the existing one (see main.go:218-224)
  3. Creates a tarball of the current directory (see main.go:226-230)
  4. Uploads the tarball as a new version (see main.go:236-238)

Examples

cd my-prompt
prompt publish

Expected output

If a prompt with the same name already exists, you’ll get an error: prompt already exists; fetch prompt id and publish a new version (see main.go:223)

install

Install a prompt package from the registry.
prompt install [owner/name[@version]]

Arguments

owner/name[@version]
string
required
The prompt package identifier. Format: owner/name or owner/name@version
  • If version is omitted, installs the latest version (see main.go:270-279)
  • Version is fetched from the API if not specified

Installation location

Prompts are installed to .prompts/[name]/ in the current directory (see main.go:286).

Examples

prompt install topboyasante/code-reviewer

Expected output

Installed topboyasante/[email protected] into .prompts/code-reviewer

run

Render a prompt template with provided variables.
prompt run [name] [flags]

Arguments

name
string
required
The name of the installed prompt to run (from .prompts/[name]/)

Flags

--var
key=value
Template variables to inject. Can be specified multiple times.Required variables are validated against the manifest (see main.go:318-324).

How it works

The run command:
  1. Loads the manifest from .prompts/[name]/prompt.yaml (see main.go:309-312)
  2. Reads the template from .prompts/[name]/prompt.md (see main.go:313-316)
  3. Validates all required inputs are provided (see main.go:318-324)
  4. Performs simple string replacement: {{key}} → value (see main.go:326-329)
  5. Prints the rendered prompt to stdout

Examples

prompt run code-reviewer --var language=python

Expected output

The rendered prompt text with variables replaced:
Write a high-quality prompt using python.
If a required variable is missing, you’ll get an error: missing required --var [name] (see main.go:321-323)

Search for prompts in the registry.
prompt search [query]

Arguments

query
string
required
Search query to find prompts by name, description, or tags

How it works

Results are:

Examples

prompt search "code review"

Expected output

NAME                    DESCRIPTION
code-reviewer           AI-powered code review assistant
go-code-reviewer        Specialized Go code reviewer
py-code-reviewer        Python code review with best practices

Global behavior

Environment loading

The CLI automatically loads .env files from the current directory or any parent directory (see main.go:60-82).

Config directory

All commands ensure ~/.prompts/ exists before running (see main.go:47-49).

Error handling

Errors are written to stderr and exit with code 1 (see main.go:54-57).

Next steps

Workflow Guide

See these commands in action with real-world examples

API Reference

Learn about the underlying API used by the CLI

Build docs developers (and LLMs) love