Agent skill · software engineering · davila7

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

Why this skill is useful

Adds executable modules and declarative programming patterns for building complex AI systems that the AI cannot generate on its own.

What it needs

Requires dspy installed locally. Requires anthropic, openai account access. About 6k tokens when loaded. Last updated 2026-08-06. 30,138 stars on the source repository.

What this skill does

DSPy: Declarative Language Model Programming When to Use This Skill Use DSPy when you need to: Build complex AI systems with multiple components and workflows Program LMs declaratively instead of manual prompt engineering Optimize prompts automatically using data-driven methods Create modular AI pipelines that are maintainable and portable Improve model outputs systematically with optimizers Build RAG systems, agents, or classifiers with better reliability GitHub Stars: 22,000+ Created By: Stanford NLP Installation Quick Start Basic Example: Question Answering Chain of Thought Reasoning Core Concepts 1. Signatures Signatures define the structure of your AI task (inputs → outputs): When to use each: Inline: Quick prototyping, simple tasks Class: Complex tasks, type hints, better documentation 2. Modules Modules are reusable components that transform inputs to outputs: dspy.Predict Basic prediction module: dspy.ChainOfThought Generates reasoning steps before answering: dspy.ReAct Agent-like reasoning with tools: dspy.ProgramOfThought Generates and executes code for reasoning: 3. Optimizers Optimizers improve your modules automatically using training data: BootstrapFewShot Learns from examples: MIPRO (Most Important Prompt Optimization) Iteratively improves prompts: BootstrapFinetune Creates datasets for model fine-tuning: 4. Building Complex Systems Multi-Stage Pipeline RAG System with Optimization LM Provider Configuration Anthropic Claude OpenAI Local Models (Ollama) Multiple Models Common Patterns Pattern 1: Structured Output Pattern 2: Assertion-Driven Optimization Pattern 3: Self-Consistency Pattern 4: Retrieval with Reranking Evaluation and Metrics Custom Metrics Evaluation Best Practices 1. Start Simple, Iterate 2. Use Descriptive Signatures 3. Optimize with Representative Data 4. Save and Load Optimized Models 5. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills davila7/prompt-engineering-dspy

View the source on GitHub

Browse the @skills marketplace