Agent skill

Prompt Optimizer

by mohitagw15856 in mohitagw15856/pm-claude-skills

Diagnose and rewrite an underperforming LLM prompt so it produces reliable, well-structured output.

MITAuto-check passedAI & LLM Engineering

Install Prompt Optimizer

skills CLI
$ npx skills add mohitagw15856/pm-claude-skills --skill prompt-optimizer -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mohitagw15856/pm-claude-skills prompt-optimizer --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mohitagw15856/pm-claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/prompt-optimizer .claude/skills/prompt-optimizer && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
prompt-optimizer
GitHub stars
1.4k
Token cost
~1.1k tokens
SKILL.md length
570 words
Files
1
Skills in repo
1,348
Repo updated
First seen
Licence
MIT

At a glance

Diagnose and rewrite an underperforming LLM prompt so it produces reliable, well-structured output.

  • Asked to improve a prompt
  • SKILL.md covers Working from a brief, Required Inputs, Output Format and Quality Checks, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Fix a prompt that gives inconsistent

What it does

Prompt Optimizer is an agent skill from mohitagw15856/pm-claude-skills. Diagnose and rewrite an underperforming LLM prompt so it produces reliable, well-structured output. Use when asked to improve a prompt, fix a prompt that gives inconsistent or wrong results, reduce hallucination/refusals, or make output follow a format. Produces a rewritten prompt with a diagnosis of what was failing, the specific changes and why, and a small test set to verify the fix.

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in AI & LLM Engineering, covering Prompt engineering and Structured output and tool calling. The repository describes itself as: 1255 professional Agent Skills for Claude, ChatGPT, Gemini, Cursor & Codex — PRDs, postmortems, leases, medical bills, layoffs, go-bags, new countries. Plain markdown, MIT, in… The licence is MIT.

When your agent uses it

  • Asked to improve a prompt
  • Fix a prompt that gives inconsistent
  • Reduce hallucination/refusals
  • Make output follow a format

Example prompts

  • “/prompt-optimizer”

What it can do on your machine

Read from SKILL.md and the folder at commit 1cbf1f0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Prompt Optimizer loads about 1.1k tokens when it runs. Until then it costs about 102 tokens; SKILL.md has 570 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~102
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from mohitagw15856/pm-claude-skills at commit 1cbf1f0, republished under its MIT licence (© mohitagw15856). 570 words, ~1,059 tokens.

Download SKILL.mdSave it as .claude/skills/prompt-optimizer/SKILL.md (or your agent's skills folder).
name
prompt-optimizer
description
Diagnose and rewrite an underperforming LLM prompt so it produces reliable, well-structured output. Use when asked to improve a prompt, fix a prompt that gives inconsistent or wrong results, reduce hallucination/refusals, or make output follow a format. Produces a rewritten prompt with a diagnosis of what was failing, the specific changes and why, and a small test set to verify the fix.

Prompt Optimizer Skill

A weak prompt fails in patterned ways — vague task, no output contract, buried instructions, no examples, or asking for judgement with nothing to ground it. This skill diagnoses which failure mode is in play and rewrites the prompt to fix it, then hands you a way to check the fix held — so "it's flaky" becomes a specific, testable change rather than another round of fiddling.

Working from a brief

You'll often get just the prompt and a vague "it's not working". Always deliver a full rewrite anyway — infer the intended task and output from the prompt's wording, state your assumptions, and rewrite. If the failing behaviour wasn't described, infer the most likely failure mode from the prompt's structure and say so. Never hand back only a critique with no rewritten prompt.

Required Inputs

Ask for these only if they aren't already provided (else infer and label):

  • The current prompt — the exact text being used.
  • What's going wrong — wrong answers, inconsistent format, refusals, too long/short, hallucinated facts.
  • The desired output — what a perfect response looks like (a sample is ideal).
  • Context — the model/runtime, whether it's one-shot or part of a chain, and any hard constraints (length, JSON, latency).

Output Format

Prompt Diagnosis & Rewrite

1. Diagnosis — the specific failure mode(s), each tied to the line that causes it:

SymptomLikely causeFix applied
Inconsistent formatno explicit output contractadded a schema + example
Hallucinated detailsasked to answer without groundingadded "use only the provided context; say what's unknown"
Ignores an instructionburied mid-paragraphmoved to a numbered rule near the top

2. Rewritten prompt — the full new prompt in a fenced block, ready to paste. Apply the levers that fit: role + task in the first lines, an explicit output contract (structure/schema + a short example), grounding rules ("answer only from X; if unknown, say so"), constraints stated as rules not prose, and 1–3 few-shot examples when the task needs a demonstrated pattern.

3. What changed and why — a short bullet list mapping each edit to the symptom it addresses.

4. Test set — 3–5 concrete inputs (incl. an edge case and a "should refuse / say unknown" case) and the expected output for each, so the user can confirm the rewrite behaves before shipping.

Show full SKILL.md (197 more words)Show less

Quality Checks

  • The rewrite has an explicit output contract (format/schema), not just a description of the task
  • Each change is tied to a specific symptom — no cosmetic edits presented as fixes
  • Grounding/uncertainty is handled (the model is allowed to say "I don't know")
  • Few-shot examples are included only where a pattern must be demonstrated, not by default
  • A test set with at least one edge case and one negative case is provided
  • The prompt is ready to paste — no placeholders left unfilled

Anti-Patterns

  • Do not return a critique without the rewritten prompt — the rewrite is the deliverable
  • Do not pile on every technique at once — apply the levers that match the diagnosed failure, and say why
  • Do not add examples that contradict the instructions — the model copies the example over the rule
  • Do not make the prompt longer when the fix is to make instructions clearer and earlier
  • Do not claim a fix works without a way to test it — ship the test set

Based On

Prompt-engineering practice — explicit output contracts, grounding/uncertainty handling, structured instructions, and example-driven demonstration.

Example Trigger Phrases

  • "Improve a prompt."
  • "Fix a prompt that gives inconsistent."
  • "Reduce hallucination/refusals."
  • "Make output follow a format."

© mohitagw15856, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/prompt-optimizer of mohitagw15856/pm-claude-skills.

Open the folder on GitHubat commit 1cbf1f0

Compare with similar skills

Prompt Optimizer next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Prompt Optimizer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Prompt Optimizer this skillmohitagw15856/pm-claude-skills1.4k—~1.1kAutomated safety check: PassMIT
Prompt Engineering Patternswshobson/agents40k—~1.3kAutomated safety check: PassMIT
Agent Prompt Quality Barmastra-ai/mastra29k—~2kAutomated safety check: PassCustom licence
Kayba Stage 2 Domain Contextkayba-ai/agentic-context-engine2.6k—~1.9kAutomated safety check: PassApache-2.0
Lintlanghermes-labs-ai/lintlang138—~719Automated safety check: PassApache-2.0
Lintlang Audithermes-labs-ai/lintlang138—~1.9kAutomated safety check: PassApache-2.0

Similar skills

  • Reference for designing and tuning production LLM prompts: few-shot examples, chain-of-thought, structured outputs, templates and system prompts.

    40k GitHub stars~1.3k tokensUpdated 5 days ago
    AI & LLM EngineeringAuto-check passed
  • Agent Prompt Quality Bar

    mastra-ai/mastra

    Universal quality bar and final audit rubric for any agent system prompt.

    29k GitHub stars~2k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Kayba Stage 2 Domain Context

    kayba-ai/agentic-context-engine

    Gather domain context about the repository and agent — system prompt, tool definitions, domain docs, and behavior patterns from traces.

    2.6k GitHub stars~1.9k tokensUpdated 15 days ago
    AI & LLM EngineeringAuto-check passed
  • Lintlang

    hermes-labs-ai/lintlang

    A skill your agent uses when writing or reviewing AI agent configs, system prompts, or tool definitions (JSON/YAML/Python) and you need to catch ambiguous tool descriptions, missing stop conditions…

    138 GitHub stars~719 tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Lintlang Audit

    hermes-labs-ai/lintlang

    Audit a named AI agent config, system prompt, tool definition, or instruction file (YAML, JSON, Markdown, text, or Python) with the released LintLang CLI in GitHub Copilot CLI.

    138 GitHub stars~1.9k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Review Huabu Agent

    microsoft/Huabu

    Official

    Review the Huabu operate agent's three steering artifacts at their fixed repo locations — system prompt, tool descriptions, and skills.

    157 GitHub stars~1.2k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed

More from mohitagw15856/pm-claude-skills

All 1,348 skills in this repo
  • Car Tco

    mohitagw15856/pm-claude-skills

    Compare the total cost of car ownership across buy-new, buy-used, lease, and keep-your-current-car — depreciation, insurance, maintenance ramp, and fuel over a real horizon, not just the monthly…

    1.4k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Cs Health Scorecard

    mohitagw15856/pm-claude-skills

    Build a customer health scorecard for a specific account. An agent skill from mohitagw15856/pm-claude-skills.

    1.4k GitHub stars~2.4k tokensUpdated yesterday
    Auto-check passed
  • Exit Waterfall

    mohitagw15856/pm-claude-skills

    Compute who gets what at each exit price from a cap table — liquidation preferences, conversion points, and where the founders' share collapses.

    1.4k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Feature Prioritisation

    mohitagw15856/pm-claude-skills

    Apply prioritisation frameworks (RICE, MoSCoW, Kano, ICE, Opportunity Scoring) to rank features and backlog items.

    1.4k GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • Fire Number

    mohitagw15856/pm-claude-skills

    Compute a financial-independence (FIRE) target and years-to-reach with every assumption labeled as an assumption — plus a sensitivity table instead of a single false-precision answer.

    1.4k GitHub stars~1.1k tokensUpdated yesterday
    Auto-check passed
  • Freelance Rate

    mohitagw15856/pm-claude-skills

    Derive a freelance day/hourly rate backwards from target income, honest billable utilization, overhead, and the self-employment tax premium — the arithmetic that proves a rate is not salary÷2000.

    1.4k GitHub stars~1.2k tokensUpdated yesterday
    Auto-check passed

Questions about Prompt Optimizer

What does Prompt Optimizer do?

Diagnose and rewrite an underperforming LLM prompt so it produces reliable, well-structured output. Prompt Optimizer is an agent skill from mohitagw15856/pm-claude-skills. Diagnose and rewrite an underperforming LLM prompt so it produces reliable, well-structured output.

When should I use Prompt Optimizer?

Prompt Optimizer fits situations like: asked to improve a prompt; fix a prompt that gives inconsistent; reduce hallucination/refusals; make output follow a format.

How do I install Prompt Optimizer in Claude Code?

Run `npx skills add mohitagw15856/pm-claude-skills --skill prompt-optimizer -a claude-code`. Or copy the skill folder (skills/prompt-optimizer in mohitagw15856/pm-claude-skills) into .claude/skills/prompt-optimizer in your project. Claude Code loads it when a task matches its description.

How do I install Prompt Optimizer in Codex?

Run `npx skills add mohitagw15856/pm-claude-skills --skill prompt-optimizer -a codex`. Or copy the skill folder (skills/prompt-optimizer in mohitagw15856/pm-claude-skills) into .agents/skills/prompt-optimizer in your project. Codex loads it when a task matches its description.

Can I use Prompt Optimizer in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mohitagw15856/pm-claude-skills --skill prompt-optimizer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/prompt-optimizer, .gemini/skills/prompt-optimizer, .github/skills/prompt-optimizer and .opencode/skills/prompt-optimizer in your project.

What does Prompt Optimizer need to run?

SKILL.md names no scripts, command-line tools or credentials: Prompt Optimizer is instructions for the agent only.

Does Prompt Optimizer access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Prompt Optimizer safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Prompt Optimizer use?

Prompt Optimizer is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Prompt Optimizer use?

About 1.1k tokens (SKILL.md is roughly 4.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Prompt Optimizer?

Skills that share tags, products or a category with Prompt Optimizer: Prompt Engineering Patterns (wshobson/agents, 40k stars), Agent Prompt Quality Bar (mastra-ai/mastra, 29k stars), Kayba Stage 2 Domain Context (kayba-ai/agentic-context-engine, 2.6k stars) and Lintlang (hermes-labs-ai/lintlang, 138 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Prompt Optimizer?

mohitagw15856 (a GitHub user) maintains it in mohitagw15856/pm-claude-skills, which has 1,433 GitHub stars. The repository holds 1,348 skills in this directory. The repository was last updated on October 8, 2026.

Source: mohitagw15856/pm-claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.