with one click
enhance
Enhance a prompt for better outputs with analysis and optimization
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Enhance a prompt for better outputs with analysis and optimization
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Security and quality audit of application codebase
Autonomous agent execution mode
Bridgebuilder — Autonomous PR Review
Browse and install construct packs from the Loa Constructs Registry
Triage a bug report through structured phases and create micro-sprint
BUTTERFREEZONE Generation Skill
| name | enhance |
| description | Enhance a prompt for better outputs with analysis and optimization |
| allowed-tools | Read, Grep, Glob |
| capabilities | {"schema_version":1,"read_files":true,"search_code":true,"write_files":false,"execute_commands":false,"web_access":false,"user_interaction":false,"agent_spawn":false,"task_management":false} |
| cost-profile | lightweight |
Analyze the prompt for components using the PTCF framework (Persona + Task + Context + Format).
| Component | Patterns | Weight |
|---|---|---|
| Persona | ^(act as|you are|as a|pretend|imagine you're) | 2 |
| Task | Action verbs: (create|review|analyze|fix|summarize|write|debug|refactor|optimize|draft|investigate|compare) | 3 (required) |
| Context | @\w+, file paths (\.ts|\.js|\.py|\.md), "given that", "based on", "from the", "in the" | 3 |
| Format | (as bullets|in JSON|formatted as|limit to|with examples|step by step|list|table) | 2 |
score = 0
if has_task_verb: score += 3
if has_context: score += 3
if has_format: score += 2
if has_persona: score += 2
return score # 0-10
For each missing component, generate specific suggestions:
Classify the prompt into a task type for template selection.
| Task Type | Trigger Patterns | Confidence Boost |
|---|---|---|
debugging | "fix", "debug", "error", "broken", "not working", "fails" | +0.3 if has error message |
code_review | "review", "check", "audit" + code file refs | +0.2 if has file paths |
refactoring | "refactor", "improve", "optimize", "clean up" | +0.2 if mentions patterns |
summarization | "summarize", "tldr", "brief", "key points", "overview" | +0.2 if has source |
research | "analyze", "investigate", "compare", "research", "explore" | +0.2 if multiple subjects |
generation | "create", "write", "draft", "generate", "make" | default |
general | (fallback) | 0.5 |
classify_prompt(prompt):
scores = {}
for task_type, patterns in CLASSIFICATION_RULES:
base_score = count_pattern_matches(prompt, patterns) / len(patterns)
boost = calculate_boost(prompt, task_type)
scores[task_type] = min(1.0, base_score + boost)
best = max(scores, key=scores.get)
confidence = scores[best]
if confidence < 0.3:
return ("general", 0.5)
return (best, confidence)
Load the task-specific template and merge with original prompt.
Templates are located at: resources/templates/{task_type}.yaml
enhance_prompt(original, template, analysis):
enhanced = original
# Add persona if missing (prepend)
if not analysis.components.persona:
enhanced = template.persona.default + "\n\n" + enhanced
# Add format if missing (append)
if not analysis.components.format:
enhanced = enhanced + "\n\n" + template.format.default
# Add constraints (append as list)
for constraint in template.constraints:
if constraint not in enhanced:
enhanced = enhanced + "\n- " + constraint
# Preserve original intent - original text always wins
return enhanced
Present the enhancement results transparently.
## Prompt Enhancement Analysis
### Quality Score: {before}/10 → {after}/10
### Original Prompt
> {original text}
### Detected Components
| Component | Status | Details |
|-----------|--------|---------|
| Persona | ❌/✅/⚠️ | {details} |
| Task | ❌/✅/⚠️ | {details} |
| Context | ❌/✅/⚠️ | {details} |
| Format | ❌/✅/⚠️ | {details} |
### Task Type
`{task_type}` (confidence: {confidence})
### Enhanced Prompt
> {enhanced text}
### Suggestions for Next Time
1. {suggestion 1}
2. {suggestion 2}
3. {suggestion 3}
Available task types:
If enabled: false, return original prompt unchanged.
If score >= auto_enhance_threshold, skip enhancement (prompt is good enough).
When a prompt produces unsatisfactory output, the refinement loop improves the prompt iteratively.
Detect failure signals from:
1. Detect feedback type from user response or tool output
2. Load refinement actions for that feedback type:
- runtime_error → add error context, specify constraints
- verification_failure → add test requirements, specify behavior
- user_rejection → request clarification, narrow scope
- partial_success → focus on gap, add targeted constraint
3. Apply actions in priority order
4. Re-analyze refined prompt
5. If quality >= 7: return refined prompt
6. Else if iterations < max: repeat from step 1
7. Else: return best attempt with suggestions
prompt_enhancement.max_refinement_iterationsWhen showing output, include refinement history if applicable:
### Refinement History
| Iteration | Feedback | Action | Score |
|-----------|----------|--------|-------|
| 1 | user_rejection | Added persona | 4→6 |
| 2 | partial_success | Added format | 6→8 |
Refinement succeeds when:
Refinement fails when: