dspy-core

Core DSPy framework guidance — signatures, modules, programs, compilation, and testing. Use when creating DSPy signatures, building modules, compiling programs, or learning DSPy fundamentals.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "dspy-core" with this command: npx skills add qredence/skills/qredence-skills-dspy-core

DSPy Core

Core guidance for working with the DSPy framework: signatures, modules, programs, compilation, and testing.

Environment Setup

This skill requires uv as the Python package manager. Always ensure a uv virtual environment is active before running any DSPy code.

# Create and activate a uv virtual environment
uv venv
source .venv/bin/activate

# Install dspy
uv pip install dspy

Rule: Never use raw pip or python -m pip. Always use uv pip for package installation and uv run for script execution.

Quick Start

Creating a new signature

import dspy

class MySignature(dspy.Signature):
    """Input and output fields with descriptions."""
    input_field = dspy.InputField(desc="Description of input")
    output_field = dspy.OutputField(desc="Description of output")

Compiling a program

# Use the compile-dspy script for safe compilation
uv run scripts/compile-dspy.py --module my_module --teleprompter teleprompter_name

When to Use This Skill

Use this skill when:

  • Creating or modifying DSPy signatures
  • Building new DSPy programs or modules
  • Running DSPy compilation
  • Testing DSPy signatures and programs
  • Learning DSPy fundamentals

Core Concepts

Signatures

DSPy signatures define the input/output contract for your programs. See signatures.md for:

  • Signature design patterns
  • InputField vs OutputField usage
  • Type hints and validation
  • Hint and description best practices

Programs & Modules

DSPy programs are composed of modules that process inputs. See programs.md for:

  • Building DSPy programs
  • Module composition
  • Compilation workflows
  • Chain-of-thought and other patterns

Scripts

  • compile-dspy.py: Compile DSPy modules with proper caching
  • test-signature.py: Validate signature structure and types
  • clear-cache.py: Clear DSPy cache safely

Templates

The assets/templates/ directory provides boilerplate:

  • signature-template.py: Starting point for new signatures
  • program-template.py: Starting point for new programs

Critical Rules

  1. Always use uv: Use uv venv for environment creation, uv pip for installs, and uv run for script execution
  2. Compilation is offline-only: Never compile at runtime in production
  3. Clear cache after changes: Run clear-cache.py after modifying DSPy modules

Related Skills

Progressive Disclosure

  1. SKILL.md (this file): Quick reference and navigation
  2. references/: Detailed technical docs loaded as needed
  3. scripts/: Executable tools (can be run without reading)
  4. assets/: Templates for new work

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

dspy-development

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

agent-converter

No summary provided by upstream source.

Repository SourceNeeds Review
General

dspy-optimization

No summary provided by upstream source.

Repository SourceNeeds Review
General

dspy-gepa

No summary provided by upstream source.

Repository SourceNeeds Review