npx skills add ...
npx skills add firecrawl/ai-research-skills --skill dspy
Build complex AI systems with declarative programming, optimize prompts automatically, create modular RAG systems and agents with DSPy - Stanford NLP's framework for systematic LM programming
npx skills add firecrawl/ai-research-skills --skill dspy
Use DSPy when you need to:
GitHub Stars: 22,000+ | Created By: Stanford NLP
Signatures define the structure of your AI task (inputs → outputs):
When to use each:
Modules are reusable components that transform inputs to outputs:
Basic prediction module:
Generates reasoning steps before answering:
Agent-like reasoning with tools:
Generates and executes code for reasoning:
Optimizers improve your modules automatically using training data:
Learns from examples:
Iteratively improves prompts:
Creates datasets for model fine-tuning:
| Feature | Manual Prompting | LangChain | DSPy |
|---|---|---|---|
| Prompt Engineering | Manual | Manual | Automatic |
| Optimization | Trial & error | None | Data-driven |
| Modularity | Low | Medium | High |
| Type Safety | No | Limited | Yes (Signatures) |
| Portability | Low | Medium | High |
| Learning Curve | Low | Medium | Medium-High |
When to choose DSPy:
When to choose alternatives:
references/modules.md - Detailed module guide (Predict, ChainOfThought, ReAct, ProgramOfThought)references/optimizers.md - Optimization algorithms (BootstrapFewShot, MIPRO, BootstrapFinetune)references/examples.md - Real-world examples (RAG, agents, classifiers)