- Core Library: Shared logic for prompt optimization and API payload generation.
- CLI Tool: Optimize prompts from the command line.
- Web Interface: Modern Next.js application for visual optimization.
Ensure you have Node.js (v18+) and pnpm installed.
# Clone the repository
git clone https://github.com/0xJonHoldsCrypto/promptforge.git
cd promptforge
# Install dependencies
pnpm install
# Build the project
pnpm buildThe CLI allows you to optimize prompts directly from your terminal.
Basic Optimization
# Run the optimizer on a simple string
node packages/cli/dist/index.js optimize "Could you please write me a python script for snake?"JSON Output Useful for piping into other tools or scripts.
node packages/cli/dist/index.js optimize "Fix this bug" --jsonOptions
| Option | Description |
|---|---|
-j, --json |
Output results as structured JSON |
-m, --model |
Target specific model (openai, anthropic, gemini) |
--no-strip |
Disable the automatic removal of "fluff" words |
The web interface provides a rich, dark-mode UI for visual optimization and API payload generation.
-
Start the development server:
cd packages/web pnpm dev -
Open your browser: Navigate to http://localhost:3000
-
Features:
- Split View: Input on the left, optimized results on the right.
- Tabs: Switch between readable text, raw JSON, and ready-to-use API payloads.
- Real-time: format conversion and token estimation.
@promptforge/core: The brain. detailed prompt optimization logic and types.@promptforge/cli: The terminal interface. Built with Commander.js.@promptforge/web: The visual interface. Built with Next.js & Tailwind.
