Dspy Gepa Optimizer
intertwine/dspy-agent-skills
Optimize DSPy programs with dspy.GEPA — a reflective/evolutionary optimizer to consider against task-specific baselines within an authorized evaluation budget.
A skill your agent uses for GEPA optimizeanything on text artifacts such as code, prompts, agent architectures, configs, and non-DSPy optimization targets.
$ npx skills add OmidZamani/dspy-skills --skill dspy-optimize-anything -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install OmidZamani/dspy-skills dspy-optimize-anything --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/OmidZamani/dspy-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/dspy-optimize-anything .claude/skills/dspy-optimize-anything && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "dspy-optimize-anything" agent skill from https://github.com/OmidZamani/dspy-skills/tree/master/skills/dspy-optimize-anything into .claude/skills/dspy-optimize-anything/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dspy-optimize-anything", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/OmidZamani/dspy-skills/tree/master/skills/dspy-optimize-anythingType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add OmidZamani/dspy-skills --skill dspy-optimize-anything -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install OmidZamani/dspy-skills dspy-optimize-anything --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/OmidZamani/dspy-skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/dspy-optimize-anything .agents/skills/dspy-optimize-anything && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "dspy-optimize-anything" agent skill from https://github.com/OmidZamani/dspy-skills/tree/master/skills/dspy-optimize-anything into .agents/skills/dspy-optimize-anything/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dspy-optimize-anything", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add OmidZamani/dspy-skills --skill dspy-optimize-anything -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install OmidZamani/dspy-skills dspy-optimize-anything --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/OmidZamani/dspy-skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/dspy-optimize-anything .cursor/skills/dspy-optimize-anything && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "dspy-optimize-anything" agent skill from https://github.com/OmidZamani/dspy-skills/tree/master/skills/dspy-optimize-anything into .cursor/skills/dspy-optimize-anything/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dspy-optimize-anything", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/OmidZamani/dspy-skills.git --path skills/dspy-optimize-anything--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add OmidZamani/dspy-skills --skill dspy-optimize-anything -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install OmidZamani/dspy-skills dspy-optimize-anything --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/OmidZamani/dspy-skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/dspy-optimize-anything .gemini/skills/dspy-optimize-anything && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "dspy-optimize-anything" agent skill from https://github.com/OmidZamani/dspy-skills/tree/master/skills/dspy-optimize-anything into .gemini/skills/dspy-optimize-anything/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dspy-optimize-anything", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install OmidZamani/dspy-skills dspy-optimize-anythingInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add OmidZamani/dspy-skills --skill dspy-optimize-anything -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/OmidZamani/dspy-skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/dspy-optimize-anything .github/skills/dspy-optimize-anything && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "dspy-optimize-anything" agent skill from https://github.com/OmidZamani/dspy-skills/tree/master/skills/dspy-optimize-anything into .github/skills/dspy-optimize-anything/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dspy-optimize-anything", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add OmidZamani/dspy-skills --skill dspy-optimize-anything -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install OmidZamani/dspy-skills dspy-optimize-anything --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/OmidZamani/dspy-skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/dspy-optimize-anything .opencode/skills/dspy-optimize-anything && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "dspy-optimize-anything" agent skill from https://github.com/OmidZamani/dspy-skills/tree/master/skills/dspy-optimize-anything into .opencode/skills/dspy-optimize-anything/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dspy-optimize-anything", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
dspy-optimize-anythingA skill your agent uses for GEPA optimizeanything on text artifacts such as code, prompts, agent architectures, configs, and non-DSPy optimization targets.
Dspy Optimize Anything is an agent skill from OmidZamani/dspy-skills. Use for GEPA optimizeanything on text artifacts such as code, prompts, agent architectures, configs, and non-DSPy optimization targets.
Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file (for example `example.py`).
The repository describes itself as: Collection of Claude Skills for DSPy framework - program language models, optimize prompts, and build RAG pipelines systematically. The licence is MIT.
4 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit f5db3b7. It shows what the files ask for, not the result of running them.
Pre-approves these tools, so the agent can use them without asking each time:
ReadWriteGlobGrepFrom allowed-tools in the SKILL.md frontmatter.
Ships script files (Python), which the agent can run.
Shell commands in SKILL.md call:
pipFrom the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
gepa-ai.github.iogithub.comFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Dspy Optimize Anything loads about 2.6k tokens when it runs. Until then it costs about 40 tokens; SKILL.md has 464 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from OmidZamani/dspy-skills at commit f5db3b7, republished under its MIT licence (© OmidZamani). 464 words, ~2,567 tokens.
.claude/skills/dspy-optimize-anything/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.Optimize any artifact representable as text — code, prompts, agent architectures, vector graphics, configurations — using a single declarative API powered by GEPA's reflective evolutionary search.
| Input | Type | Description |
|---|---|---|
seed_candidate | str | dict[str, str] | None | Starting artifact text, or None for seedless mode |
evaluator | Callable | Returns score (higher=better), optionally with ASI dict |
dataset | list | None | Training examples (for multi-task and generalization modes) |
valset | list | None | Validation set (for generalization mode) |
objective | str | None | Natural language description of what to optimize for |
background | str | None | Domain knowledge and constraints |
config | GEPAConfig | None | Engine, reflection, and tracking settings |
| Output | Type | Description |
|---|---|---|
result.best_candidate | str | dict | Best optimized artifact |
pip install -U "gepa>=0.1.1,<0.2"The evaluator scores a candidate and returns Actionable Side Information (ASI) — diagnostic feedback that guides the LLM proposer during reflection.
Simple evaluator (score only):
import gepa.optimize_anything as oa
from gepa.optimize_anything import EngineConfig, GEPAConfig
config = GEPAConfig(engine=EngineConfig(max_metric_calls=100))
def evaluate(candidate: str) -> float:
score, diagnostic = run_my_system(candidate)
oa.log(f"Error: {diagnostic}") # captured as ASI
return scoreRich evaluator (score + structured ASI):
def evaluate(candidate: str) -> tuple[float, dict]:
result = execute_code(candidate)
return result.score, {
"Error": result.stderr,
"Output": result.stdout,
"Runtime": f"{result.time_ms:.1f}ms",
}ASI can include open-ended text, structured data, multi-objectives (via scores), or images (via gepa.Image) for vision-capable LLMs.
Mode 1 — Single-Task Search: Solve one hard problem. No dataset needed.
result = oa.optimize_anything(
seed_candidate="<your initial artifact>",
evaluator=evaluate,
config=config,
)Mode 2 — Multi-Task Search: Solve a batch of related problems with cross-transfer.
result = oa.optimize_anything(
seed_candidate="<your initial artifact>",
evaluator=evaluate,
dataset=tasks,
config=config,
)Mode 3 — Generalization: Build a skill/prompt/policy that transfers to unseen problems.
result = oa.optimize_anything(
seed_candidate="<your initial artifact>",
evaluator=evaluate,
dataset=train,
valset=val,
config=config,
)Seedless mode: Describe what you need instead of providing a seed.
result = oa.optimize_anything(
evaluator=evaluate,
objective="Generate a Python function `reverse()` that reverses a string.",
config=config,
)print(result.best_candidate)import gepa.optimize_anything as oa
from gepa import Image
from gepa.optimize_anything import EngineConfig, GEPAConfig
import logging
logger = logging.getLogger(__name__)
# ---------- SVG optimization with VLM feedback ----------
GOAL = "a pelican riding a bicycle"
VLM = "vertex_ai/gemini-3-flash-preview"
VISUAL_ASPECTS = [
{"id": "overall", "criteria": f"Rate overall quality of this SVG ({GOAL}). SCORE: X/10"},
{"id": "anatomy", "criteria": "Rate pelican accuracy: beak, pouch, plumage. SCORE: X/10"},
{"id": "bicycle", "criteria": "Rate bicycle: wheels, frame, handlebars, pedals. SCORE: X/10"},
{"id": "composition", "criteria": "Rate how convincingly the pelican rides the bicycle. SCORE: X/10"},
]
def evaluate(candidate, example):
"""Render SVG, score with a VLM, return (score, ASI)."""
image = render_image(candidate["svg_code"]) # via cairosvg
score, feedback = get_vlm_score_feedback(VLM, image, example["criteria"])
return score, {
"RenderedSVG": Image(base64_data=image, media_type="image/png"),
"Feedback": feedback,
}
result = oa.optimize_anything(
seed_candidate={"svg_code": "<svg>...</svg>"},
evaluator=evaluate,
dataset=VISUAL_ASPECTS,
background=f"Optimize SVG source code depicting '{GOAL}'. "
"Improve anatomy, composition, and visual quality.",
config=GEPAConfig(engine=EngineConfig(max_metric_calls=100)),
)
logger.info(f"Best SVG:\n{result.best_candidate['svg_code']}")
# ---------- Code optimization (single-task) ----------
def evaluate_solver(candidate: str) -> tuple[float, dict]:
"""Evaluate a Python solver for a mathematical optimization problem."""
import subprocess, json
proc = subprocess.run(
["python", "-c", candidate],
capture_output=True, text=True, timeout=30,
)
if proc.returncode != 0:
oa.log(f"Runtime error: {proc.stderr}")
return 0.0, {"Error": proc.stderr}
try:
output = json.loads(proc.stdout)
return output["score"], {
"Output": output.get("solution"),
"Runtime": f"{output.get('time_ms', 0):.1f}ms",
}
except (json.JSONDecodeError, KeyError) as e:
oa.log(f"Parse error: {e}")
return 0.0, {"Error": str(e), "Stdout": proc.stdout}
result = oa.optimize_anything(
evaluator=evaluate_solver,
objective="Write a Python solver for the bin packing problem that "
"minimizes the number of bins. Output JSON with 'score' and 'solution'.",
background="Use first-fit-decreasing as a starting heuristic. "
"Higher score = fewer bins used.",
config=GEPAConfig(engine=EngineConfig(max_metric_calls=100)),
)
print(result.best_candidate)
# ---------- Agent architecture generalization ----------
def evaluate_agent(candidate: str, example: dict) -> tuple[float, dict]:
"""Run an agent architecture on a task and score it."""
exec_globals = {}
exec(candidate, exec_globals)
agent_fn = exec_globals.get("solve")
if agent_fn is None:
return 0.0, {"Error": "No `solve` function defined"}
try:
prediction = agent_fn(example["input"])
correct = prediction == example["expected"]
score = 1.0 if correct else 0.0
feedback = "Correct" if correct else (
f"Expected '{example['expected']}', got '{prediction}'"
)
return score, {"Prediction": prediction, "Feedback": feedback}
except Exception as e:
return 0.0, {"Error": str(e)}
result = oa.optimize_anything(
seed_candidate="def solve(input):\n return input",
evaluator=evaluate_agent,
dataset=train_tasks,
valset=val_tasks,
background="Discover a Python agent function `solve(input)` that "
"generalizes across unseen reasoning tasks.",
config=GEPAConfig(engine=EngineConfig(max_metric_calls=100)),
)
print(result.best_candidate)optimize_anything complements DSPy's built-in optimizers. Use DSPy optimizers (GEPA, MIPROv2, BootstrapFewShot) for DSPy programs, and optimize_anything for arbitrary text artifacts outside DSPy:
import dspy
import gepa.optimize_anything as oa
from gepa.optimize_anything import EngineConfig, GEPAConfig
# DSPy program optimization (use dspy.GEPA)
optimizer = dspy.GEPA(
metric=gepa_metric,
reflection_lm=dspy.LM("openai/gpt-4o"),
auto="medium",
)
compiled = optimizer.compile(agent, trainset=trainset)
# Non-DSPy artifact optimization (use optimize_anything)
result = oa.optimize_anything(
seed_candidate=my_config_yaml,
evaluator=eval_config,
background="Optimize Kubernetes scheduling policy for cost.",
config=GEPAConfig(engine=EngineConfig(max_metric_calls=100)),
)oa.log() — Route prints to the proposer as ASI instead of stdout(score, dict) tuples for multi-faceted diagnosticsobjective= when the solution space is large and unfamiliarbackground= to constrain the searchvalset when the artifact must transfer to unseen inputsgepa.Image to pass rendered outputs to vision-capable LLMsGEPAConfig(engine=EngineConfig(max_metric_calls=...))gepa package (pip install -U "gepa>=0.1.1,<0.2")valset for transfer© OmidZamani, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 1 other file in skills/dspy-optimize-anything of OmidZamani/dspy-skills.
Open the folder on GitHubat commit f5db3b7
Dspy Optimize Anything next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Dspy Optimize Anything this skillOmidZamani/dspy-skills | 123 | — | ~2.6k | Automated safety check: Pass | MIT | |
| Dspy Gepa Optimizerintertwine/dspy-agent-skills | 278 | — | ~2.6k | Automated safety check: Pass | MIT | |
| SQL Optimizationgithub/awesome-copilot | 40k | 2 repos | ~2.3k | Automated safety check: Pass | MIT | |
| Artifacts Buildernexu-io/open-design | 100k | — | ~347 | Automated safety check: Pass | Apache-2.0 | |
| Agent Performance Optimizerruvnet/ruflo | 74k | 2 repos | ~3.6k | Automated safety check: Pass | MIT | |
| Database Optimizerdavila7/claude-code-templates | 33k | 8 repos | ~2.5k | Automated safety check: Pass | MIT |
intertwine/dspy-agent-skills
Optimize DSPy programs with dspy.GEPA — a reflective/evolutionary optimizer to consider against task-specific baselines within an authorized evaluation budget.
github/awesome-copilot
Universal SQL performance optimization assistant for comprehensive query tuning, indexing strategies, and database performance analysis across all SQL databases (MySQL, PostgreSQL, SQL Server…
nexu-io/open-design
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui).
ruvnet/ruflo
Agent skill for performance-optimizer - invoke with $agent-performance-optimizer
davila7/claude-code-templates
Expert database optimizer specializing in modern performance tuning, query optimization, and scalable architectures.
anthropics/skills
Builds multi-component claude.ai HTML artifacts as a small React, TypeScript and Tailwind project, then bundles it into one shareable HTML file.
OmidZamani/dspy-skills
A skill your agent uses when you need to QA audit and fix a plugin skill file.
OmidZamani/dspy-skills
A skill your agent uses for integrating DSPy with Haystack, optimizing Haystack prompts, improving retrieval pipelines, and extracting DSPy prompts.
OmidZamani/dspy-skills
A skill your agent uses for DSPy adapter selection, JSONAdapter, XMLAdapter, ChatAdapter, native function calling, structured outputs, and multimodal inputs like dspy.Image or dspy.Audio.
OmidZamani/dspy-skills
A skill your agent uses for composing DSPy modules with Ensemble, MultiChainComparison, ensemble voting, sequential pipelines, and multi-program workflows.
OmidZamani/dspy-skills
A skill your agent uses for BetterTogether, prompt plus weight optimization, fine-tuning sequences, and strategy chains like p - w - p.
OmidZamani/dspy-skills
A skill your agent uses for BootstrapFewShot, bootstrapped demonstrations, teacher-model demos, and low-data DSPy prompt optimization.
A skill your agent uses for GEPA optimizeanything on text artifacts such as code, prompts, agent architectures, configs, and non-DSPy optimization targets. Dspy Optimize Anything is an agent skill from OmidZamani/dspy-skills. Use for GEPA optimizeanything on text artifacts such as code, prompts, agent architectures, configs, and non-DSPy optimization targets.
Dspy Optimize Anything fits situations like: GEPA optimizeanything on text artifacts such as code; agent architectures; non-DSPy optimization targets.
Run `npx skills add OmidZamani/dspy-skills --skill dspy-optimize-anything -a claude-code`. Or copy the skill folder (skills/dspy-optimize-anything in OmidZamani/dspy-skills) into .claude/skills/dspy-optimize-anything in your project. Claude Code loads it when a task matches its description.
Run `npx skills add OmidZamani/dspy-skills --skill dspy-optimize-anything -a codex`. Or copy the skill folder (skills/dspy-optimize-anything in OmidZamani/dspy-skills) into .agents/skills/dspy-optimize-anything in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add OmidZamani/dspy-skills --skill dspy-optimize-anything -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/dspy-optimize-anything, .gemini/skills/dspy-optimize-anything, .github/skills/dspy-optimize-anything and .opencode/skills/dspy-optimize-anything in your project.
Going by SKILL.md and its folder, Dspy Optimize Anything needs Python for the scripts in its folder and the command-line tools its instructions call (pip). Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Write, Glob, Grep.
SKILL.md names 2 domains. As links in the text: gepa-ai.github.io and github.com. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Dspy Optimize Anything is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Dspy Optimize Anything: Dspy Gepa Optimizer (intertwine/dspy-agent-skills, 278 stars), SQL Optimization (github/awesome-copilot, 40k stars), Artifacts Builder (nexu-io/open-design, 100k stars) and Agent Performance Optimizer (ruvnet/ruflo, 74k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
OmidZamani (a GitHub user) maintains it in OmidZamani/dspy-skills, which has 123 GitHub stars. The repository holds 17 skills in this directory. The repository was last updated on June 23, 2026.
Source: OmidZamani/dspy-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.