/ 目录 / 演练场 / dspy-skills
● 社区 OmidZamani ⚡ 即开即用

dspy-skills

作者 OmidZamani · OmidZamani/dspy-skills

Claude skills pack for DSPy — program language models, optimize prompts, build RAG pipelines systematically.

dspy-skills teaches Claude the DSPy mental model: signatures, modules, predictors, teleprompters, and evaluation loops. Instead of hand-crafting prompts, you describe the task via signatures and let DSPy's optimizers do the work — and Claude writes the DSPy code idiomatically rather than resorting to raw prompt templates.

为什么要用

核心特性

实时演示

实际使用效果

dspy-skill.replay ▶ 就绪
0/0

安装

作者仓库 · Claude Skills 官方文档

使用场景

实战用法: dspy-skills

How to build your first DSPy program and optimize it

👤 ML engineers and applied researchers ⏱ ~90 min advanced

何时使用: You have a task where prompt quality matters and want a systematic way to improve it.

步骤
  1. Define the signature
    Task: classify support tickets into {billing, technical, account}. Give me a DSPy signature and a simple Predict module.✓ 已复制
    → Signature + module code
  2. Write an eval
    Add an evaluation set of 50 labeled examples and an accuracy metric.✓ 已复制
    → Eval harness with metric callable
  3. Optimize
    Run BootstrapFewShot to compile the module against the eval set.✓ 已复制
    → Compiled predictor + improved score

结果: A DSPy-optimized predictor that beats a hand-written prompt, with reproducible code.

注意事项
  • Eval too small — optimizer overfits — Minimum 100–200 examples; hold out a true test set
  • Metric doesn't capture what you care about — Spend on metric design before on model choice
搭配使用: filesystem

Build a RAG pipeline with DSPy

👤 Engineers building retrieval-augmented systems ⏱ ~120 min advanced

何时使用: You want modular, optimizable RAG rather than a hand-wired chain.

步骤
  1. Define the modules
    Create a DSPy RAG pipeline: RetrieveThenRead with ColBERTv2 or a local retriever.✓ 已复制
    → Modular pipeline with separate retrieval and generation
  2. Optimize end-to-end
    Write an eval on our QA set and run MIPRO to improve.✓ 已复制
    → Compiled pipeline with score delta

结果: A RAG pipeline you can improve by changing the eval, not by rewriting prompts.

注意事项
  • Retriever quality caps end-to-end quality — Evaluate retrieval separately (recall@k) before optimizing generation
搭配使用: local-rag

组合

与其他 MCP 搭配,撬动十倍杠杆

dspy-skill + local-rag

Plug a local retriever into DSPy's RAG modules

Swap the ColBERT retriever for a local-rag MCP as the retrieval source.✓ 已复制
dspy-skill + filesystem

Organize DSPy programs, evals, and artifacts in a repo

Lay out a DSPy project with programs/, evals/, and artifacts/ directories.✓ 已复制

工具

此 MCP 暴露的能力

工具输入参数何时调用成本
signature-design task spec Start of any DSPy program 0
module-authoring signatures + flow After signatures 0
teleprompter-optimization module + eval After eval is ready LLM tokens during optimization
evaluation-harness task data Before optimizing 0

成本与限制

运行它的成本

API 配额
LLM tokens dominate during optimization runs
每次调用 Token 数
Can be high — optimizations may invoke the LLM hundreds of times
费用
depends on provider
提示
Use cheap models during teleprompter runs, upgrade only for final evaluation

安全

权限、密钥、影响范围

凭据存储: LLM provider keys in env vars
数据出站: LLM provider endpoints

故障排查

常见错误与修复

Teleprompter seems to make things worse

Check metric correctness; use a held-out set; widen the example pool.

Optimization eats your budget

Cap max_bootstrapped_demos and use cheaper models during search.

替代方案

dspy-skills 对比其他方案

替代方案何时用它替代权衡
prompt-architect-skillYou want prompt-level craft, not DSPy's programmatic approachHand-crafted vs optimized

更多

资源

📖 阅读 GitHub 上的官方 README

🐙 查看未解决的 issue

🔍 浏览全部 400+ MCP 服务器和 Skills