optimize

optimize is a skill for Claude Code from zjchenQAQ/petprompt. It costs 55 tokens per session (369 once invoked), scanned A, original, MIT.

A prompt-cleaning command that rewrites a rough request for clarity and shows the result for review without running it.

In plain words
What is it for?
It helps rewrite prompts when you ask to clean up, optimize, or rephrase them, including requests made with /petprompt:optimize.
Why use it?
It helps remove ambiguity and filler while preserving the original meaning and scope. You can inspect the revised request before giving it to an AI tool.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions CLAUDE.md.

Part of the petprompt plugin — 1 skill, 1 hook shipped together

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/zjchenqaq/petprompt/optimize
Any agent
npx skills add zjchenQAQ/petprompt --skill optimize
Clone the repo
git clone --depth 1 https://github.com/zjchenQAQ/petprompt

Made for: Claude Code.

Or install petprompt, the plugin that ships this one along with the rest of its 1 skill, 1 hook.

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 optimize

README.md
[![agentmods](https://agentmods.dev/badge/skills/zjchenqaq/petprompt/optimize.svg)](https://agentmods.dev/skills/zjchenqaq/petprompt/optimize)
Your own site
<a href="https://agentmods.dev/skills/zjchenqaq/petprompt/optimize"><img src="https://agentmods.dev/badge/skills/zjchenqaq/petprompt/optimize.svg" alt="Measured on agentmods" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 369 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.00055 $0.00369
Opus 5 $0.00028 $0.00185
Sonnet 5 $0.00011 $0.00074
Haiku 4.5 $0.00006 $0.00037

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

Security

Grade A, and why

optimize 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/optimize/SKILL.md · 34 lines

What it actually says

PetPrompt — optimize a prompt (preview mode)

This is the manual, preview counterpart to PetPrompt's hook. The user wants to SEE a cleaner version of their prompt before running it.

When invoked:

  1. Take the user's rough request — their arguments if provided, otherwise their most recent message.
  2. Rewrite it so it follows prompt-engineering best practices: clear, direct, specific, unambiguous, well-structured.

Hard rules — this is a rephrasing, not an expansion:

  • Preserve the meaning, intent, and scope EXACTLY.
  • Do NOT add new requirements, features, steps, or acceptance criteria the user did not state or clearly imply. Do not pad — the result is usually similar length or shorter.
  • Remove hedging, filler, and ambiguity; use precise, imperative phrasing.
  • Use the current conversation and project memory (CLAUDE.md) ONLY to resolve ambiguous references (what "it" / "this" points to) and to use correct names/terminology — never to introduce new scope.
  • If the prompt is already clear, say so and return it unchanged. Keep the user's language.

Output format:

  • Print the rewritten prompt inside a fenced code block so it is easy to copy.
  • Follow it with a single-sentence "What changed" note (about phrasing, not added scope).
  • Do NOT execute the task. This is preview only — wait for the user to run it.
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 · 34 lines · 55 tokens per session scan A 9e06fa0e4993

Subscribe to this mod's changes

optimize is a skill published in the GitHub repository zjchenQAQ/petprompt (2 stars, last pushed 2mo ago), licensed MIT. It adds 55 tokens to every session and 369 once invoked, about $0.0003 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-31.

Related

Other skills, from other repositories