Reprompt 2.0
Transform simple ideas into powerful, structured prompts with context-aware AI assistance. Reprompt 2.0 is a VS Code extension that enhances your prompt engineering workflow by automatically detecting your project's technology stack and incorporating it into comprehensive, well-structured prompts using Perplexity's Sonar API.
Whether you're crafting prompts for code generation, documentation, or technical problem-solving, Reprompt 2.0 helps you create prompts that yield more accurate, relevant, and useful AI responses—all within your familiar VS Code environment.
Features
- Prompt Transformation: Turn simple ideas into comprehensive, structured prompts with a single command.
- Project Context Awareness: Automatically detects your project's technology stack and incorporates it into transformed prompts.
- Prompt Execution: Run prompts with Sonar and view responses in a formatted webview.
- Rich Markdown Rendering: Sonar responses are displayed with headings, lists, code blocks (with copy button), and clickable links for a beautiful, readable experience.
- Structured Outputs: Get responses as JSON or in custom formats (advanced).
- Inline Decorations: Highlights XML tags (
<context>
, <instruction>
, <examples>
, <constraints>
, <format>
) after transformation.
- Progress Themes: Enjoy fun, themed progress notifications while waiting for responses.
- Performance Stats: Track response times and see detailed transformation statistics (optional).
- Easy Access: Use via Command Palette, context menu, or keyboard shortcuts.
- No Local AI: All processing is done via Perplexity Sonar API.
- Timeout Protection: Added fallback for Sonar API calls to prevent hangs.
- Improved Theme Matching: Webviews better match your selected VS Code theme.
Installation
Option 1: Install from VS Code Extensions Panel
- Open VS Code
- Click on the Extensions icon in the Activity Bar (or press
Ctrl+Shift+X
)
- Search for
kwesinavilot.reprompt
- Click the Install button
Option 2: Install from VS Code Marketplace Website
- Visit Reprompt 2.0 on the VS Code Marketplace
- Click the "Install" button
- When prompted, allow VS Code to launch and complete the installation
Option 3: Install via Command Line
Open a terminal and run:
code --install-extension kwesinavilot.reprompt
Configuration
- Open Command Palette (
Ctrl+Shift+P
).
- Type
Preferences: Open Settings (UI)
and press Enter.
- Search for
reprompt
to see all available settings:
reprompt.sonarApiKey
: Your Perplexity Sonar API key (required)
reprompt.showTransformationStats
: Enable/disable detailed transformation statistics (default: false)
reprompt.inferProjectStack
: Enable/disable automatic project stack detection (default: true)
Usage
Transform a simple idea into a comprehensive, structured prompt:
- Create a new
.md
or .reprompt
file.
- Write a simple prompt idea (e.g., "build a crud for a ghanaian ecommerce shoe store").
- Select your text.
- Press
Ctrl+Shift+O
or right-click and choose Reprompt: Transform Prompt.
- Watch as your simple idea is transformed into a detailed, structured prompt with XML tags.
- The extension automatically detects your project's technology stack and incorporates it into the transformed prompt.
Run a Prompt
Execute a prompt and see the AI's response:
- Select a prompt or leave the cursor in a prompt file.
- Press
Ctrl+Shift+R
or right-click and choose Reprompt: Run with Sonar.
- The response appears in a webview with rich formatting, code blocks, and a stats footer.
- Use the refresh button to regenerate the response if needed.
If you've enabled transformation statistics in settings:
- After transforming a prompt, a statistics panel will open showing:
- Original vs. transformed length and word count
- Expansion ratio
- Processing time
- Summary of changes
Developer Guide: Creating Effective Prompts
Basic Workflow
- Start Simple: Begin with a clear, concise description of what you need.
- Transform: Use the Transform command to expand your idea into a structured prompt.
- Refine: Adjust the transformed prompt if needed to add specific details.
- Execute: Run the prompt to get your response.
- Iterate: Based on the response, refine your prompt further if needed.
Prompt Structure
The transformation process adds structure using XML-style tags:
<context>
: Background information and constraints
<instruction>
: The main task or request
<examples>
: Sample inputs/outputs (if applicable)
<constraints>
: Performance, security, or style boundaries
<format>
: How the response should be structured
Example Workflow
- Simple idea: "create a voice assistant for elderly people"
- After transformation: A comprehensive prompt with context about elderly users, specific features needed, accessibility considerations, and format requirements.
- Run the prompt: Get a detailed response that follows your structured requirements.
Commands & Shortcuts
- Reprompt: Transform Prompt —
Ctrl+Shift+O
- Reprompt: Run with Sonar —
Ctrl+Shift+R
- Reprompt: Test — (No default shortcut, accessible via Command Palette)
FAQ
Q: Is my data sent to Perplexity?
A: Yes, all prompts are sent securely to the Perplexity Sonar API. No data is processed locally.
Q: Where do I get a Sonar API key?
A: Visit perplexity.ai and sign up for API access.
Q: Can I use this with other file types?
A: The extension is optimized for .md
and .reprompt
files, but commands can be run from the Command Palette in any text editor.
Q: Why do I see different progress messages each time?
A: The extension randomly selects from themed message sets (magical, tech, or cooking) to make waiting more enjoyable.
Q: How can I see detailed statistics about my transformations?
A: Enable the reprompt.showTransformationStats
setting in your VS Code preferences.
Q: How does the project stack detection work?
A: The extension analyzes your workspace files (like package.json, requirements.txt, etc.) to identify technologies and frameworks, then incorporates this context into prompt transformations.
Q: What happens if the Sonar API doesn't respond?
A: The extension now includes timeout protection to prevent hanging if the API doesn't respond in a reasonable time.
Troubleshooting
- Command not working? Make sure you've set your Sonar API key in settings.
- Transformation taking too long? Check your internet connection and Sonar API status.
- Need more information? Open the Output panel and select "Reprompt" from the dropdown to see detailed logs.
Support
If you have any questions, suggestions, or feedback, please open an issue.
Contributing
Contributions are welcome! Please read the Contributing Guidelines for details on how to contribute.
License
This project is licensed under the MIT License. See the LICENSE file for details.