The Killer Diff - Enhancement Analysis
Role Definition Enhanced
Extract role information from input, strengthen professional identity positioning
Negative Constraints Strengthened
Automatically identify and enhance constraint conditions, avoid invalid outputs
Output Format Control
Standardize output format requirements, improve result consistency
Objective Clarified
Clarify task objectives, improve execution precision
Prompt Engineering Methodology
Text Preprocessing Stage
Input text first goes through preprocessing: removing extra whitespace, unifying list formats (dashes, numbered lists), and cleaning special characters.
Key processing:
- Use regex
/\s+/gto merge consecutive whitespace - Use regex
/^(\s*[-•*]\s*)+/gmto unify unordered list format - Use regex
/^(\s*\d+[\.\)]\s*)+/gmto unify ordered list format
Keyword Recognition & Role Extraction
Identify keywords through regular expressions to extract role information:
- Role indicators:
/^(You are|As a|Act as|I need you|Please)/i - Expert indicators:
/^(Expert|Professional|Senior|Advanced)/i
Example: Input "You are a senior software engineer" will automatically extract role as "As a professional software engineer".
Objective Extraction
Identify content after action verbs as task objectives:
- Task verbs:
/^(Do|Write|Generate|Develop|Create|Design|Analyze|Optimize|Organize|Translate)/i
Example: Input "Write an article about AI" will extract objective as "Write an article about AI".
Constraints Extraction
Identify negative words as constraint conditions:
- Constraint indicators:
/^(Do not|Never|Must not|Avoid|Cannot|Should not)/i - Rule indicators:
/^(Rule|Requirement|Condition)/i
Example: Input "Do not use complex terminology" will extract constraint as "Do not use complex terminology".
Context Extraction
Identify background information as context:
- Context indicators:
/^(Based on|According to|Given|Background)/i
Example: Input "Based on user provided data" will extract context as "Based on user provided data".
Missing Value Completion & Template Filling
For features not extracted, the system automatically fills in generic enhancement descriptions:
- Style: Professional, Concise, and Logic-driven
- Tone: Formal, helpful, and informative
- Audience: General audience seeking professional guidance
- Workflow: Analyze requirements -> Plan solution -> Execute task -> Deliver results
Then all extracted features are filled into the selected framework template (CO-STAR, Professional Role, or Simple Structuring).