Agent skill · Code Review & Quality

dspy-output-refinement-constraints

This skill should be used when the user asks to "refine DSPy outputs", "enforce constraints", "use dspy.Refine", "select best output", "use dspy.BestOfN", mentions "output validation", "constraint checking", "multi-attempt generation", "reward function", or needs to improve output quality through iterative refinement or best-of-N selection with custom constraints.

majiayu000github.com/majiayu000GitHub ↗
claude-codecan modify filesMIT
Install
npx skills add majiayu000/claude-skill-registry --skill dspy-output-refinement-constraints --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 7 KB
Bundled scripts: none
Version: 1.0.0
Allowed tools: -Read-Write-Glob-Grep
Path: skills/ai-llm/dspy-output-refinement-constraints/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# DSPy Output Refinement & Constraints ## Goal Improve output quality using iterative refinement (dspy.Refine) and best-of-N selection (dspy.BestOfN) with custom constraint validation. ## When to Use - Outputs need format validation (JSON, specific structure) - Length constraints (max tokens, word count) - Content requirements (must include X, avoid Y) - Quality improvement through multiple attempts - Replacing deprecated Assert/Suggest patterns ## Related Skills - Design signatures: [dspy-signature-designer](../dspy-signature-designer/SKILL.md) - Optimize programs: [dspy-miprov2-optimizer](../dspy-miprov2-optimizer/SKILL.md) - Evaluate quality: [dspy-evaluation-suite](../dspy-evaluation-suite/SKILL.md) ## Inputs | Input | Type | Description | |-------|------|-------------| | `module` | `dspy.Module` | Module to refine | | `reward_fn` | `callable` | Constraint validation function | | `N` | `int` | Number of attempts | | `threshold` | `float` | Minimum reward to accept | ## Outputs | Output | Type | Description | |--------|------|-------------| | `refined_output` | `dspy.Prediction` | Validated, refined result | ## Workflow ### Phase 1: dspy.Refine for Iterative Improvement Refine i

What's inside
Steps it walks through
  1. Goal
  2. When to Use
  3. Related Skills
  4. Inputs
  5. Outputs
  6. Workflow
  7. Phase 1: dspy.Refine for Iterative Improvement
  8. Phase 2: dspy.BestOfN for Selection
  9. Phase 3: Multi-Constraint Reward Functions
  10. Production Example
  11. Migration from Assert/Suggest
  12. Best Practices
  13. Limitations
  14. Official Documentation
Ships with 1 file
  • metadata.json
More from claude-skill-registry
All skills →
About this skill
What does the dspy-output-refinement-constraints skill do?

This skill should be used when the user asks to "refine DSPy outputs", "enforce constraints", "use dspy.Refine", "select best output", "use dspy.BestOfN", mentions "output validation", "constraint checking", "multi-attempt generation", "reward function", or needs to improve output quality through iterative refinement or best-of-N selection with custom constraints.

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill dspy-output-refinement-constraints --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going