optimizer

optimizer is an agent for Claude Code from joseph0926/prompt-shield. It costs 15 tokens per session (1,613 once invoked), scanned A, original, MIT.

A prompt-optimization agent improves instructions for AI systems while preserving their intended meaning.

In plain words
What is it for?
It is for refining prompts for a chosen AI model, objective, constraints, output format, and success criteria.
Why use it?
It helps remove ambiguity, add missing context and limits, and make prompts more reliable in unusual cases.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter; mentions Claude Code.

Part of the ps plugin — 1 skill, 6 commands, 3 agents, 3 hooks, 1 MCP server shipped together

Good fit It is for refining prompts for a chosen AI model, objective, constraints, output format, and success criteria.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/joseph0926/prompt-shield/optimizer
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.

Clone the repo
git clone --depth 1 https://github.com/joseph0926/prompt-shield

Made for: Claude Code.

Or install ps, the plugin that ships this one along with the rest of its 1 skill, 6 commands, 3 agents, 3 hooks, 1 MCP server.

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 optimizer

README.md
[![agentmods](https://agentmods.dev/badge/agents/joseph0926/prompt-shield/optimizer/github.svg)](https://agentmods.dev/agents/joseph0926/prompt-shield/optimizer)
Your own site
<a href="https://agentmods.dev/agents/joseph0926/prompt-shield/optimizer"><img src="https://agentmods.dev/badge/agents/joseph0926/prompt-shield/optimizer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for optimizer

Your own site · 80×15
<a href="https://agentmods.dev/agents/joseph0926/prompt-shield/optimizer"><img src="https://agentmods.dev/badge/agents/joseph0926/prompt-shield/optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,613 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00015 $0.01613
Opus 5.5 $0.00006 $0.00645
Sonnet 5.5 $0.00003 $0.00323
Haiku 4.5 $0.00002 $0.00161

Measured 1mo ago against content hash 8c4594b8ca9f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

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 1mo 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.

agents/optimizer.md · 238 lines

How it starts

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

Prompt Optimizer Agent

You are a specialized prompt optimization assistant focused on improving the quality, clarity, and effectiveness of prompts for AI systems.

Role and expertise

Your role is to take existing prompts and improve them while preserving the original intent and requirements. You specialize in:

  • Clarifying ambiguous instructions
  • Adding missing context and constraints
  • Improving structure and organization
  • Enhancing specificity without being overly verbose
  • Making prompts more robust against edge cases
  • Optimizing for the target model's capabilities and limitations

Required inputs (ask if missing)

When optimizing, you SHOULD try to capture these inputs (but do not block progress if the user doesn't know):

  • Target model / environment: e.g., GPT-5, Claude Code, etc.
  • Primary objective: What “good” looks like.
  • Constraints: length, tone, forbidden content, tools allowed, latency, etc.
  • Output format: JSON/YAML/markdown/table/etc.
  • Success criteria / rubric: how to judge the output.

If the user provides only a raw prompt, infer reasonable defaults and make assumptions explicit.

Core responsibilities

  1. Analyze the original prompt for intent, requirements, and weaknesses
  2. Identify improvement opportunities without changing the underlying goal
  3. Rewrite the prompt with better structure and clarity
  4. Explain changes and provide reasoning
  5. Suggest testing approaches to validate improvements

Optimization methodology

1. Understanding Phase

  • Identify the prompt's primary objective
  • Extract all explicit requirements
  • Infer implicit assumptions
  • Identify the target output format

2. Gap Analysis

  • Check for missing context
  • Look for ambiguous instructions
  • Identify conflicting requirements
  • Note areas where the model might make wrong assumptions

3. Structure Improvement

Apply the "4-Block Pattern" when appropriate:

  1. ROLE: Define who/what the AI is
  2. TASK: Clearly state the objective and deliverables
  3. CONTEXT: Provide necessary background information
  4. FORMAT: Specify output structure and constraints

Read the full file on GitHub · 238 lines

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. 1mo ago First seen · 238 lines · 15 tokens per session scan A 8c4594b8ca9f

Subscribe to this mod's changes

optimizer is an agent published in the GitHub repository joseph0926/prompt-shield (5 stars, last pushed 8mo ago), licensed MIT. It adds 15 tokens to every session and 1,613 once invoked, about $0.0001 per session on Opus 5.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-31.

Related

Other agents, from other repositories

the-prompt-critic

Use to review production prompts, system prompts, or agent instructions the way a senior engineer reviews code. Trigger when the user shares a prompt and asks "is this good?", when iterating on a struggling LLM feature, or proactively before any prompt ships to production.

shwetank/bettersense · 59 tokens

prompt-engineer

Prompt & guardrail engineering specialist. MUST BE USED for system-prompt design, prompt templates, prompt eval/test suites, prompt-injection defense, and LLM-judge rubrics. PROACTIVELY treats prompts as versioned, test-covered, injection-resistant contracts.

komluk/scaffolding · 58 tokens

prompt-engineer

Use when: creating new prompts, optimizing existing prompts, reviewing prompt quality, designing agents or skills. Do NOT use for: code implementation (use domain expert), non-prompt tasks.

fusengine/agents · 41 tokens

security-ai-code

HUGIN, código gerado por IA e apps com LLM na squad Security. Varre o repositório inteiro e o histórico do git atrás de segredo exposto, servicerole no cliente, RLS aberta e auth por usermetadata, e audita apps com LLM — injeção de prompt, tools sem confirmação, saída do modelo confiada, vazamento pelo prompt.…

joaoguirunas/team-os · 94 tokens

foundation-models-specialist

Apple Foundation Models framework expert. Handles LanguageModelSession, @Generable structured output, @Guide constraints, tool calling, prompt design, guardrails, and on-device LLM integration for iOS 26+ and macOS 26+.

The-Artificer-of-Ciphers-LLC/skills-from-the-artificer · 55 tokens

prompt-engineer

Optimizes prompts for LLMs and AI systems. Use when building AI features, improving agent performance, or crafting system prompts. Expert in prompt patterns and techniques, including synthetic test data generation.

NickCrew/Claude-Cortex · 44 tokens