skills/ai-kickoff/SKILL.md
Scaffold a new AI feature powered by DSPy. Use when adding AI to your app, starting a new AI project, building an AI-powered feature, setting up a DSPy program from scratch, or bootstrapping an LLM-powered backend. Also used for DSPy quickstart, DSPy hello world, first DSPy program, getting started with DSPy, new to AI development, add AI to existing Python app, AI feature from zero to working, scaffold AI project structure, best practices for AI project setup, where do I even begin with LLMs, AI boilerplate code, starter template for AI features, bootstrap AI backend, simple AI project template, how to structure an AI codebase, AI mvp in a day, proof of concept AI feature, DSPy project structure best practices.
npx skillsauth add lebsral/dspy-programming-not-prompting-lms-skills ai-kickoffInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create a project structure for building an AI-powered feature with DSPy:
$ARGUMENTS/
├── main.py # Entry point — run your AI feature
├── program.py # AI logic (DSPy module)
├── metrics.py # How to measure if the AI is working
├── optimize.py # Make the AI better automatically
├── evaluate.py # Test the AI's quality
├── data.py # Training/test data loading
└── requirements.txt # Dependencies
Ask the user:
requirements.txtdspy>=2.6
Add datasets if loading from HuggingFace. Add provider-specific packages if needed.
data.pyCreate dataset loading utilities:
import dspy
def load_data():
"""Load and prepare training/dev data.
Returns:
tuple: (trainset, devset) as lists of dspy.Example
"""
# TODO: Replace with actual data loading
examples = [
dspy.Example(input_field="...", output_field="...").with_inputs("input_field"),
]
split = int(0.8 * len(examples))
return examples[:split], examples[split:]
Adapt field names to match the user's inputs/outputs.
program.pyCreate the DSPy module. Choose the right module based on the task:
| Task type | Module | When to use |
|-----------|--------|------------|
| Simple extraction or lookup | dspy.Predict | No reasoning needed, lowest cost |
| Needs reasoning | dspy.ChainOfThought | Most tasks — default choice |
| Math or computation | dspy.ProgramOfThought | Counting, dates, calculations |
| Needs external tools | dspy.ReAct | API calls, web search, database access |
import dspy
class MySignature(dspy.Signature):
"""Describe the task here."""
# Adapt fields to user's task
input_field: str = dspy.InputField(desc="description")
output_field: str = dspy.OutputField(desc="description")
class MyProgram(dspy.Module):
def __init__(self):
self.predict = dspy.ChainOfThought(MySignature)
def forward(self, **kwargs):
return self.predict(**kwargs)
metrics.pydef metric(example, prediction, trace=None):
"""Score how good the AI output is.
Args:
example: Expected output (ground truth)
prediction: What the AI actually produced
trace: Optional trace for optimization
Returns:
float: Score between 0 and 1
"""
# TODO: Implement task-specific metric
return prediction.output_field == example.output_field
evaluate.pyimport dspy
from dspy.evaluate import Evaluate
from program import MyProgram
from metrics import metric
from data import load_data
# Configure AI provider
lm = dspy.LM("openai/gpt-4o-mini") # or "anthropic/claude-sonnet-4-5-20250929", etc.
dspy.configure(lm=lm)
# Load data
_, devset = load_data()
# Test quality
program = MyProgram()
evaluator = Evaluate(devset=devset, metric=metric, num_threads=4, display_progress=True)
score = evaluator(program)
print(f"Score: {score}")
optimize.pyimport dspy
from program import MyProgram
from metrics import metric
from data import load_data
# Configure AI provider
lm = dspy.LM("openai/gpt-4o-mini") # or "anthropic/claude-sonnet-4-5-20250929", etc.
dspy.configure(lm=lm)
# Load data
trainset, devset = load_data()
# Automatically improve the AI prompts
program = MyProgram()
optimizer = dspy.BootstrapFewShot(metric=metric, max_bootstrapped_demos=4)
optimized = optimizer.compile(program, trainset=trainset)
# Check improvement
from dspy.evaluate import Evaluate
evaluator = Evaluate(devset=devset, metric=metric, num_threads=4, display_progress=True)
score = evaluator(optimized)
print(f"Optimized score: {score}")
# Save
optimized.save("optimized.json")
main.pyimport dspy
from program import MyProgram
# Configure AI provider
lm = dspy.LM("openai/gpt-4o-mini") # or "anthropic/claude-sonnet-4-5-20250929", etc.
dspy.configure(lm=lm)
# Load optimized version if available
program = MyProgram()
try:
program.load("optimized.json")
print("Loaded optimized program")
except FileNotFoundError:
print("Running unoptimized program")
# Run
result = program(input_field="test input")
print(result)
If the user wants to serve their AI as a web API, add these files to the project structure:
$ARGUMENTS/
├── main.py # Entry point — run your AI feature
├── program.py # AI logic (DSPy module)
├── server.py # FastAPI app — routes and startup
├── models.py # Pydantic request/response schemas
├── config.py # Environment configuration
├── metrics.py # How to measure if the AI is working
├── optimize.py # Make the AI better automatically
├── evaluate.py # Test the AI's quality
├── data.py # Training/test data loading
├── requirements.txt # Dependencies
├── Dockerfile
└── .env.example
server.pyfrom contextlib import asynccontextmanager
import dspy
from fastapi import FastAPI
from pydantic import BaseModel, Field
from program import MyProgram
@asynccontextmanager
async def lifespan(app: FastAPI):
lm = dspy.LM("openai/gpt-4o-mini") # or "anthropic/claude-sonnet-4-5-20250929", etc.
dspy.configure(lm=lm)
app.state.program = MyProgram()
try:
app.state.program.load("optimized.json")
except FileNotFoundError:
pass
yield
app = FastAPI(title="My AI API", lifespan=lifespan)
class QueryRequest(BaseModel):
input_field: str = Field(..., min_length=1)
class QueryResponse(BaseModel):
output_field: str
@app.post("/query", response_model=QueryResponse)
async def query(request: QueryRequest):
result = app.state.program(input_field=request.input_field)
return QueryResponse(output_field=result.output_field)
@app.get("/health")
async def health():
return {"status": "ok"}
Adapt QueryRequest/QueryResponse fields to match the user's inputs/outputs.
requirements.txtdspy>=2.6
fastapi>=0.100
uvicorn[standard]
pydantic-settings>=2.0
.env.exampleAI_MODEL_NAME=openai/gpt-4o-mini
AI_API_KEY=your-api-key-here
After generating the project, tell the user:
data.py with real training data (20+ examples). No real data yet? Use /ai-generating-data to generate synthetic training examples.evaluate.py to see how well the AI works nowoptimize.py to automatically improve qualitymain.py to use the AI.with_inputs() on Example objects. Every dspy.Example used in training must call .with_inputs("field1", "field2") to mark which fields are inputs vs expected outputs. Without this, the optimizer cannot distinguish inputs from labels and silently produces garbage demos.input_field/output_field as placeholders. Claude must rename these to match the user's actual task (e.g., email/category for email classification). Leaving generic names produces a project that runs but confuses the user.dspy.Predict is faster, cheaper, and equally accurate. Only use ChainOfThought when the task genuinely benefits from step-by-step reasoning.return prediction.answer == example.answer which returns True/False. DSPy handles booleans fine, but for weighted or partial-credit metrics, return a float between 0.0 and 1.0.Install any skill:
npx skills add lebsral/DSPy-Programming-not-prompting-LMs-skills --skill <name>
/ai-improving-accuracy/ai-generating-data/ai-serving-apis/dspy-signatures/dspy-chain-of-thought/ai-do if you do not have it — it routes any AI problem to the right skill and is the fastest way to work: npx skills add lebsral/DSPy-Programming-not-prompting-LMs-skills --skill ai-dotools
See what is happening during optimizer.compile() instead of waiting blind. Use when you want to watch optimization progress, see scores as they come in, know if your optimizer is working, check if optimization is stuck, understand why optimization is taking too long, get live progress during compile, monitor convergence, detect overfitting during optimization, interpret optimization results, or pick the right tool for watching optimization. Also used for optimizer progress bar, is my optimizer doing anything, optimization seems stuck, how long will optimization take, watch GEPA run, watch MIPROv2 run, live optimization dashboard, optimizer not improving, scores not going up, optimization taking forever, see what optimizer is doing, debug slow optimization, optimization visibility, optimizer metrics, track compile progress, optimization observability.
testing
Use when you want the highest-quality prompt optimization DSPy offers — jointly optimizes instructions and few-shot demos, with auto=light/medium/heavy presets. Common scenarios - you want the best possible accuracy from prompt optimization, jointly tuning instructions and few-shot demonstrations, using auto presets for different compute budgets, or when COPRO or BootstrapFewShot alone are not reaching your accuracy target. Related - ai-improving-accuracy, dspy-copro, dspy-bootstrap-few-shot. Also used for dspy.MIPROv2, best DSPy optimizer, highest quality optimization, auto=light medium heavy, joint instruction and demo optimization, most powerful prompt optimizer, MIPROv2 vs COPRO vs BootstrapFewShot, which optimizer should I use, state of the art prompt optimization, when to use MIPROv2, optimize both instructions and examples, heavy optimization for production, best optimizer for accuracy.
testing
Use LangWatch for DSPy auto-tracing and real-time optimizer progress. Use when you want to set up LangWatch, langwatch.dspy.init, auto-tracing DSPy, real-time optimization dashboard, optimizer progress tracking, app.langwatch.ai, or DSPy optimizer dashboard. Also used for langwatch setup, pip install langwatch, langwatch trace, optimizer progress, real-time optimization, watch optimizer run, LangWatch self-hosted, langwatch docker, langwatch vs langtrace, langwatch autotrack_dspy.
data-ai
Use when you want to optimize instructions without few-shot examples — a lightweight alternative to COPRO when you do not have or do not want to use demonstrations. Common scenarios - optimizing instructions when you do not have or do not want to use few-shot demonstrations, lightweight instruction search as a first step, tasks where examples in the prompt confuse the model, or when you want fast instruction optimization without the cost of COPRO. Related - ai-improving-accuracy, dspy-copro, dspy-miprov2. Also used for dspy.GEPA, instruction optimization without demos, lightweight prompt optimization, optimize instructions only, no few-shot examples needed, GEPA vs COPRO, quick instruction search, when demonstrations hurt performance, zero-shot optimization, instruction-only optimizer, simplest instruction tuner, fast prompt optimization, skip few-shot and just tune instructions, optimize Pydantic field descriptions, GEPA structured output, GEPA does not optimize field desc.