dspy-custom-module-design

Solid

This skill should be used when the user asks to "create custom DSPy module", "design a DSPy module", "extend dspy.Module", "build reusable DSPy component", mentions "custom module patterns", "module serialization", "stateful modules", "module testing", or needs to design production-quality custom DSPy modules with proper architecture, state management, and testing.

Web & Frontend 78 stars 10 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 90/100

Stars 20%
63
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# DSPy Custom Module Design ## Goal Design production-quality custom DSPy modules with proper architecture, state management, serialization, and testing patterns. ## When to Use - Building reusable DSPy components - Complex logic beyond built-in modules - Need custom state management - Sharing modules across projects - Production deployment requirements ## Related Skills - Module composition: [dspy-advanced-module-composition](../dspy-advanced-module-composition/SKILL.md) - Signature design: [dspy-signature-designer](../dspy-signature-designer/SKILL.md) - Optimization: [dspy-miprov2-optimizer](../dspy-miprov2-optimizer/SKILL.md) ## Inputs | Input | Type | Description | |-------|------|-------------| | `task_description` | `str` | What the module should do | | `components` | `list` | Sub-modules or predictors | | `state` | `dict` | Stateful attributes | ## Outputs | Output | Type | Description | |--------|------|-------------| | `custom_module` | `dspy.Module` | Production-ready module | ## Workflow ### Phase 1: Basic Module Structure All custom modules inherit from `dspy.Module`: ```python import dspy class BasicQA(dspy.Module): """Simple question answering module.""" def __init__(self): super().__init__() self.predictor = dspy.Predict("question -> answer") def forward(self, question): """Entry point for module execution.""" return self.predictor(question=question) # Usage dspy.configure(lm=dspy.LM("openai/gpt-4o-m...

Details

Author
OmidZamani
Repository
OmidZamani/dspy-skills
Created
5 months ago
Last Updated
1 weeks ago
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category