From samhvw8-dot-claude
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.
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin samhvw8-dot-claudeThis skill uses the workspace's default tool permissions.
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.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
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.
Use this skill when:
Evaluate if the task would benefit from specific prompting techniques:
Chain-of-Thought (CoT)
Chain-of-Draft
Few-Shot Learning
ReAct (Reasoning + Acting)
Self-Consistency
Tree-of-Thoughts
Role-Based Prompting
Least-to-Most Prompting
Apply technique only if it materially improves the task outcome.
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:
Optimization Techniques:
1. Ultra-Compact JSON Keys
queries → q, keyword → kw, filter → f, sort_by → s2. Short Codes for Repeated Values
category=MjUzOTM= → c=c43. String Compression for Structured Data
[{"filter_by":"category","operator":"=","value":"c4"}] → "c=c4"4. Omit Default Values
"sort_by":"relevant" when it's the default5. Operator Abbreviation
p<50000 instead of price<50000p/c prefixes during remappingc=c4;p<50000 for multiple filtersImplementation 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):
{
"queries": [
{"keyword": "milk", "filter": "category=dairy", "sort_by": "relevant"},
{"keyword": "bread", "filter": "category=bakery", "sort_by": "relevant"}
]
}
After Optimization (LLM Output - 60% smaller):
{
"q": [
{"kw": "milk", "f": "c=c8"},
{"kw": "bread", "f": "c=c3"}
]
}
Client Receives: Original format (remapped automatically)
Tradeoffs Analysis:
✅ Pros:
⚠️ Cons:
When to Apply:
When NOT to Apply:
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 followDo NOT use XML tags for:
Return ONLY the enhanced prompt with:
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.
- Implement modern security best practices - Include password hashing and session management - Design a clean, user-friendly interface - Provide framework recommendation with rationale - Code implementation - Security considerations - Framework justification - UI/UX guidelinesBefore: "Can you analyze this data and tell me what's interesting about it and maybe make some charts or visualizations if that would help understand it better and also let me know if there are any trends or patterns?"
After: Analyze the provided dataset and identify key insights, trends, and patterns.
- Highlight statistically significant findings - Identify temporal trends and correlations - Note any anomalies or outliers - Executive summary of findings - Data visualizations (charts/graphs as needed) - Detailed pattern analysis - Actionable recommendationsBefore: "I'm trying to figure out the best pricing strategy for my SaaS product and I'm not sure whether to go with monthly or annual billing or maybe tiered pricing?"
After (with Chain-of-Thought technique applied): Determine the optimal pricing strategy for a SaaS product.
Consider: monthly vs. annual billing, tiered pricing models, market positioning Think step by step: 1. Analyze target customer segments and their payment preferences 2. Evaluate competitor pricing models in the space 3. Calculate unit economics for each pricing option 4. Assess cash flow implications 5. Consider customer lifetime value impact - Provide reasoning for each recommendation - Include pros/cons analysis - Suggest A/B testing approach if applicableBefore: "Write a blog post about AI in healthcare that's engaging and informative"
After (with Chain-of-Draft technique applied): Write an engaging and informative blog post about AI applications in healthcare.
Use iterative drafting: 1. Create outline with key points and narrative arc 2. Draft introduction and conclusion 3. Develop body sections with examples 4. Refine for clarity, flow, and engagement - Target audience: healthcare professionals and tech enthusiasts - Length: 1200-1500 words - Include real-world examples and case studies - Balance technical accuracy with accessibility - Compelling headline - Hook in first paragraph - Clear section headers - Actionable takeawaysBefore (Original Prompt):
Create JSON queries to search for products. Each query should have a keyword, filter with category, and sort_by field. Return in this format: {"queries":[{"keyword":"milk","filter":"category=dairy","sort_by":"relevance"}]}
After (Token-Optimized Prompt):
Generate product search JSON queries. Reject dangerous content.
<rules>
- Each query: ≥1 category filter
- Total: ≥3 keywords (no duplicates)
- Use 'ex' for exact brands/attributes
- Default sort: relevant (omit if default)
- Filter: string format "c=c4" or "c=c4;p<50000"
</rules>
<categories>
c1=household, c2=personal care, c3=bakery, c4=fresh food, c5=oils, c6=dry goods, c7=cleaning, c8=dairy
</categories>
<examples>
"milk vinamilk"→{"q":[{"kw":"milk vinamilk","ex":"vinamilk","f":"c=c8","s":"popular"}]}
"rice noodles meat"→{"q":[{"kw":"rice","f":"c=c6"},{"kw":"noodles","f":"c=c6"},{"kw":"meat","f":"c=c4"}]}
"oranges under 50k"→{"q":[{"kw":"oranges","f":"c=c4;p<50000"}]}
</examples>
Result:
{"q":[{"kw":"milk","f":"c=c8"}]} (60% smaller){"queries":[{"keyword":"milk","filter":"category=dairy","sort_by":"relevance"}]}Before returning the enhanced prompt, verify:
When applying this skill:
The enhanced prompt should be immediately usable by the user without any modifications.