skills/dspy-optimizer-selection/SKILL.md
This skill should be used when the user asks to "choose a DSPy optimizer", "compare DSPy optimizers", "which teleprompter should I use", "optimize prompts or weights", mentions LabeledFewShot, BootstrapFewShotWithRandomSearch, KNNFewShot, COPRO, MIPROv2, SIMBA, GEPA, BootstrapFinetune, Ensemble, or BetterTogether, or needs a cost-aware DSPy optimization plan.
npx skillsauth add omidzamani/dspy-skills dspy-optimizer-selectionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Choose the smallest DSPy optimizer that matches the data, budget, and artifact being tuned. Establish a baseline before compiling anything.
| Need | Start with | Notes |
|------|------------|-------|
| Include a few labeled examples | dspy.LabeledFewShot | Random labeled demos; useful as a baseline |
| About 10 examples | dspy.BootstrapFewShot | Teacher-generated demos with metric filtering |
| 50+ examples and stronger demo search | dspy.BootstrapFewShotWithRandomSearch | Searches multiple demo sets; alias: dspy.BootstrapRS |
| Per-input nearest demos | dspy.KNNFewShot | Retrieves nearby examples before bootstrapping |
| Instruction-only hill climbing | dspy.COPRO | Coordinate ascent over instructions |
| Instruction and demo search | dspy.MIPROv2 | Bayesian search; install dspy[optuna] |
| Mini-batch introspective rules or demos | dspy.SIMBA | Uses output variability and self-reflection |
| Rich textual feedback and trace reflection | dspy.GEPA | Metric must accept five arguments |
| Distill prompts into model weights | dspy.BootstrapFinetune | Requires a fine-tunable LM and set_lm() |
| Combine candidate programs | dspy.Ensemble | Trades inference cost for robustness |
| Sequence prompt and weight optimization | dspy.BetterTogether | Meta-optimizer for configurable optimizer chains |
Use dspy-bootstrap-fewshot for the first optimization pass. Move to BootstrapFewShotWithRandomSearch when enough examples are available to search multiple demo sets.
Use dspy-miprov2-optimizer for instruction and demonstration search. Install its optional dependency first:
pip install -U "dspy[optuna]>=3.2.1,<3.3"
Use dspy-gepa-reflective when failures can be described with actionable text. Use dspy-simba-optimizer for a smaller mini-batch introspective loop with numeric metrics.
Use dspy-better-together when a fine-tunable LM is available and prompt optimization alone has plateaued.
tools
This skill should be used when the user asks to "optimize with SIMBA", "use mini-batch introspective optimization", "generate self-reflective rules", mentions "SIMBA optimizer", "stochastic mini-batch ascent", "output variability", or needs an alternative to MIPROv2/GEPA that evolves rules and demonstrations from numeric metrics.
data-ai
This skill should be used when the user asks to "create a DSPy signature", "define inputs and outputs", "design a signature", "use InputField or OutputField", "add type hints to DSPy", mentions "signature class", "type-safe DSPy", "Pydantic models in DSPy", or needs to define what a DSPy module should do with structured inputs and outputs.
development
This skill should be used when the user asks to "use DSPy RLM", "process a very long context", "use ProgramOfThought", "use CodeAct", "run DSPy modules in parallel", mentions Recursive Language Models, sandboxed Python execution, Deno, `dspy.RLM`, `dspy.ProgramOfThought`, `dspy.CodeAct`, or `dspy.Parallel`, or needs to choose a DSPy reasoning module beyond Predict, ChainOfThought, and ReAct.
tools
This skill should be used when the user asks to "create a ReAct agent", "build an agent with tools", "implement tool-calling agent", "use dspy.ReAct", mentions "agent with tools", "reasoning and acting", "multi-step agent", "agent optimization with GEPA", or needs to build production agents that use tools to solve complex tasks.