mcpbeat Sign in

Dspy Optimizer Selection Agent Skill

Use to choose or compare DSPy optimizers including LabeledFewShot, BootstrapFewShot, MIPROv2, SIMBA, GEPA, BootstrapFinetune, Ensemble, and BetterTogether.

1k tokens
context cost
the whole folder, loaded on every use
2
files
ships runnable scripts
0
copies elsewhere
how many repositories repackaged it
119
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/OmidZamani/dspy-skills --skill dspy-optimizer-selection

What comes with it

484 bytes besides the instruction
example.py

The instruction itself

11 sections, as written by the author

DSPy Optimizer Selection

Goal

Choose the smallest DSPy optimizer that matches the data, budget, and artifact being tuned. Establish a baseline before compiling anything.

Selection Matrix

| 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 |

Workflow

  • Split data into train and validation sets.
  • Evaluate the uncompiled program with dspy-evaluation-suite.
  • Start with the least expensive optimizer that matches the need.
  • Save the compiled program and compare it against the baseline.
  • Escalate only when the measured gain justifies extra LM calls, fine-tuning, or inference cost.

Common Paths

Fast Demo Optimization

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"

Reflective Optimization

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.

Prompt Plus Weight Optimization

Use dspy-better-together when a fine-tunable LM is available and prompt optimization alone has plateaued.

Best Practices

  • Keep a held-out validation set.
  • Track optimization cost and inference cost separately.
  • Use reproducible seeds where supported.
  • Avoid claiming one optimizer is universally best; compare measured results.
  • Save intermediate candidates for expensive runs.

Official Documentation

  • Optimizer guide: https://dspy.ai/learn/optimization/optimizers/
  • Optimizer API index: https://dspy.ai/api/optimizers/
  • DSPy releases: https://github.com/stanfordnlp/dspy/releases

Other skills for the same job

different authors, same section of the catalogue
Protocolsio Integration
by christophacham
×4

Integration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.

16k tokens
Tailored Resume Generator
by frostant
×4

Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances

3k tokens
Excalidraw Diagram Generator
by github
vendor ×3

Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.

36k tokens scripts
Expo Dev Client
by openai
vendor ×3

Build and distribute Expo development clients locally or via TestFlight

961 tokens
Executing Plans
by ZhanlinCui
×3

Use when you have a written implementation plan to execute in a separate session with review checkpoints

542 tokens
Anndata
by christophacham
×3

Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.

16k tokens
Benchling Integration
by christophacham
×3

Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.

14k tokens
Biopython
by christophacham
×3

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

24k tokens

How to use it

Copy the folder

Take omidzamani/dspy-optimizer-selection from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.

Install what it needs

The instructions reference pip. Without those the skill loads but fails at the first command.