Prompts
Elftia provides a comprehensive prompt management system for creating reusable prompt templates. It supports dynamic variable placeholder filling, chained prompt sequential execution, category and tag organization, quick insertion in chat, and AI-driven prompt optimization.
Use Cases
- Create commonly used prompt templates to avoid typing the same thing repeatedly
- Use variables to make a single template adapt to different input parameters
- Chain multiple prompts into a pipeline to automate multi-step tasks
- Use
//in chat to quickly insert favorited prompts - Use the AI optimizer to improve the quality of your prompt wording
- Organize large numbers of prompts by category and tag
Prompt Templates
A prompt template is a reusable text fragment that can contain variable placeholders filled in dynamically at use time.
Creating a Prompt
Steps
- Open the Prompt library (from the sidebar or navigation menu)
- Click the New Prompt button
- Fill in the basic information:
| Field | Description | Required |
|---|---|---|
| Name | The prompt's name | Yes |
| Description | Explanation of the prompt's purpose | No |
| Content | The prompt body (supports variable syntax) | Yes |
| Category | The category it belongs to (see category management below) | No |
| Icon | Display icon | No |
| Color | Display color | No |
| Favorite | Whether to mark as favorite | No |
- (Optional) Add variable definitions
- Save
Variable Support
You can use {{variable_name}} syntax in the prompt content to define placeholders. When using the prompt, the system pops up a form for you to fill in variable values.
Variable Syntax
Please review the following {{language}} code:
{{code}}
Please focus on: {{focus_areas}}
Variable Types
| Type | ID | Description | Best For |
|---|---|---|---|
| Text | text | Single-line text input | Short parameter values |
| Number | number | Number input with optional min and max | Quantities, temperatures, and other numeric parameters |
| Select | select | Dropdown; choose from predefined options | Parameters with fixed choices |
| Textarea | textarea | Multi-line text input | Longer text content such as code snippets |
Variable Definition Fields
| Field | Description | Required |
|---|---|---|
| Name (name) | Variable identifier (corresponds to {{name}}) | Yes |
| Label (label) | Display label for the variable | Yes |
| Type (type) | Variable type | Yes |
| Default value (defaultValue) | Pre-filled default value | No |
| Placeholder (placeholder) | Placeholder text for the input | No |
| Required (required) | Whether the variable is required | No |
| Options (options) | Option list for select type | Required for select |
| Min (min) | Minimum value for number type | No |
| Max (max) | Maximum value for number type | No |
Variable Usage Example
Template content:
Please write a {{function_type}} in {{language}}:
Requirements:
{{requirement}}
Requirements:
- Code style: {{style}}
- Comment language: {{comment_lang}}
Variable definitions:
| Variable name | Label | Type | Options/Default |
|---|---|---|---|
language | Programming Language | select | Python, JavaScript, TypeScript, Go, Rust |
function_type | Feature Type | text | Default: "function" |
requirement | Requirement Description | textarea | — |
style | Code Style | select | Concise, Detailed, Enterprise |
comment_lang | Comment Language | select | Chinese, English, Japanese |
When used, the system pops up a form; after filling it in, variables are automatically replaced to generate the final prompt.
Prompt Chains
A prompt chain links multiple prompt templates into an execution pipeline, sending them to the AI in sequence to automate multi-step tasks.
Creating a Prompt Chain
Steps
- Switch to the Chains tab in the prompt library
- Click the New Chain button
- Fill in the chain's basic information (name, description, etc.)
- Add steps: select the prompt templates you want to link from the library
- Configure execution parameters for each step
- Save
Chain Step Configuration
| Parameter | Description | Default |
|---|---|---|
| Prompt (promptId) | Select the prompt template to execute | Required |
| Sort order (sortOrder) | Execution order | Auto-increment |
| Delay (delay) | Wait time before sending (milliseconds) | 0 |
| Wait for response (waitForResponse) | Whether to wait for the AI reply before executing the next step | Yes |
| Require confirm (requireConfirm) | Whether user confirmation is required before executing | No |
Execution Flow
Step 1 → (wait for reply) → Step 2 → (wait for reply) → Step 3 → ... → Done
If a step has requireConfirm set, the system pauses before executing that step and waits for you to confirm before continuing.
Use Case Examples
Code review chain:
- Step 1: Analyze code structure
- Step 2: Check for security issues
- Step 3: Performance optimization suggestions
- Step 4: Generate review report
Content creation chain:
- Step 1: Generate outline
- Step 2: Expand each section
- Step 3: Polish and proofread
- Step 4: Generate summary
Quick Insertion (// Trigger)
Typing // in the chat input box lets you quickly insert a prompt without leaving the conversation.
Steps
- Type
//in the chat input box - The quick insertion menu appears with three sections:
- Favorites — prompts marked as favorites
- Recently used — prompts used recently
- Chains — available prompt chains
- Click to select a prompt
- If the prompt contains variables, a variable fill-in form pops up
- After filling in variables, the final content is inserted into the input box
Behavior Notes
- The quick insertion menu is sorted by frequency of use and favorite status
- Selecting a prompt chain executes the steps sequentially per the chain's configuration
Category Management
Use categories to organize large numbers of prompts, with support for hierarchical structures.
Steps
- Manage categories in the left panel of the prompt library
- Click + to create a new category
- Fill in the category information:
| Field | Description |
|---|---|
| Name | Category name |
| Description | Category description (optional) |
| Parent category | Parent category (optional; supports nesting) |
| Icon | Category icon (optional) |
| Color | Category color (optional) |
- Click a category to filter and show only prompts in that category
Category Operations
- Create — create a new category
- Edit — modify category information
- Delete — delete a category (prompts under the category are not deleted; they become uncategorized)
- Drag to reorder — adjust the display order of categories
Usage Tracking
The system automatically records the usage count of each prompt and prompt chain.
| Field | Description |
|---|---|
| Usage count (usageCount) | Cumulative number of uses |
| Created at (createdAt) | Creation timestamp |
| Updated at (updatedAt) | Last modification timestamp |
Usage count helps you understand which prompts are used most frequently and also influences the sort order in the quick insertion menu.
Prompt Optimizer
Elftia includes an AI-powered prompt optimizer that analyzes and improves the quality of your prompts.
How to Use
- In the prompt editor, click the Optimize button
- The system sends your prompt to AI for analysis
- AI returns an optimized version, including:
- Optimized content — the improved prompt text
- Suggestions — explanation of the optimization
- Changes — what specifically was modified
- You can choose to accept the optimized result or keep the original
Optimization Parameters
| Parameter | Description |
|---|---|
| Original content (content) | The prompt text to optimize |
| Context (context) | Description of the prompt's use case (optional; helps AI optimize more precisely) |
| Language (language) | Target language for optimization (optional) |
Prompt Library Views
The prompt library provides multiple ways to browse and filter:
| View | Description |
|---|---|
| List view | Prompts organized by category |
| Search | Search by name and description |
| Favorites filter | Show only favorited prompts |
| Category filter | Show only prompts in a specific category |
| Built-in filter | Show only system built-in prompts |
FAQ
| Problem | Solution |
|---|---|
| Variable was not replaced | Confirm the variable syntax is correct ({{name}} double curly braces) and the variable name matches the definition |
| Quick insertion menu does not appear | Ensure // is typed at the beginning of the input box or after a space |
| Prompt chain interrupted | Check that each step's prompt still exists; deleted prompts cause the chain to break |
| Optimizer is not responding | Confirm a valid LLM provider and API Key are configured |
| Imported prompt category is missing | Category information may not be included in the import data; manually re-categorize |
| Usage count is inaccurate | Usage count is automatically incremented on quick insert and manual use |