prompt-optimizer

prompt-optimizer is a skill for Claude Code, Codex from Ckokoski/AuthorAgent. It costs 20 tokens per session (1,412 once invoked), scanned A, original, MIT.

A system that tests and improves prompts by recording how their outputs perform, including whether users accept or edit them. It uses those results to compare prompt versions and adjust them over time.

In plain words
What is it for?
Use it to track prompts sent to AI providers, record quality signals such as acceptance and instruction-following, run comparisons, and optimize prompts used by skills or tasks.
Why use it?
It replaces guesswork about prompt quality with feedback from actual outputs and user responses. This helps identify prompts that are incomplete, poorly formatted, or regularly edited.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

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/ckokoski/authoragent/prompt-optimizer
Any agent
npx skills add Ckokoski/AuthorAgent --skill prompt-optimizer
Clone the repo
git clone --depth 1 https://github.com/Ckokoski/AuthorAgent

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/ckokoski/authoragent/prompt-optimizer.svg)](https://agentmods.dev/skills/ckokoski/authoragent/prompt-optimizer)
Your own site
<a href="https://agentmods.dev/skills/ckokoski/authoragent/prompt-optimizer"><img src="https://agentmods.dev/badge/skills/ckokoski/authoragent/prompt-optimizer.svg" alt="Measured on agentmods" height="20"></a>
Per session 20 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,412 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00020 $0.01412
Opus 5 $0.00010 $0.00706
Sonnet 5 $0.00004 $0.00282
Haiku 4.5 $0.00002 $0.00141

Measured 6d ago against content hash 124d75bbe4e7, 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 1 finding 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 6d 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.

Asks the agent to reveal its instructionslowSystem prompt leakage

Directions to print, repeat or translate the system prompt extract configuration the operator did not intend to expose.

- `show prompt winners` — See which optimizations have been promoted

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

skills/core/prompt-optimizer/SKILL.md · 182 lines

How it starts

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

Prompt Optimizer — Core Skill

AuthorAgent's prompts are its most important tool. This skill continuously optimizes them based on what actually produces good results — not guesswork, but measured outcomes.

The Problem

Every skill, goal step, and system prompt contains prompts. Some work great. Some produce mediocre results. Without measurement, you're flying blind. The Prompt Optimizer tracks which prompt formulations produce the best outputs and evolves them over time.

How It Works

Prompt Tracking

Every prompt sent to an AI provider is logged with its outcome:

{
  "promptId": "p-347",
  "timestamp": "2026-02-24T15:00:00Z",
  "template": "Write a compelling book blurb for: {{description}}...",
  "skill": "blurb-writer",
  "taskType": "marketing",
  "provider": "gemini",
  "inputTokens": 450,
  "outputTokens": 890,
  "outcome": "accepted",
  "userEdited": false,
  "qualitySignals": {
    "wordCount": 147,
    "completeness": true,
    "followedInstructions": true,
    "userAccepted": true
  }
}

Quality Signals

The optimizer watches for these signals:

Positive signals (prompt is working):

  • User accepted output without edits
  • Output matched requested format/length
  • No follow-up "try again" or "that's not what I meant"
  • User explicitly praised the result
  • Output was saved to a file (user valued it enough to keep)

Negative signals (prompt needs improvement):

  • User heavily edited the output
  • User said "try again" or "not quite"
  • Output was too long/short for the task
  • AI produced an error or refusal
  • Output missed key requirements from the prompt
  • User abandoned the result

Prompt Evolution

When a prompt consistently underperforms, the optimizer creates variations:

Prompt Lab: "blurb-writer" skill
════════════════════════════════

Original (Score: 6.2/10 across 14 uses):
"Write a compelling book blurb for: {{description}}.
Create 3 versions: (1) short tagline, (2) back-cover
blurb (150 words), (3) Amazon description with HTML."

Variation A (Score: 7.8/10 across 6 uses):
"You are a bestselling book marketer. Write a blurb
for: {{description}}.
Rules: Hook in first sentence. No spoilers past Act 1.
End with a question or cliffhanger.
Format: tagline (10 words max), back cover (150 words),
Amazon listing (with <b> tags for emphasis)."

Variation B (Score: 8.1/10 across 4 uses):
"Study these bestselling blurbs for pacing and hooks:
[example 1], [example 2].
Now write a blurb for: {{description}} using the same
techniques. Output: tagline, 150-word back cover,
Amazon description."

→ RECOMMENDATION: Promote Variation B to primary.

Read the full file on GitHub · 182 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. 6d ago First seen · 182 lines · 20 tokens per session scan A 124d75bbe4e7

Subscribe to this mod's changes

prompt-optimizer is a skill published in the GitHub repository Ckokoski/AuthorAgent (103 stars, last pushed 1mo ago), licensed MIT. It adds 20 tokens to every session and 1,412 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (asks the agent to reveal its instructions). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.