.claude/skills/enhancing-prompts/SKILL.md
# Enhancing Prompts <objective> Analyze prompt quality, classify task type, and enhance with optimized templates while preserving original intent. Provides transparent feedback showing what was enhanced and why. </objective> <inputs> - `prompt`: The user's original prompt to analyze and enhance - `--analyze-only`: (optional) Show analysis without enhancement - `--task-type <type>`: (optional) Force a specific task type </inputs> <workflow> ## Phase 1: Analysis Analyze the prompt for compone
npx skillsauth add 0xhoneyjar/loa-beauvoir .claude/skills/enhancing-promptsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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).
</configuration>
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:
tools
Control headless Chrome via Cloudflare Browser Rendering CDP WebSocket. Use for screenshots, page navigation, scraping, and video capture when browser automation is needed in a Cloudflare Workers environment. Requires CDP_SECRET env var and cdpUrl configured in browser.profiles.
testing
# valid-skill Test skill with valid license for unit testing. ## Purpose Used in test_constructs_loader.bats to verify correct handling of valid licenses.
testing
# grace-skill Test skill in license grace period for unit testing. ## Purpose Used in test_constructs_loader.bats to verify correct handling of licenses in grace period.
testing
# expired-skill Test skill with expired license for unit testing. ## Purpose Used in test_constructs_loader.bats to verify correct handling of expired licenses.