pt add
Create new prompt files interactively with metadata and template structure. This command guides you through creating well-formatted prompts that integrate seamlessly with PUPT.
Synopsis
bash
pt add [filename] [options]Purpose
The add command:
- Creates new prompt files with proper structure
- Generates YAML frontmatter with metadata
- Opens your editor with a template
- Validates prompt syntax
- Saves to configured prompt directories
- Supports team collaboration features
Options
| Option | Short | Description |
|---|---|---|
--dir <path> | -d | Target directory for new prompt |
--title <title> | -t | Set prompt title |
--tags <tags> | -t | Comma-separated tags |
--editor <editor> | -e | Override default editor |
--template <name> | Use specific prompt template | |
--no-edit | Skip opening editor | |
--help | -h | Show help information |
Interactive Process
1. Filename
? Prompt filename: api-documentation.md- Must end with
.md - Supports subdirectories:
docs/api.md - Auto-suggests based on title
2. Metadata Collection
? Title: API Documentation Generator
? Description: Generate comprehensive API docs
? Tags (comma-separated): api, documentation, openapi
? Author: (auto-detected from git)3. Variable Definition (Optional)
? Add variable definitions? (y/N)
? Variable name: apiName
? Type: (input)
? Message: What is the API name?
? Default value: MyAPI4. Editor Launch
- Opens configured editor
- Pre-filled with template
- Saves on editor close
Examples
Basic Usage
bash
# Interactive prompt creation
pt add
# With filename
pt add code-review.mdWith Metadata
bash
# Complete prompt creation
pt add api-client.md \
--title "API Client Generator" \
--tags "api,typescript,client"Quick Creation
bash
# Skip editor, create basic prompt
pt add quick-note.md --no-edit
# Use specific template
pt add react-component.md --template reactOrganization
bash
# Create in subdirectory
pt add frontend/component.md
# Specify target directory
pt add test.md --dir ~/team-promptsPrompt Templates
Default Template
markdown
---
title: {{title}}
description: {{description}}
tags: [{{tags}}]
author: {{author}}
created: {{date}}
---
# {{title}}
[Describe what this prompt does]
## Context
[Provide context or background information]
## Requirements
[List specific requirements or constraints]
## Instructions
[Main prompt content goes here]
{{!-- Example variable usage:
{{input "variable" "Prompt message"}}
--}}Custom Templates
Create custom templates in ~/.pt/templates/:
markdown
---
title: {{title}}
tags: [react, component]
variables:
- name: componentName
type: input
message: "Component name:"
validate: "^[A-Z][a-zA-Z0-9]*$"
---
# Generate React Component: {{componentName}}
...Frontmatter Schema
Required Fields
title: Display name for the prompt
Optional Fields
description: Brief descriptiontags: Array of tagsauthor: Prompt authorcreated: Creation datemodified: Last modified dateversion: Prompt versionvariables: Pre-defined variables
Variables Schema
yaml
variables:
- name: variableName
type: input|select|multiselect|confirm|editor|password|file
message: "User prompt"
default: "Default value"
required: true|false
validate: "regex pattern"
choices: ["option1", "option2"] # for select typesFile Naming Conventions
Recommended Patterns
- Feature-based:
generate-api-client.md - Type-based:
review-code.md - Category folders:
frontend/react-component.md
Avoid
- Spaces in filenames (use hyphens)
- Special characters
- Very long names
Editor Configuration
Supported Editors
Detected in order:
--editorflag$VISUALenvironment variable$EDITORenvironment variable- Common editors:
code,vim,nano
Editor Settings
bash
# VS Code
export EDITOR="code --wait"
# Vim
export EDITOR="vim"
# Sublime Text
export EDITOR="subl --wait"Validation
The add command validates:
- Filename format
- YAML frontmatter syntax
- Variable definitions
- Template helper usage
- File permissions
Tips
Efficient Creation
bash
# Create multiple related prompts
for type in create read update delete; do
pt add "api-${type}.md" --tags "api,crud"
doneTeam Collaboration
bash
# Add team metadata
pt add feature.md \
--title "Feature: User Authentication" \
--tags "feature,auth,team"Template Development
bash
# Test template syntax
pt add test.md --no-edit
pt # Run to testCommon Issues
Editor Not Opening
bash
# Check editor configuration
echo $EDITOR
# Set editor
export EDITOR="code --wait"
# Use explicit editor
pt add test.md --editor nanoInvalid YAML
yaml
# Correct: Quoted strings with colons
description: "Feature: Authentication"
# Incorrect: Unquoted with colon
description: Feature: AuthenticationPermission Denied
bash
# Check directory permissions
ls -la ./prompts
# Create directory if needed
mkdir -p ./promptsBest Practices
- Descriptive Titles: Use clear, searchable titles
- Consistent Tags: Establish team tagging conventions
- Variable Documentation: Comment complex variables
- Version Control: Commit prompts to git
- Template Reuse: Create templates for common patterns
Related Commands
pt- Use created promptspt edit- Modify existing promptspt install- Get prompts from others
Next Steps
After creating a prompt:
- Test it with
pt - Share via
pt install - Track usage with
pt history
