Agent skill
dspy-1-start-simple-then-optimize
Sub-skill of dspy: 1. Start Simple, Then Optimize (+2).
Install this agent skill to your Project
npx add-skill https://github.com/vamseeachanta/workspace-hub/tree/main/.claude/skills/_archive/ai/prompting/dspy/1-start-simple-then-optimize
SKILL.md
1. Start Simple, Then Optimize (+2)
1. Start Simple, Then Optimize
# 1. Start with basic Predict
basic = dspy.Predict("question -> answer")
# 2. Add ChainOfThought if needed
cot = dspy.ChainOfThought("question -> answer")
# 3. Optimize only after baseline is established
optimized = optimizer.compile(cot, trainset=data)
2. Quality Training Data
def create_training_example(question, answer, inputs=["question"]):
"""Create well-formed training example."""
example = dspy.Example(
question=question,
answer=answer
)
return example.with_inputs(*inputs)
# Include diverse examples
trainset = [
create_training_example("Simple question?", "Simple answer"),
create_training_example("Complex technical question?", "Detailed answer..."),
create_training_example("Edge case question?", "Careful handling..."),
]
3. Meaningful Metrics
def comprehensive_metric(example, prediction, trace=None):
"""Combine multiple evaluation dimensions."""
scores = {
"correctness": check_correctness(example, prediction),
"completeness": check_completeness(prediction),
"format": check_format(prediction),
"citations": check_citations(prediction)
}
weights = {"correctness": 0.4, "completeness": 0.3, "format": 0.15, "citations": 0.15}
return sum(scores[k] * weights[k] for k in scores)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-complete-milestone
Archive completed milestone and prepare for next version
gsd-reapply-patches
Reapply local modifications after a GSD update
gsd-verify-work
Validate built features through conversational UAT
gsd-thread
Manage persistent context threads for cross-session work
clinical-trial-protocol
Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.
single-cell-rna-qc
Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations.
Didn't find tool you were looking for?