ranbot-ai/awesome-skills

llm-prompt-optimizer

Use when improving prompts for any LLM. Applies proven prompt engineering techniques to boost output quality, reduce hallucinations, and cut token usage.

First seen Mar 28, 2026

Installation

$ npx skills add ranbot-ai/awesome-skills --skill llm-prompt-optimizer

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from ranbot-ai/awesome-skills · top by installs.

npx skills add ranbot-ai/awesome-skills

Browse all from ranbot-ai/awesome-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 6
License MIT
Default branch main
Open issues 3
Status Active

Skill metadata

Parsed from SKILL.md frontmatter.

Declared agents antigravity

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 5,457 B
  • docs SUMMARY.md 181 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

LLM Prompt Optimizer

Overview

This skill transforms weak, vague, or inconsistent prompts into precision-engineered instructions that reliably produce high-quality outputs from any LLM (Claude, Gemini, GPT-4, Llama, etc.). It applies systematic prompt engineering frameworks — from zero-shot to few-shot, chain-of-thought, and structured output patterns.

When to Use This Skill

  • Use when a prompt returns inconsistent, vague, or hallucinated results
  • Use when you need structured/JSON output from an LLM reliably
  • Use when designing system prompts for AI agents or chatbots
  • Use when you want to reduce token usage without sacrificing quality
  • Use when implementing chain-of-thought reasoning for complex tasks
  • Use when prompts work on one model but fail on another

Step-by-Step Guide

1. Diagnose the Weak Prompt

Before optimizing, identify which problem pattern applies:

Problem Symptom Fix
Too vague Generic, unhelpful answers Add role + context + constraints
No structure Unformatted, hard-to-parse output Specify output format explicitly
Hallucination Confident wrong answers Add "say I don't know if unsure"
Inconsistent Different answers each run Add few-shot examples
Too long Verbose, padded responses Add length constraints

2. Apply the RSCIT Framework

Every optimized prompt should have:

  • RRole: Who is the AI in this interaction?
  • SSituation: What context does it need?
  • CConstraints: What are the rules and limits?
  • IInstructions: What exactly should it do?
  • TTemplate: What should the output look like?

Before (weak prompt):

Explain machine learning.

After (optimized prompt):

You are a senior ML engineer explaining concepts to a junior developer.

Context: The developer has 1 year of Python experience but no ML background.

Task: Explain supervised machine learning in simple terms.

Constraints:
- Use an analogy from everyday life
- Maximum 200 words
- No mathematical formulas
- End with one actionable next step

Format: Plain prose, no bullet points.

3. Chain-of-Thought (CoT) Pattern

For reasoning tasks, instruct the model to think step-by-step:

Solve this problem step by step, showing your work at each stage.
Only provide the final answer after completing all reasoning steps.

Problem: [your problem here]

Thinking process:
Step 1: [identify what's given]
Step 2: [identify what's needed]
Step 3: [apply logic or formula]
Step 4: [verify the answer]

Final Answer:

4. Few-Shot Examples Pattern

Provide 2-3 examples to establish the pattern:

Classify the sentiment of customer reviews as POSITIVE, NEGATIVE, or NEUTRAL.

Examples:
Review: "This product exceeded my expectations!" -> POSITIVE
Review: "It arrived broken and support was useless." -> NEGATIVE  
Review: "Product works as described, nothing special." -> NEUTRAL

Now classify:
Review: "[your review here]" ->

5. Structured JSON Output Pattern

Extract the following information from the text below and return it as valid JSON only.
Do not include any explanation or markdown — just the raw JSON object.

Schema:
{
  "name": string,
  "email": string | null,
  "company": string | null,
  "role": string | null
}

Text: [input text here]

6. Reduce Hallucination Pattern

Answer the following question based ONLY on the provided context.
If the answer is not contained in the context, respond with exactly: "I don't have enough information to answer this."
Do not make up or infer information not present in the context.

Context:
[your context here]

Question: [your question here]

7. Prompt Compression Techniques

Reduce token count without losing effectiveness:

# Verbose (expensive)
"Please carefully analyze the following code and provide a detailed explanation of 
what it does, how it works, and any potential issues you might find."

# Compressed (efficient, same quality)
"Analyze this code: explain what it does, how it works, and flag any issues."

Best Practices

  • Do: Always specify the output format (JSON, markdown, plain text, bullet list)
  • Do: Use delimiters (```, ---) to separate instructions from content
  • Do: Test prompts with edge cases (empty input, unusual data)
  • Do: Version your system prompts in source control
  • Do: Add "think step by step" for math, logic, or multi-step tasks
  • Don't: Use negative-only instructions ("don't be verbose") — add positive alternatives
  • Don't: Assume the model knows your codebase context — always include it
  • Don't: Use the same prompt across different models without testing — they behave differently

Prompt Audit Checklist

Before using a prompt in production:

  • Does it have a clear role/persona?
  • Is the output format explicitly defined?
  • Are edge cases handled (empty input, ambiguous data)?
  • Is