prompt-optimizer

prompt-optimizer is a skill for Claude Code, Codex from chandrudp29/skillhub. It costs 45 tokens per session (1,129 once invoked), scanned A, original, MIT.

A guide for finding why an instruction to an AI model underperforms and rewriting it for clearer, more consistent answers.

In plain words
What is it for?
Use it to review prompts, identify unclear instructions, set output limits, add examples, and tell the model when to acknowledge uncertainty.
Why use it?
It helps when the model ignores instructions, uses the wrong format, gives uneven answers, or invents facts.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Codex.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/chandrudp29/skillhub/prompt-optimizer
Any agent
npx skills add chandrudp29/skillhub --skill prompt-optimizer
Clone the repo
git clone --depth 1 https://github.com/chandrudp29/skillhub

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for prompt-optimizer

README.md
[![agentmods](https://agentmods.dev/badge/skills/chandrudp29/skillhub/prompt-optimizer.svg)](https://agentmods.dev/skills/chandrudp29/skillhub/prompt-optimizer)
Your own site
<a href="https://agentmods.dev/skills/chandrudp29/skillhub/prompt-optimizer"><img src="https://agentmods.dev/badge/skills/chandrudp29/skillhub/prompt-optimizer.svg" alt="Measured on agentmods" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,129 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00045 $0.01129
Opus 5 $0.00023 $0.00564
Sonnet 5 $0.00009 $0.00226
Haiku 4.5 $0.00005 $0.00113

Measured 5d ago against content hash 5c4bbe61ddc4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

prompt-optimizer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/prompt-optimizer/SKILL.md · 166 lines

How it starts

The opening of the file, as written. The whole thing — 166 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Prompt Optimizer

Diagnoses why a prompt underperforms and rewrites it to be specific, grounded, and consistent.

When to Use

  • Model ignores part of the instructions
  • Outputs vary wildly between runs
  • Responses are too verbose, too vague, or formatted wrong
  • Model "hallucinates" when it should say "I don't know"
  • Chain-of-thought isn't happening when it should

Diagnosis First

Before rewriting, identify the failure mode:

Symptom Likely cause
Ignores formatting instructions Instructions buried in a long prompt
Inconsistent output structure No example provided
Too verbose No length guidance
Hallucinates facts No instruction to acknowledge uncertainty
Misunderstands the task Task description is ambiguous
Ignores constraints Constraints mentioned once, not reinforced

The Anatomy of a Strong Prompt

[Role / Persona]          ← who the model is in this context
[Task definition]         ← exactly what to do
[Context / Input]         ← the data it operates on
[Constraints]             ← what NOT to do, limits, format
[Output format]           ← exact structure of the response
[Example] (optional)      ← one concrete example of good output

Not every prompt needs all sections. A simple prompt doesn't need a persona. A structured extraction task needs an output format and example.

Common Rewrites

Vague → Specific

# Before (vague)
Summarize this text.

# After (specific)
Summarize the following text in exactly 3 bullet points.
Each bullet must be one sentence under 20 words.
Focus only on actionable findings — ignore background context.
If there are no actionable findings, write "No actionable findings."

Text:
{text}

Missing Output Format

# Before
Extract the key information from this job posting.

# After
Extract the following fields from the job posting below.
Return a JSON object with exactly these keys:
{
  "title": "job title",
  "company": "company name",
  "location": "city, country or Remote",
  "salary": "salary range or null if not mentioned",
  "required_skills": ["skill1", "skill2"],
  "years_experience": number or null
}
If a field is not present, use null. Do not add extra fields.

Job posting:
{text}

Read the full file on GitHub · 166 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 166 lines · 45 tokens per session scan A 5c4bbe61ddc4

Subscribe to this mod's changes

prompt-optimizer is a skill published in the GitHub repository chandrudp29/skillhub (13 stars, last pushed 2mo ago), licensed MIT. It adds 45 tokens to every session and 1,129 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

prompt-optimization

Use this skill when the user wants to optimize, modify, or improve the system prompt of an AI agent. This includes requests like 'optimize the prompt', 'make the AI more focused on X', 'change the system prompt', 'improve the agent behavior', or 'modify how the AI responds'.

wecode-ai/Wegent · 62 tokens

standalone-python-scripts

Skill "standalone-python-scripts" from iloveitaly/llm-ide-rules, covering standalone python scripts, /// script, requires-python = ">=3.13", dependencies = [] and ///.

iloveitaly/llm-ide-rules · 9 tokens

tsq-prompt

에이전트/스킬 프롬프트 최적화, 템플릿 관리, 회고 기반 개선 가이드라인. Use when: 프롬프트 작성·수정, 스킬 템플릿 작성, 회고에서 프롬프트 개선 대상이 발견됐을 때, 에이전트 응답 품질이 낮을 때, SKILL.md나 에이전트 .md 파일을 편집할 때.

sonature-lab/timsquad · 99 tokens

prompt-optimizer

Tighten and de-bloat an LLM prompt while preserving intent.

lyupro/skillforge-mcp · 19 tokens

reasoning

AI reasoning authority — prompt engineering, chain-of-thought, self-consistency, evaluation frameworks, LLM judging, structured output, and prompt versioning patterns for production AI systems.

LuuOW/meridian-mcp · 38 tokens

prompt_engineering

Expert guide on prompt engineering for 2024-2025 models (GPT-4o, Claude 3.5, o1, o3, Gemini 2.0). Covers reasoning models, delimiters, structured output, and context engineering.

ApexIQ/skillsmith · 55 tokens