ai-following-rules
Installation
SKILL.md
Make Your AI Follow the Rules
Guide the user through defining and enforcing rules their AI must follow. The key insight: don't ask the AI to follow rules — program constraints that enforce them automatically.
Step 1: Identify your rules
Ask the user:
- What rules does the AI break? (too long? wrong format? forbidden content? missing fields?)
- Which rules are hard requirements vs nice-to-haves? (Refine with threshold vs lower reward weight)
- What should happen when a rule is broken? (retry with feedback, pick best attempt, fail loudly)
Step 2: The two enforcement patterns
DSPy 3.x provides two constraint primitives — dspy.Refine and dspy.BestOfN: