agentleFS
GabrieleDattileGabrieleDattile/agent-superpowers/skills/optimization/prompt-optimizer/SKILL.md

prompt-optimizer

Skill1 starsChanged 15 days agoMITView on GitHub

Systematically optimize, evaluate, and iterate LLM prompts. Use when

74 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use agent-architecture-audit, continuous-agent-loop and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • ronmkrSkill

    agent-architecture-audit

    Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature.

    Also in 3 projects that use this

  • junimnjwSkill

    continuous-agent-loop

    Patterns for continuous autonomous agent loops with quality gates, evals, and recovery controls.

    Also in 3 projects that use this

  • junimnjwSkill

    agent-harness-construction

    Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates.

    Also in 3 projects that use this

  • get-proofpilotSkill

    context-budget

    Audits Claude Code context window consumption across agents, skills, MCP servers, and rules. Identifies bloat, redundant components, and produces prioritized token-savings recommendations.

    Also in 5 projects that use this

  • LangChainSkill

    docker-patterns

    Best practices for Docker containerization and multi-stage builds

    Also in 4 projects that use this

  • royaluniondesign-sysSkill

    deployment-patterns

    Deployment workflows, CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web applications.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 60 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ensure at least one example covers a non-standard or edge-case input.

    line 65
  2. Distinctive:

    Use bullet points and hierarchical markdown headers for high attention retention.

    line 69

“Common” is measured: kept by at least 6 in 10 of the 60 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Prompt Optimizer

A structured framework and toolset for engineering, optimizing, and evaluating LLM system and user prompts to achieve higher determinism, fewer hallucinations, and lower token usage.

Core Capabilities

  1. User Prompt Optimization (optimize-user-prompt):
    • Converts ambiguous user requests into clear, structured, contextual instructions.
    • Decomposes complex multi-part tasks into step-by-step reasoning sequences.
    • Specifies explicit negative constraints (what NOT to do) to eliminate hallucinations.
  2. System Prompt Engineering (optimize-system-prompt):
    • Defines strict persona, role, tone, and operational boundaries.
    • Embeds few-shot input/output examples with realistic edge cases.
    • Enforces deterministic output formats (JSON schemas, Markdown structures).
    • Optimizes instruction density to prevent model attention degradation.
  3. Iterative Prompt Refinement (iterate-prompt):
    • Tests candidate prompts against edge-case inputs.
    • Evaluates outputs against rubric criteria: correctness, conciseness, instruction following, and safety.
    • Performs ablation: trims redundant verbiage while preserving functional semantics.

Systematic Prompt Optimization Workflow

[Input Prompt] ──> [Task Clarification] ──> [Format & Constraint Enforcement]
      │                                                │
      ▼                                                ▼
[Final Prompt] <── [Token Trimming] <── [Few-Shot Exemplar Synthesis]

Step 1: Clarify Intent & Objectives

  • Identify primary goal, target audience/model, and expected input variables.
  • Eliminate vague adjectives ("good", "detailed") in favor of specific criteria ("includes time complexity, 3 test cases").

Step 2: Establish Constraints & Guardrails

  • Positive Instructions: Define exactly what steps the model must execute.
  • Negative Constraints: Explicitly prohibit common model tendencies (e.g., "Do not apologize", "Do not include placeholder comments").
  • Error Handling: Instruct the model on how to handle missing data or ambiguous queries.

Step 3: Few-Shot Exemplar Engineering

  • Include 2-3 high-quality input/output pairs demonstrating desired output formatting and reasoning depth.
  • Ensure at least one example covers a non-standard or edge-case input.

Step 4: Token Optimization

  • Compress repetitive phrasing without changing instruction meaning.
  • Use bullet points and hierarchical markdown headers for high attention retention.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.