dspy-prompt-optimizer

dspy-prompt-optimizer is a skill for Claude Code, Codex from Stijnman/grok-custom-skills. It costs 39 tokens per session (351 once invoked), scanned A, original, MIT.

A prompt-tuning workflow that tests several versions of an instruction and measures their results. It uses reflection to improve the prompt based on failures.

In plain words
What is it for?
Use it to improve prompts, run DSPy tuning, or refine instructions using example inputs, desired outputs, scoring, and before-and-after results.
Why use it?
It removes guesswork from prompt editing by comparing a starting version with alternatives against clear success criteria.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to improve prompts, run DSPy tuning, or refine instructions using example inputs, desired outputs, scoring, and before-and-after results.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/stijnman/grok-custom-skills/dspy-prompt-optimizer
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 Stijnman/grok-custom-skills --skill dspy-prompt-optimizer
Clone the repo
git clone --depth 1 https://github.com/Stijnman/grok-custom-skills

Made for: Claude Code, Codex.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/stijnman/grok-custom-skills/dspy-prompt-optimizer/github.svg)](https://agentmods.dev/skills/stijnman/grok-custom-skills/dspy-prompt-optimizer)
Your own site
<a href="https://agentmods.dev/skills/stijnman/grok-custom-skills/dspy-prompt-optimizer"><img src="https://agentmods.dev/badge/skills/stijnman/grok-custom-skills/dspy-prompt-optimizer/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-prompt-optimizer

Your own site · 80×15
<a href="https://agentmods.dev/skills/stijnman/grok-custom-skills/dspy-prompt-optimizer"><img src="https://agentmods.dev/badge/skills/stijnman/grok-custom-skills/dspy-prompt-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 351 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.
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.00039 $0.00351
Opus 5 $0.00019 $0.00176
Sonnet 5 $0.00008 $0.00070
Haiku 4.5 $0.00004 $0.00035

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

Security

Grade A, and why

dspy-prompt-optimizer 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 11d ago.

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.

.grok/skills/dspy-prompt-optimizer/SKILL.md · 49 lines

What it actually says

DSPy Prompt Optimizer

When to Use

  • User says optimize this prompt or task matches this capability
  • User says dspy tune or task matches this capability
  • User says improve prompt with reflection or task matches this capability

Workflow

  1. Capture baseline prompt and 2-3 example inputs with desired outputs.
  2. Run baseline; score outputs against criteria.
  3. Generate 3 prompt variants addressing failures.
  4. Test variants; pick best by score.
  5. Return optimized prompt with before/after metrics.

Integrations

  • self-refine-loop
  • auto-tester
  • hyper-skill-tester

Error Handling

Failure Response
No examples Ask for 2 input/output pairs minimum.
Overfitting one example Require 3+ diverse examples.

Gotchas

  • Keep prompt under 2000 tokens unless user needs longer.

Example

Input: User request matching triggers above. Output: Structured result per workflow with integrations invoked as needed.

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. 11d ago First seen · 49 lines · 39 tokens per session scan A 2d361b969d8f

Subscribe to this mod's changes

dspy-prompt-optimizer is a skill published in the GitHub repository Stijnman/grok-custom-skills (9 stars, last pushed today), licensed MIT. It adds 39 tokens to every session and 351 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-31.

Related

Other skills, from other repositories

ai-engineering-toolkit

6 production-ready AI engineering workflows: prompt evaluation (8-dimension scoring), context budget planning, RAG pipeline design, agent security audit (65-point checklist), eval harness building, and product sense coaching.

sickn33/agentic-awesome-skills · 47 tokens

guidance

Control LLM output with regex and grammars, guarantee valid JSON/XML/code generation, enforce structured formats, and build multi-step workflows with Guidance - Microsoft Research's constrained generation framework.

davila7/claude-code-templates · 38 tokens

outlines

Guarantee valid JSON/XML/code structure during generation, use Pydantic models for type-safe outputs, support local models (Transformers, vLLM), and maximize inference speed with Outlines - dottxt.ai's structured generation library.

davila7/claude-code-templates · 50 tokens

prompt-master

Generates optimized prompts for AI tools. Activates only when the user explicitly asks to write, fix, improve, or adapt a prompt for a specific AI tool (LLM, Cursor, Midjourney, image AI, video AI, coding agents, etc.). Does not activate for general conversation, coding tasks, document writing, or other…

nidhinjs/prompt-master · 78 tokens

prompt-context-engineer

Transform any rough prompt, request, or idea into a well-structured, context-engineered prompt using Andrej Karpathy's context engineering principles. Use this skill whenever the user asks to improve, rewrite, restructure, optimize, or "engineer" a prompt; mentions prompt engineering or context engineering; pastes a…

pnp/copilot-prompts · 180 tokens

forensic-prompt-compiler

Forensic image-to-prompt compiler for image generation models. Use this skill whenever the user wants to: convert/describe an existing image into a generation prompt, reconstruct a scene as a prompt, generate prompts from reference images for AI image tools (Midjourney, FLUX, Stable Diffusion, DALL-E, or any diffusion…

AnastasiyaW/codex-claude-code-config · 218 tokens