agentsop-prompt-compilation
The compile-readiness gate for prompt auto-optimization. Decide whether you have earned the right to run an optimizer (DSPy MIPROv2 / GEPA / BootstrapFewShot) before spending compute. Two preconditions only — a real metric, and enough examples for the optimizer you picked. Garbage metric in, garbage prompt out. Pick the optimizer by data scale; GEPA inverts the scale assumption (~10 examples + textual feedback).
npx skills add agentsope/SkillAlchemy --skill agentsop-prompt-compilation --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Determines whether you have earned the right to run an optimizer for prompt auto-optimization and which optimizer to use, based on a validated metric and a minimum number of labeled examples. It outputs a go/no-go decision and the selected optimizer configuration.
How it works
- Gate 1 (Metric): Check existence of metric(example, pred, trace=None) and ensure it is human-validated on at least 20 spot-checks (30+ for open-ended). If absent or not validated, STOP and route to metric-design. If present and validated, proceed.
- Gate 2 (Examples): Count labeled examples and compare to the floor for the chosen optimizer. If below floor, STOP or select a lower-floor optimizer. If above floor, proceed.
- If both gates pass, pick an optimizer by data scale and signaled feedback, preferring GEPA when textual feedback exists. Then estimate budget and run a cheap probe with auto="light" before escalation.
- Probe result guides escalation: <2% lift means stop escalation; 2–10% lift may escalate to medium or heavy if data and held-out test criteria are met; final gains should be verified on a held-out test set.
When to use it
Use when: hand-tuned prompts plateau, a metric exists and is human-validated, and there are enough labeled examples for the intended optimizer; you intend to run an optimizer and need to gate the cost and choice.
What it can touch
- Not specified in this section beyond gating logic; workflows defer to [[dspy]] and [[agentsop-dspy]] for implementation details.
Caveats
- Requires a metric that exists and is validated on sufficient spot-checks; without this, the gate stays closed.
- Compilation costs can be high, so the gate exists to prevent spending on unvalidated metrics or insufficient data.
- The optimization cost depends on data scale and chosen optimizer; GEPA can be used with ~10+ examples if textual feedback is available.
# prompt-compilation — The Compile-Readiness Gate > "It's unproductive to launch optimization runs using a poorly designed program or a bad metric." > — DSPy core team [dspy.ai/learn/optimization/overview/] > "Compile when you can measure. The optimizer maximizes your metric — garbage metric in, garbage prompt out." > — this skill's operating principle (synthesized from the line above + DSPy Case C) This is an **enhancement-overlay decision skill**. It answers exactly one question the broad `[[dspy]]` library skill buries under API surface: **have you earned the right to run an optimizer yet, and which one?** It produces a go / no-go gate plus an optimizer pick. It defers *every* implementation detail — Signature syntax, module choice, `compile()` calls, save/deploy — to `[[dspy]]` and the full workflow in `[[agentsop-dspy]]`. It defers metric *construction* to `[[agentsop-metric-design]]`; this skill only checks the metric *exists and is validated*, then uses it as the gate. The trap it removes: people reach for `MIPROv2(auto="heavy")` because the API is right there, before they have a metric worth maximizing or enough data to avoid memorization. Compilation is a hyperparameter se
- 1. 何时激活 (When to Activate)
- 2. 核心心智模型 (Core Mental Model)
- The two-gate picture
- The cost reality (why the gate is worth having)
- 3. SOP (Standard Operating Procedure)
- Gate 1 — Metric (the "can you measure" gate)
- Gate 2 — Examples (the "enough data" gate)
- Step 3 — Pick optimizer by data scale + signal
- Step 4 — Budget
- Step 5 — Probe cheap first
- Step 6 — Decide on the probe result
- 4. 操作模型 (Operations)
- 4.1 — Operation registry (Trigger / Action / Output / Evidence)
- 4.2 — Optimizer-by-data-scale table
What does the agentsop-prompt-compilation skill do?
The compile-readiness gate for prompt auto-optimization. Decide whether you have earned the right to run an optimizer (DSPy MIPROv2 / GEPA / BootstrapFewShot) before spending compute. Two preconditions only — a real metric, and enough examples for the optimizer you picked. Garbage metric in, garbage prompt out. Pick the optimizer by data scale; GEPA inverts the scale assumption (~10 examples + textual feedback).
How do I install it?
Run `npx skills add agentsope/SkillAlchemy --skill agentsop-prompt-compilation --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From agentsope/SkillAlchemy, a repository with 255 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
