Closed phrazzld closed 1 month ago
After analyzing the attached PDF and the linked prompt engineering resources from Anthropic, OpenAI, and PromptingGuide.ai, along with the current elevator implementation, I've identified several opportunities to significantly enhance the prompt transformation capabilities.
The elevator currently uses a basic elevation prompt (lines 38-48 in api.ts
) that transforms requests into \"sophisticated, technically precise articulations.\" While functional, it doesn't leverage many of the advanced techniques from modern prompt engineering.
Modern prompt engineering emphasizes structured approaches like:
State-of-the-art techniques focus on:
Advanced approaches handle vague requests by:
Pros:
Cons:
Implementation:
const ENHANCED_ELEVATION_PROMPT = `
<role>You are an expert prompt engineer specializing in transforming vague requests into precise, actionable prompts.</role>
<instructions>
Transform the user's request using these techniques:
1. Add specific context and constraints
2. Clarify ambiguous terms
3. Structure the request with clear sections
4. Include format specifications
5. Add success criteria
</instructions>
<examples>
Input: "Write about AI"
Output: "Create a 1000-word article about artificial intelligence applications in healthcare. Structure: introduction (200 words), three main applications with real-world examples (600 words total), future implications (200 words). Target audience: healthcare professionals. Tone: informative but accessible."
</examples>
<output>Provide only the enhanced prompt, no explanations.</output>
`;
Pros:
Cons:
Implementation:
interface PromptPipeline {
analyze(prompt: string): PromptAnalysis;
enrich(analysis: PromptAnalysis): EnrichedPrompt;
structure(enriched: EnrichedPrompt): StructuredPrompt;
optimize(structured: StructuredPrompt): string;
}
Pros:
Cons:
Implementation:
const detectDomain = (prompt: string): Domain => { /* ... */ };
const applyTemplate = (prompt: string, domain: Domain): string => {
const template = DOMAIN_TEMPLATES[domain];
return template.transform(prompt);
};
Pros:
Cons:
Implementation:
class HybridPromptEnhancer {
async enhance(prompt: string): Promise<string> {
const complexity = this.assessComplexity(prompt);
if (complexity === 'simple') {
return this.templateEnhance(prompt);
} else if (complexity === 'moderate') {
return this.singlePassEnhance(prompt);
} else {
return this.pipelineEnhance(prompt);
}
}
}
interface PromptAnalysis {
domain: string;
intent: string;
ambiguities: string[];
missingContext: string[];
suggestedStructure: string;
}
const STRUCTURE_TEMPLATES = {
technical: "Context: {}\nObjective: {}\nConstraints: {}\nDeliverables: {}",
creative: "Theme: {}\nTone: {}\nAudience: {}\nFormat: {}",
analytical: "Data: {}\nMethodology: {}\nMetrics: {}\nOutput: {}"
};
Build a repository of before/after transformations categorized by:
I recommend Approach 4: Hybrid Intelligence System with phased implementation:
Update the current ELEVATION_PROMPT
with structured patterns and examples. This can be done immediately with minimal code changes.
Add simple keyword-based domain detection to apply domain-specific enhancements.
Implement structured templates for common request types.
Build the complete multi-stage pipeline for complex transformations.
// In api.ts, replace ELEVATION_PROMPT with:
const ELEVATION_PROMPT = `<system>
You are an expert prompt engineer. Transform vague requests into precise, actionable prompts using state-of-the-art techniques.
</system>
<techniques>
1. STRUCTURE: Use clear sections (Context, Task, Constraints, Output)
2. SPECIFICITY: Replace vague terms with precise technical language
3. EXAMPLES: Add relevant examples when helpful
4. CONSTRAINTS: Include format, length, tone, audience specifications
5. VALIDATION: Add success criteria and quality checks
</techniques>
<examples>
<example>
Input: "Help me with my code"
Output: "Review this TypeScript codebase for potential performance bottlenecks. Focus on: 1) Inefficient algorithms (O(n²) or worse), 2) Memory leaks in event handlers, 3) Unnecessary re-renders in React components. Provide specific line numbers and suggested optimizations for each issue found. Format: Markdown with code snippets."
</example>
<example>
Input: "Write about climate change"
Output: "Create a 1500-word research summary on climate change mitigation technologies. Structure: Executive summary (200 words), Current technologies overview (500 words) covering solar, wind, and carbon capture, Emerging technologies (500 words) including fusion and geoengineering, Policy recommendations (300 words). Target audience: Policymakers with limited technical background. Include 5+ peer-reviewed citations."
</example>
</examples>
<task>
Transform the following request into a sophisticated, precise prompt. Output ONLY the enhanced prompt, no explanations.
</task>`;
Quality Metrics
User Metrics
Technical Metrics
ELEVATION_PROMPT
with enhanced version (Phase 1)This approach leverages the best practices from modern prompt engineering while maintaining the simplicity and effectiveness that makes elevator valuable.
After careful analysis, here's what I believe is the best path forward:
Replace the current basic prompt with an enhanced version that incorporates proven prompt engineering patterns. This requires minimal code changes but delivers immediate value:
const ELEVATION_PROMPT = `<role>Expert prompt engineer specializing in precise technical communication</role>
<objective>Transform the user's request using these proven techniques:
- Add specific context and measurable outcomes
- Replace vague terms with precise technical language
- Structure with clear sections: Context → Task → Constraints → Output
- Include relevant examples when patterns are detected
- Specify format, length, tone, and audience
</objective>
<patterns>
When you detect these patterns, apply specific enhancements:
- "help with X" → Add specific problems, success criteria, constraints
- "write about X" → Add word count, structure, audience, key points
- "analyze X" → Add methodology, metrics, output format, scope
- "create X" → Add specifications, requirements, examples, validation
</patterns>
<output_rules>
- Output ONLY the transformed prompt
- No explanations, headers, or meta-commentary
- Preserve user's core intent while maximizing clarity
- Make implicit requirements explicit
</output_rules>
Transform this request:`;
Add a lightweight pattern detection system:
// New file: src/patterns.ts
export const PROMPT_PATTERNS = {
analysis: {
keywords: ['analyze', 'review', 'evaluate', 'assess'],
template: 'Analyze {subject} using {methodology}. Focus on: {aspects}. Deliverables: {outputs}. Constraints: {limits}.'
},
creation: {
keywords: ['create', 'build', 'write', 'design'],
template: 'Create {artifact} for {audience}. Requirements: {specs}. Format: {structure}. Success criteria: {validation}.'
},
// ... more patterns
};
// Enhanced api.ts
function detectPattern(prompt: string): PromptPattern | null {
// Simple keyword matching initially
// Can evolve to ML-based classification later
}
Build the example bank system:
// New file: src/examples.ts
export interface PromptExample {
domain: string;
before: string;
after: string;
techniques: string[];
}
export const EXAMPLE_BANK: PromptExample[] = [
{
domain: 'software',
before: 'Fix my bug',
after: 'Debug TypeError in React component OrderForm (line 45). Error occurs when user.address is undefined. Need to: 1) Add null checking, 2) Provide fallback values, 3) Update TypeScript types. Include unit tests for edge cases.',
techniques: ['specificity', 'structure', 'validation']
},
// ... extensive example library
];
Evolve into the hybrid system that adapts based on prompt complexity:
class AdaptivePromptEnhancer {
async enhance(prompt: string): Promise<string> {
const features = this.extractFeatures(prompt);
// Simple prompts: Use templates (fast)
if (features.wordCount < 10 && features.hasPattern) {
return this.templateEnhance(prompt, features.pattern);
}
// Moderate complexity: Single LLM pass
if (features.complexity === 'moderate') {
return this.llmEnhance(prompt, this.selectExamples(features));
}
// Complex prompts: Multi-stage pipeline
return this.pipelineEnhance(prompt, features);
}
}
The best prompt engineering isn't about making prompts longer or more complex—it's about making them precise and actionable. Every enhancement should:
This philosophy aligns perfectly with elevator's mission of transforming simple requests into sophisticated articulations.
ELEVATION_PROMPT
with the enhanced versionThe elevator project has the potential to become the standard tool for prompt enhancement. By incorporating these state-of-the-art techniques, we can help users get dramatically better results from AI systems while maintaining the simplicity that makes elevator special.
22365_3_Prompt Engineering_v7 (1).pdf
this and followup links: https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview https://platform.openai.com/docs/guides/text?api-mode=responses https://www.promptingguide.ai/