mkprompt
v1.0.1
Published
A CLI tool that generates dynamic prompts from templates using variable substitution, perfect for AI assistants and repeatable workflows.
Maintainers
Readme
mkprompt - Dynamic Prompt Generator
A CLI tool that generates dynamic prompts from templates using variable substitution, perfect for AI assistants and repeatable workflows.
Features
- 🚀 Interactive CLI - Select prompts and fill variables interactively
- 📝 Dynamic Variables - Use
<?variable_name?>syntax for templating - ⚙️ Configurable - Customize paths, comments, and output settings
- 🎯 AI-Friendly - Generate prompts ready for ChatGPT, Claude, and others
- 🔧 Zero Dependencies - Pure Node.js, no external dependencies
- 📁 Organized Output - Timestamped files for easy tracking
- 🎨 Beautiful CLI - Colorful and intuitive interface
Installation
npm install -g mkpromptQuick Start
Initialize mkprompt in your project
mkprompt configThis creates:
mkprompt.config.json- Configuration fileprompts/- Directory for your prompt templatesmkprompt/- Output directory (added to .gitignore)- An example prompt template
Generate a prompt
mkpromptUsage
Basic Flow
- Run mkprompt in your project directory
- Select a prompt from your templates
- Fill in the variables when prompted
- Get your generated prompt in the
mkprompt/directory
Example Session
$ mkprompt
📝 Available Prompts
1) code-review.txt
2) documentation.txt
3) refactor.txt
? Select a prompt (1-3): 1
✓ Selected: code-review.txt
ℹ Found 3 variable(s): language, framework, focus_area
📋 Fill in the variables
? language: TypeScript
? framework: NestJS
? focus_area: performance optimization
✨ Prompt generated successfully!
✓ Output: mkprompt/code-review_2025-01-15_14-30-45.txtVariable Syntax
Use <?variable_name?> in your prompt templates:
You are an expert in <?programming_language?>.
The project is called <?project_name?> and uses <?framework?>.
Please help with:
<?task_description?>
Focus on:
- <?focus_area_1?>
- <?focus_area_2?>Variable Naming
- Use underscores for multi-word variables:
<?user_name?> - Variables are displayed with spaces:
user name - Same variable can appear multiple times (only asked once)
Configuration
The mkprompt.config.json file:
{
"prompts_path": "./prompts",
"first_comment": "/* Prompt Generated by mkprompt */",
"last_comment": "/* End of Prompt */"
}| Option | Description | Default |
|--------|-------------|---------|
| prompts_path | Directory containing prompt templates | "./prompts" |
| first_comment | Comment added at the beginning | "/* Prompt Generated by mkprompt */" |
| last_comment | Comment added at the end | "/* End of Prompt */" |
Output Format
Generated prompts are saved as:
mkprompt/
└── promptname_YYYY-MM-DD_HH-MM-SS.txtExample output:
/* Prompt Generated by mkprompt */
You are an expert in TypeScript.
The project is called MyApp and uses NestJS.
Please help with:
Optimize database queries for better performance
Focus on:
- Query efficiency
- Caching strategies
/* End of Prompt */Example Prompts
Code Review Prompt
You are a senior <?language?> developer reviewing code.
Project: <?project_name?>
Framework: <?framework?>
Review the following code focusing on:
- <?focus_area?>
- Best practices
- Potential bugs
Code to review:
<?code_snippet?>Documentation Prompt
Generate documentation for a <?type?> in <?language?>.
Component name: <?component_name?>
Purpose: <?purpose?>
Include:
- Description
- Parameters/Props
- Usage examples
- <?additional_sections?>Refactoring Prompt
Refactor the following <?language?> code.
Current implementation:
<?current_code?>
Goals:
- <?goal_1?>
- <?goal_2?>
Constraints:
- Maintain backward compatibility with <?api_version?>
- Follow <?style_guide?> guidelinesCommands
| Command | Description |
|---------|-------------|
| mkprompt | Interactive prompt generation |
| mkprompt config | Create configuration and directories |
| mkprompt help | Show help message |
| mkprompt --version | Show version |
Directory Structure
After running mkprompt config:
your-project/
├── mkprompt.config.json # Configuration
├── prompts/ # Your prompt templates
│ └── example.txt # Example template
├── mkprompt/ # Generated outputs (gitignored)
│ └── example_2025-01-15_14-30-45.txt
└── .gitignore # Updated with mkprompt/Use Cases
- AI Pair Programming - Generate consistent prompts for code assistance
- Documentation - Create templated requests for doc generation
- Code Reviews - Standardize review request prompts
- Onboarding - Create repeatable prompts for common tasks
- Team Workflows - Share prompt templates across your team
Platform Support
- ✅ Windows - Full support
- ✅ macOS - Full support
- ✅ Linux - Full support
Requirements
- Node.js 14.0+
- npm (for installation)
Troubleshooting
Command not found
- Ensure npm global bin is in your PATH
- Try:
npm bin -gto see installation location - Restart your terminal
Permission errors (Unix)
sudo npm install -g mkpromptOr fix npm permissions: https://docs.npmjs.com/resolving-eacces-permissions-errors
Contributing
Contributions are welcome! Please feel free to submit pull requests or open issues.
License
MIT License - see LICENSE file for details.
Author
David200197 - GitHub
Related Projects
- mkctx - Generate markdown context from your codebase
