dspy

Build end-to-end LM pipelines with declarative DSPy components and optimizers.

97|8|Updated Mar 20, 2026
One-click install
npx skills add https://github.com/peteromallet/megaplan --skill dspy-peteromallet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dspy
Source: https://github.com/peteromallet/megaplan/tree/main/megaplan/agent/skills/mlops/research/dspy
Command: npx skills add https://github.com/peteromallet/megaplan --skill dspy-peteromallet

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

DSPy provides a declarative, modular framework to build, test, and optimize complex LM systems, reducing manual prompt engineering and boosting reliability.

Core Features & Use Cases

  • Declarative signatures and modular blocks (Predict, ChainOfThought, ReAct, ProgramOfThought) for structured outputs and multi-step reasoning.
  • Built-in optimizers (BootstrapFewShot, MIPRO, COPRO, BootstrapFinetune) to improve prompts, data efficiency, and model performance.
  • End-to-end workflows (RAG, agents, classification, multi-stage pipelines) with traceability and guardrails.

Quick Start

Create a basic QA pipeline and optimize it with BootstrapFewShot on a small trainset, then evaluate on a held-out set.

Frequently Asked Questions about dspy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build declarative LM pipelines for production agent systems?

Build declarative LM pipelines using modular components like Predict, ChainOfThought, and ReAct to structure multi-step reasoning and orchestrate complex agent workflows with type safety and traceability.

What is the best way to automate prompt optimization for AI workloads?

Automate prompt optimization by applying built-in optimizers like BootstrapFewShot, MIPRO, and COPRO to train datasets, which reduces manual prompt engineering and improves model performance reliability.

Can I use declarative programming for RAG and classification tasks?

Declarative programming supports end-to-end RAG, classification, and multi-stage pipelines by using modular signatures and guardrails to simplify complex AI workloads and ensure structured outputs.

Do I need Python and the DSPy library to use these LM pipeline modules?

Yes, you need Python and the DSPy library to utilize modules like ProgramOfThought and automated optimizers for building and testing robust, modular LM systems.

How does declarative AI programming reduce manual prompt engineering?

Declarative AI programming reduces manual prompt engineering by replacing hand-crafted prompts with modular signatures and automated optimizers that iteratively compile and refine LM behavior.

When should I use automated optimizers like BootstrapFinetune in LM systems?

Use automated optimizers like BootstrapFinetune when you need to improve data efficiency and model performance on held-out evaluation sets, moving beyond basic prototyping to robust production systems.