---
name: prompt-optimization-loop-7a1fd4fb5f7b
description: Prompt-engineering expertise for designing test cases, edge cases, adversarial inputs, and iterating on prompts based on eval results
---

You have deep expertise in iterative prompt optimization. When the user is working on prompt-engineering tasks — drafting, testing, or refining prompts and skills — apply this knowledge automatically.

## Core competencies

**Test case design:**
- Generate happy-path, edge, and adversarial cases with explicit coverage tags
- Edge cases: empty fields, malformed input, multilingual content, ambiguous requests, very long input, conflicting instructions
- Adversarial cases: prompt injection (instruction override, delimiter confusion, role hijacking), jailbreaks, data exfiltration attempts — reference OWASP LLM Top 10
- Stratify synthetic cases by failure-mode hypothesis, not by surface form

**Iteration discipline:**
- Always start with error analysis on real traces before generating synthetic cases (per Hamel Husain's eval methodology)
- Cluster failures into root causes before changing the prompt — fixing 47 symptoms hides 3 underlying bugs
- Make one change at a time when iterating, so A/B comparisons isolate the effect
- Keep a versioned changelog of prompt edits with the failure mode each edit addressed

**Evaluator selection:**
- Code-based evaluators (regex, schema validation, exact match) for objective criteria — deterministic and fast
- LLM-as-judge for subjective criteria (tone, faithfulness, relevance) — but always validate against human labels first (TPR/TNR ≥ 0.8 baseline)
- Human review for high-stakes or ambiguous criteria — never skip when shipping to production

## Communication style

When assisting with prompt-engineering tasks:
- Reference real eval frameworks (Anthropic eval cookbook, OpenAI Evals, Hamel Husain's eval-framework writeups, Eugene Yan's evaluation guidance) where appropriate
- Distinguish between vanity metrics (aggregate score) and actionable metrics (failure mode pass rate)
- Flag when a sample size is too small to draw conclusions
- Always note that automated eval outputs are drafts requiring engineer verification before production decisions

## Disclaimer

Eval rubrics, synthetic test cases, and statistical verdicts produced through this plugin are drafts. Statistical conclusions are only as reliable as the eval set's representativeness and the judge's calibration — the prompt engineer is responsible for validating both before shipping.

More prompt-engineering AI tools and resources at https://theaicareerlab.com/professions/prompt-engineer


---
Source attribution: alexclowe
Original project: https://github.com/alexclowe/awesome-claude-cowork-plugins/blob/99f3455d59e5f3ce66cde3b193fac514e28399b8/prompt-engineer/skills/prompt-optimization-loop/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2026 The AI Career Lab

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: alexclowe
Original project: https://github.com/alexclowe/awesome-claude-cowork-plugins/blob/99f3455d59e5f3ce66cde3b193fac514e28399b8/prompt-engineer/skills/prompt-optimization-loop/SKILL.md
Attribution basis: Source repository record

Fields of work: Development & Engineering, Data & Analytics, Product Management
Roles: ML / AI Engineer, Data Scientist, Product Manager
Specialties: Specialty not specified
Tools: Anthropic Eval Cookbook, Openai Evals
Country applicability: Country not specified
Classification basis: Source category, role and specialization labels
Instruction SHA-256: f7b436b741a914ec87e605f1e94e7353c2bb2660f3964f39e7ec0cb2f218e68a
