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.
The two types of rules
DSPy gives you two constraint primitives:
dspy.Assert |
dspy.Suggest |
|
|---|---|---|
| Behavior | Hard stop — retries if violated | Soft nudge — continues if violated |
| Use for | Must-comply rules (format, safety, legal) | Should-comply preferences (style, tone) |
| On failure | LM retries with error feedback | LM gets suggestion, continues |
| PM translation | "This must happen" | "This should happen" |
import dspy