Claude Cookbooks Reference
2025Emma/vibe-coding-cn
Reference of Claude API examples and guides covering tool use, vision, RAG, classification, summarization, text-to-SQL, prompt caching and agent patterns.
Optimize and build programmatic prompt systems with Stanford DSPy.
$ npx skills add magnus919/agent-skills --skill dspy -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install magnus919/agent-skills dspy --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/magnus919/agent-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/dspy .claude/skills/dspy && 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" agent skill from https://github.com/magnus919/agent-skills/tree/main/dspy into .claude/skills/dspy/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dspy", 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/magnus919/agent-skills/tree/main/dspyType 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 magnus919/agent-skills --skill dspy -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install magnus919/agent-skills dspy --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/magnus919/agent-skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/dspy .agents/skills/dspy && 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" agent skill from https://github.com/magnus919/agent-skills/tree/main/dspy into .agents/skills/dspy/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dspy", 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 magnus919/agent-skills --skill dspy -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install magnus919/agent-skills dspy --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/magnus919/agent-skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/dspy .cursor/skills/dspy && 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" agent skill from https://github.com/magnus919/agent-skills/tree/main/dspy into .cursor/skills/dspy/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dspy", 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/magnus919/agent-skills.git --path dspy--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 magnus919/agent-skills --skill dspy -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install magnus919/agent-skills dspy --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/magnus919/agent-skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/dspy .gemini/skills/dspy && 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" agent skill from https://github.com/magnus919/agent-skills/tree/main/dspy into .gemini/skills/dspy/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dspy", 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 magnus919/agent-skills dspyInstalls 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 magnus919/agent-skills --skill dspy -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/magnus919/agent-skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/dspy .github/skills/dspy && 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" agent skill from https://github.com/magnus919/agent-skills/tree/main/dspy into .github/skills/dspy/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dspy", 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 magnus919/agent-skills --skill dspy -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install magnus919/agent-skills dspy --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/magnus919/agent-skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/dspy .opencode/skills/dspy && 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" agent skill from https://github.com/magnus919/agent-skills/tree/main/dspy into .opencode/skills/dspy/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "dspy", 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.
dspyOptimize and build programmatic prompt systems with Stanford DSPy.
Dspy is an agent skill from magnus919/agent-skills. Optimize and build programmatic prompt systems with Stanford DSPy. Signatures, modules (Predict, ChainOfThought, ReAct), optimizer/teleprompter selection, compilation, caching, evaluation. Use when doing programmatic prompt optimization or building compiled prompt programs. Do not use this skill for unrelated requests; route to the nearest named specialist.
Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 19 other files, including scripts and reference files (for example `README.md`, `evals/evals.json` and `references/agent-patterns.md`).
It sits in AI & LLM Engineering, covering Prompt engineering and Caching. It works with React and Python. The repository describes itself as: Curated collection of AI agent skills for Hermes and other agent frameworks. The licence is MIT.
6 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 22b4723. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Ships 1 file in scripts/ (Python), which the agent can run.
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From 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 loads about 2k tokens when it runs, and up to ~7.3k if it reads all its reference files. Until then it costs about 91 tokens; SKILL.md has 696 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); the scripts in this folder are not scanned.
The full file from magnus919/agent-skills at commit 22b4723, republished under its MIT licence (© magnus919). 696 words, ~1,966 tokens.
.claude/skills/dspy/SKILL.md (or your agent's skills folder). This skill also uses 15 other files; get the full folder from GitHub.DSPy is a compiler for prompt programs, not a chain or RAG framework. You write Python programs with typed signatures and DSPy optimizes the prompts automatically.
⚠️ DSPy is NOT a chain framework. It does not use
prompt | model | parser. It does not have LCEL. DSPy operates at a different layer: you define a program with Python control flow and typed signatures, then the compiler optimizes the prompts against a metric. If you reach for DSPy expecting LangChain-style composition, you are reaching for the wrong tool.
Think of it as PyTorch for LMs — you define the architecture, the compiler tunes the weights (prompts).
Read this first. It is the most important thing to understand about DSPy.
import dspy
# 1. Configure the LM
lm = dspy.LM("openai/gpt-4o-mini")
dspy.configure(lm=lm)
# 2. Define a signature (input/output schema)
class QASignature(dspy.Signature):
"""Answer questions concisely."""
question: str = dspy.InputField()
answer: str = dspy.OutputField()
# 3. Build a program using modules
qa = dspy.ChainOfThought(QASignature)
# 4. Compile against a metric
optimizer = dspy.MIPROv2(metric=dspy.answer_exact_match)
compiled_qa = optimizer.compile(qa, trainset=trainset, num_trials=25)
# 5. Use the compiled program (portable artifact)
answer = compiled_qa(question="What is DSPy?").answerDSPy is a compiler, not a chain framework. You define the program structure with Python control flow and typed signatures. The compiler optimizes the prompts. This is fundamentally different from LangChain's explicit prompt composition.
Signatures define the task. Input/output field pairs with optional descriptions are the task definition. The syntax is input1, input2 -> output1, output2.
Modules are program components. dspy.Predict (direct), dspy.ChainOfThought (reasoning), dspy.ReAct (tool-use), and custom dspy.Module subclasses. Compose them with Python control flow (if/for/while).
Optimizers tune prompts, not weights. A dozen optimizers (teleprompters) tune instructions, few-shot demos, or both. Selection depends on bottleneck and budget. See the optimizer cheat sheet.
Compile once, serve many. Compilation is expensive ($3-$300+). The output is a portable artifact via program.save(path). Inference is cheap.
Cache aggressively. DSPy caches all LM calls by default. Set DSPY_CACHEDIR for the current client. Disable with dspy.LM(..., cache=False).
| You already have... | Start here |
|---|---|
| Nothing — exploring DSPy | Understand the paradigm (read this page first), then build a simple Predict program |
| A working prompt you want to optimize | Port to a DSPy Signature, add ChainOfThought, compile with BootstrapFewShot |
| A multi-step pipeline | Build as a custom dspy.Module with Python control flow, compile with MIPROv2 |
| An agent/tool-use task | Use dspy.ReAct with tools, compile with GEPA or AvatarOptimizer |
| Comparing frameworks | See the Framework Routing Guide |
| Task | Approach | Reference |
|---|---|---|
| Basic prediction | dspy.Predict(signature) | references/core-modules.md |
| With reasoning | dspy.ChainOfThought(signature) | references/core-modules.md |
| With tools | dspy.ReAct(tools=tools) | references/agent-patterns.md |
| Custom program | class MyProgram(dspy.Module) | references/program-patterns.md |
| Quick optimization | dspy.BootstrapFewShot(metric) | references/optimizer-guide.md |
| Full optimization | dspy.MIPROv2(metric, auto="medium") | references/optimizer-guide.md |
| Evaluation | dspy.Evaluate(metric=fn, devset=examples) | references/evaluation.md |
| Save/load | program.save(path) / program.load(path) | references/compilation-guide.md |
| Retrieval | dspy.Retrieve(k=5) | references/program-patterns.md |
| Scenario | Reach for | Why |
|---|---|---|
| Prompt optimization / compiled programs | DSPy | Only framework that auto-optimizes prompts against a metric |
| Documents to query / RAG | LlamaIndex | Data ingestion and retrieval are first-class primitives |
| Chain/agent composition | LangChain | LCEL is the cleanest pipe-based composition model |
| State-machine multi-agent | LangGraph | Graph topology, subgraphs, human-in-the-loop |
| Search pipelines | Haystack | Pipeline model is more mature for search workloads |
| Role-based teams | CrewAI | Higher-level agent abstraction |
| Reference | Load when | File |
|---|---|---|
| Core Modules | Building with Predict, ChainOfThought, ReAct | references/core-modules.md |
| Optimizer Guide | Choosing and configuring an optimizer | references/optimizer-guide.md |
| Program Patterns | RAG, classification, multi-step, tool-use | references/program-patterns.md |
| Evaluation | Metrics, evaluation loop, dataset creation | references/evaluation.md |
| Compilation Guide | Caching, cost management, save/load | references/compilation-guide.md |
| Agent Patterns | ReAct agent, tool-use, AvatarOptimizer | references/agent-patterns.md |
| FAQ & Troubleshooting | Common errors and fixes | references/faq-and-troubleshooting.md |
| Validation Audit | Research validation of all API claims | references/validation-audit.md |
| Worked RAG Example | Full RAG compilation with expected output | references/example-rag-compilation.md |
| Template | When to use | File |
|---|---|---|
| Classification | Text classification with BootstrapFewShot | templates/classification.py |
| RAG Program | RAG with ColBERT retrieval and ChainOfThought | templates/rag-program.py |
| Multi-Step Reasoning | Multi-step program with tool-use | templates/multi-step.py |
| Script | Purpose | File |
|---|---|---|
| check-setup | Verify DSPy installation and configuration | scripts/check-setup.py |
| Symptom | Likely cause | Fix | Reference |
|---|---|---|---|
| Compilation too slow | Too many candidates/threads | Reduce num_candidates or use auto="light" | references/optimizer-guide.md |
| Compilation too expensive | No caching | Enable DSPY_CACHEDIR | references/compilation-guide.md |
| Context too long | Too many demos | Reduce max_bootstrapped_demos and max_labeled_demos | references/faq-and-troubleshooting.md |
| Low quality after compile | Wrong optimizer for bottleneck | Check cheat sheet: instructions vs demos vs weights | references/optimizer-guide.md |
| Program is not improving | Metric not discriminating | Use a metric that returns float, not bool | references/evaluation.md |
| Sub-module not updating | _compiled flag set | Set module._compiled = False before recompiling | references/compilation-guide.md |
© magnus919, 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 15 other files (scripts, references) in dspy of magnus919/agent-skills.
Open the folder on GitHubat commit 22b4723
Dspy 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 this skillmagnus919/agent-skills | 115 | — | ~2k | Automated safety check: Pass | MIT | |
| Claude Cookbooks Reference2025Emma/vibe-coding-cn | 23k | 1 repos | ~2.2k | Automated safety check: Pass | MIT | |
| Prompt Engineering Patternswshobson/agents | 40k | — | ~1.3k | Automated safety check: Pass | MIT | |
| Opikcomet-ml/opik-mcp | 220 | — | ~2.1k | Automated safety check: Pass | Apache-2.0 | |
| Flowfile AI Subsystem GuideEdwardvaneechoud/Flowfile | 385 | — | ~9.1k | Automated safety check: Notes | MIT | |
| Guidance Constrained GenerationOrchestra-Research/AI-Research-SKILLs | 13k | 5 repos | ~3.6k | Automated safety check: Pass | MIT |
2025Emma/vibe-coding-cn
Reference of Claude API examples and guides covering tool use, vision, RAG, classification, summarization, text-to-SQL, prompt caching and agent patterns.
wshobson/agents
Reference for designing and tuning production LLM prompts: few-shot examples, chain-of-thought, structured outputs, templates and system prompts.
comet-ml/opik-mcp
Reference for the Opik SDK — tracing, span types, framework integrations, threads, and the prompt library (Python, TypeScript, REST).
Edwardvaneechoud/Flowfile
Maps the /ai/ subsystem of flowfile_core, its three agent tiers, litellm seam, BYOK keys and rate limits, and sets rules for extending or debugging it safely.
Orchestra-Research/AI-Research-SKILLs
Constrains language model output with regex, selections and grammars using the Guidance library, so JSON, XML, code or formatted fields come out valid.
hermes-labs-ai/lintlang
Audit a named AI agent config, system prompt, tool-definition or instruction file (YAML, JSON, Markdown, text, or Python) with the released LintLang CLI, on request.
magnus919/agent-skills
Organize durable agent research outputs as summaries, analysis, and evidence dossiers.
magnus919/agent-skills
Build portable, first-person colored ASCII city engines and small GIS-derived city packs.
magnus919/agent-skills
Manage color workflows with ICC profiles, working spaces, gamut mapping, and color science.
magnus919/agent-skills
A skill your agent uses for PhD-level expertise in data science, statistics, and machine learning: rigorous statistical analysis, experimental design, causal inference, advanced modeling, research…
magnus919/agent-skills
Use Docker Compose to define, run, debug, and harden multi-container applications.
magnus919/agent-skills
Design, review, simulate, and verify FPGA logic using explicit RTL contracts, clock and reset models, CDC analysis, timing constraints, and reproducible implementation evidence.
Categories
Optimize and build programmatic prompt systems with Stanford DSPy. Dspy is an agent skill from magnus919/agent-skills. Optimize and build programmatic prompt systems with Stanford DSPy.
Dspy fits situations like: doing programmatic prompt optimization; building compiled prompt programs; unrelated requests; route to the nearest named specialist.
Run `npx skills add magnus919/agent-skills --skill dspy -a claude-code`. Or copy the skill folder (dspy in magnus919/agent-skills) into .claude/skills/dspy in your project. Claude Code loads it when a task matches its description.
Run `npx skills add magnus919/agent-skills --skill dspy -a codex`. Or copy the skill folder (dspy in magnus919/agent-skills) into .agents/skills/dspy 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 magnus919/agent-skills --skill dspy -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, .gemini/skills/dspy, .github/skills/dspy and .opencode/skills/dspy in your project.
Going by SKILL.md and its folder, Dspy needs Python for the scripts in its folder. Our summary lists: Python 3.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. 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. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.
Dspy is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 2k tokens (SKILL.md is roughly 7.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5.3k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Dspy: Claude Cookbooks Reference (2025Emma/vibe-coding-cn, 23k stars), Prompt Engineering Patterns (wshobson/agents, 40k stars), Opik (comet-ml/opik-mcp, 220 stars) and Flowfile AI Subsystem Guide (Edwardvaneechoud/Flowfile, 385 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
magnus919 (a GitHub user) maintains it in magnus919/agent-skills, which has 115 GitHub stars. The repository holds 131 skills in this directory. The repository was last updated on October 10, 2026.
Source: magnus919/agent-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.