Agent skill
dspy
Compile prompts into self-improving pipelines with signatures, modules, optimizers, and programmatic prompt engineering
Install this agent skill to your Project
npx add-skill https://github.com/vamseeachanta/workspace-hub/tree/main/.claude/skills/ai/prompting/dspy
SKILL.md
Dspy
Quick Start
# Install DSPy
pip install dspy-ai
# Optional: For retrieval
pip install chromadb faiss-cpu
# Set API key
export OPENAI_API_KEY="your-api-key"
When to Use This Skill
USE when:
- Need to optimize prompts programmatically rather than manually
- Building pipelines where prompt quality is critical to success
- Want reproducible, testable prompt engineering
- Working with complex multi-step reasoning tasks
- Need to automatically find effective few-shot examples
- Building systems that improve with more training data
- Require systematic evaluation and comparison of prompt strategies
- Want to abstract away prompt engineering from application logic
DON'T USE when:
- Simple single-shot prompts that work well as-is
- Need fine-grained control over exact prompt wording
- Building applications with minimal LLM interactions
- Prototyping where rapid iteration is more important than optimization
- Resource-constrained environments (optimization requires API calls)
Prerequisites
# Core installation
pip install dspy-ai>=2.4.0
# For vector retrieval
pip install chromadb>=0.4.0 faiss-cpu>=1.7.0
# For different LLM providers
pip install openai>=1.0.0 anthropic>=0.5.0
# For evaluation
pip install pandas>=2.0.0 scikit-learn>=1.0.0
# Environment setup
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
Resources
- DSPy Documentation: https://dspy-docs.vercel.app/
- DSPy GitHub: https://github.com/stanfordnlp/dspy
- DSPy Paper: https://arxiv.org/abs/2310.03714
- Examples: https://github.com/stanfordnlp/dspy/tree/main/examples
Version History
- 1.0.0 (2026-01-17): Initial release with signatures, modules, optimizers, and RAG
Sub-Skills
- 1. Signatures
- 2. Modules
- 3. Retrieval-Augmented Generation
- 4. Optimizers
- 5. Evaluation and Metrics (+1)
- 1. Start Simple, Then Optimize (+2)
- Optimization Not Improving (+2)
Sub-Skills
- DSPy Philosophy
- Example 1: Engineering Report Analysis Pipeline (+2)
- Integration with LangChain (+1)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-complete-milestone
Archive completed milestone and prepare for next version
gsd-reapply-patches
Reapply local modifications after a GSD update
gsd-verify-work
Validate built features through conversational UAT
gsd-thread
Manage persistent context threads for cross-session work
clinical-trial-protocol
Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.
single-cell-rna-qc
Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations.
Didn't find tool you were looking for?