dspy-optimizer-selection

dspy-optimizer-selection is a skill for Claude Code from OmidZamani/dspy-skills. It costs 48 tokens per session (880 once invoked), scanned A, original, MIT.

A guide for choosing among DSPy optimizers, which are tools that search for better instructions, examples, or model settings for a language-model program. It compares options such as few-shot learning, Bayesian search, reflection, and fine-tuning.

In plain words
What is it for?
Use it to select or compare optimizers for adding examples, improving instructions, searching demos, using feedback, combining candidates, or distilling prompts into model weights.
Why use it?
It helps match the optimizer to the available examples, evaluation method, budget, and type of improvement needed. It also recommends establishing a baseline first.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the dspy-skills plugin — 24 skills shipped together

Good fit Use it to select or compare optimizers for adding examples, improving instructions, searching demos, using feedback, combining candidates, or distilling prompts into model weights.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/omidzamani/dspy-skills/dspy-optimizer-selection
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add OmidZamani/dspy-skills --skill dspy-optimizer-selection
Clone the repo
git clone --depth 1 https://github.com/OmidZamani/dspy-skills

Made for: Claude Code.

Or install dspy-skills, the plugin that ships this one along with the rest of its 24 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dspy-optimizer-selection

README.md
[![agentmods](https://agentmods.dev/badge/skills/omidzamani/dspy-skills/dspy-optimizer-selection/github.svg)](https://agentmods.dev/skills/omidzamani/dspy-skills/dspy-optimizer-selection)
Your own site
<a href="https://agentmods.dev/skills/omidzamani/dspy-skills/dspy-optimizer-selection"><img src="https://agentmods.dev/badge/skills/omidzamani/dspy-skills/dspy-optimizer-selection/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for dspy-optimizer-selection

Your own site · 80×15
<a href="https://agentmods.dev/skills/omidzamani/dspy-skills/dspy-optimizer-selection"><img src="https://agentmods.dev/badge/skills/omidzamani/dspy-skills/dspy-optimizer-selection.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 880 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00048 $0.00880
Opus 5 $0.00024 $0.00440
Sonnet 5 $0.00010 $0.00176
Haiku 4.5 $0.00005 $0.00088

Measured 12d ago against content hash f502f7ed4ed1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

dspy-optimizer-selection scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (example.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/dspy-optimizer-selection/SKILL.md · 80 lines

How it starts

The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

  1. Split data into train and validation sets.
  2. Evaluate the uncompiled program with dspy-evaluation-suite.
  3. Start with the least expensive optimizer that matches the need.
  4. Save the compiled program and compare it against the baseline.
  5. 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.

Read the full file on GitHub · 80 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 80 lines · 48 tokens per session scan A f502f7ed4ed1

Subscribe to this mod's changes

dspy-optimizer-selection is a skill published in the GitHub repository OmidZamani/dspy-skills (123 stars, last pushed 2mo ago), licensed MIT. It adds 48 tokens to every session and 880 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.