prompt-enhancer
Prompt engineering and optimization for AI/LLMs. Capabilities: transform unclear prompts, reduce token usage, improve structure, add constraints, optimize for specific models, backward-compatible rewrites. Actions: improve, enhance, optimize, refactor, compress prompts. Keywords: prompt engineering, prompt optimization, token efficiency, LLM prompt, AI prompt, clarity, structure, system prompt, user prompt, few-shot, chain-of-thought, instruction tuning, prompt compression, token reduction, prompt rewrite, semantic preservation. Use when: improving unclear prompts, reducing token consumption, optimizing LLM outputs, restructuring verbose requests, creating system prompts, enhancing prompt clarity.
What this skill does
# Prompt Enhancer Skill
## Purpose
Transform user prompts into enhanced, production-ready versions that are concise, clean, and optimally structured for AI agents and sub-agents. Includes optimization techniques for reducing LLM output token usage while maintaining semantic accuracy and backward compatibility.
## When to Use This Skill
Use this skill when:
- User explicitly asks to improve, enhance, or optimize a prompt
- User sends an unclear, verbose, or poorly structured prompt
- User mentions they want better results from AI interactions
- User asks for help writing prompts for agents or automation
- User's request lacks clarity or proper structure
- User wants to reduce LLM output tokens or API costs
- User needs to optimize JSON schema for token efficiency
- User requests compact output format while maintaining compatibility
## Core Principles
1. **Conciseness**: Remove unnecessary words while preserving intent
2. **Structure**: Use clear formatting with multiple lines and logical sections
3. **XML Integration**: Mix natural text with XML tags for clarity and parsing
4. **Direct Mission**: Main task/quest/mission should NOT be wrapped in XML elements
5. **Clean Output**: Return ONLY the enhanced prompt - no meta-commentary
## Enhancement Process
### Input Analysis
- Identify the core objective
- Extract key requirements and constraints
- Detect ambiguities or missing information
- Recognize the intended agent or use case
### Task-Based Technique Selection (Optional)
Evaluate if the task would benefit from specific prompting techniques:
**Chain-of-Thought (CoT)**
- Use for: Complex reasoning, math problems, logical deduction, step-by-step analysis
- Implementation: Add instruction to "think step by step" or "show your reasoning"
**Chain-of-Draft**
- Use for: Writing tasks, content creation, iterative refinement
- Implementation: Request initial draft, then progressive improvements
**Few-Shot Learning**
- Use for: Pattern-based tasks, specific formatting, consistent outputs
- Implementation: Include 2-3 examples showing input-output pairs
**ReAct (Reasoning + Acting)**
- Use for: Tool use, multi-step tasks, decision-making processes
- Implementation: Combine reasoning traces with action steps
**Self-Consistency**
- Use for: Tasks needing verification, multiple valid approaches
- Implementation: Request multiple solutions, then synthesis
**Tree-of-Thoughts**
- Use for: Complex problem-solving, exploring alternatives
- Implementation: Ask to explore multiple paths before selecting best
**Role-Based Prompting**
- Use for: Domain-specific expertise, perspective-taking
- Implementation: Assign expert role (e.g., "Act as a senior engineer...")
**Least-to-Most Prompting**
- Use for: Breaking down complex problems into subproblems
- Implementation: Start with simpler versions, build up complexity
**Apply technique only if it materially improves the task outcome.**
### LLM Output Token Optimization
When the goal is to reduce output tokens (API costs) while maintaining functionality:
**Core Strategy: Compact Output + Server-Side Remapping**
The LLM generates ultra-compact format, application remaps to original format for clients. This provides:
- Significant token savings (30-60%)
- 100% backward compatibility
- Negligible remapping overhead (<10 microseconds)
**Optimization Techniques:**
**1. Ultra-Compact JSON Keys**
- Replace long keys with 1-2 character abbreviations
- Examples: `queries` → `q`, `keyword` → `kw`, `filter` → `f`, `sort_by` → `s`
- Savings: 70-85% per key
**2. Short Codes for Repeated Values**
- Replace long IDs/enums with short codes (c1-c18, etc.)
- Example: `category=MjUzOTM=` → `c=c4`
- Provide reverse mapping table in application
- Savings: 75-90% on category/enum values
**3. String Compression for Structured Data**
- Use compact string format instead of nested objects when possible
- Example: `[{"filter_by":"category","operator":"=","value":"c4"}]` → `"c=c4"`
- Parse and expand server-side
- Savings: 60-80% on filter/query structures
**4. Omit Default Values**
- Instruct LLM to omit fields with default values
- Application fills in defaults during remapping
- Example: Omit `"sort_by":"relevant"` when it's the default
- Savings: Additional 10-30% when defaults are common
**5. Operator Abbreviation**
- Use shortest form: `p<50000` instead of `price<50000`
- Parse `p`/`c` prefixes during remapping
- Combine with semicolons: `c=c4;p<50000` for multiple filters
**Implementation Pattern:**
```
System Prompt Structure:
1. Define ultra-compact schema with examples
2. Specify key mappings (q=queries, kw=keyword, etc.)
3. Provide short codes table (c1=category1, c2=category2, etc.)
4. Show examples of compact output
5. Emphasize: omit defaults when possible
Application Layer:
1. Parse compact LLM output
2. Expand abbreviated keys
3. Map short codes to full values
4. Fill in default values
5. Return original format to client
```
**Example Transformation:**
**Before Optimization (Original Output):**
```json
{
"queries": [
{"keyword": "milk", "filter": "category=dairy", "sort_by": "relevant"},
{"keyword": "bread", "filter": "category=bakery", "sort_by": "relevant"}
]
}
```
**After Optimization (LLM Output - 60% smaller):**
```json
{
"q": [
{"kw": "milk", "f": "c=c8"},
{"kw": "bread", "f": "c=c3"}
]
}
```
**Client Receives:** Original format (remapped automatically)
**Tradeoffs Analysis:**
✅ **Pros:**
- 30-60% token savings typical
- Lower API costs
- Faster LLM response (less to generate)
- 100% backward compatible
⚠️ **Cons:**
- Remapping overhead (<10μs, negligible)
- More complex implementation
- Requires application-side mapping logic
- Prompt becomes slightly less human-readable
**When to Apply:**
- High-volume API usage (>1000 requests/day)
- Cost-sensitive applications
- Output tokens are >50% of total costs
- Schema is stable and well-defined
- Application can handle remapping logic
**When NOT to Apply:**
- Low-volume usage (<100 requests/day)
- Schema frequently changes
- Human readability is critical
- No application layer (direct LLM → client)
### Structural Improvements
- Break complex requests into clear sections
- Use XML tags for: constraints, examples, context, format requirements
- Keep main mission/task as direct natural language
- Apply logical line breaks for readability
### Language Optimization
- Replace verbose phrases with concise alternatives
- Use active voice and direct instructions
- Eliminate redundancy and filler words
- Maintain specificity while reducing length
## XML Tag Usage Guidelines
**Use XML tags for:**
- `<constraints>` - Limitations and boundaries
- `<examples>` - Sample inputs/outputs
- `<context>` - Background information
- `<format>` - Output structure requirements
- `<requirements>` - Specific criteria to meet
- `<guidelines>` - Best practices to follow
**Do NOT use XML tags for:**
- The primary mission statement
- The main task description
- The core request or question
## Output Format
Return ONLY the enhanced prompt with:
- No conversational lead-in
- No explanations or commentary
- No placeholder text
- No quotation marks wrapping the prompt
- No meta-discussion about the enhancement
## Example Transformations
**Before:**
"I need you to help me write some code for a web app that will let users sign up and log in, and I want it to be secure and use modern best practices, and also it should have a nice UI, maybe you could suggest what framework to use?"
**After:**
Create a secure authentication system for a web application with user registration and login functionality.
<requirements>
- Implement modern security best practices
- Include password hashing and session management
- Design a clean, user-friendly interface
- Provide framework recommendation with rationale
</requirements>
<format>
- Code implementation
- Security considerations
- Framework justification
- UI/UX guidelines
</format>
---
**Before:**
"Can you anRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.