Soft constraints are flexible guidelines in prompts that AI should follow when possible but can deviate from when necessary. Unlike hard constraints (must/must not), soft constraints use language like 'prefer', 'typically', or 'when possible' — giving AI judgment latitude.
Soft constraints give you the benefits of guidance without the rigidity of absolute rules. They communicate preferences while allowing AI to exercise judgment.
| Hard Constraints | Soft Constraints |
|---|---|
| "Must validate inputs" | "Prefer early returns" |
| "Never use any type" | "Typically under 50 lines" |
| "Always handle errors" | "When possible, use named exports" |
| No flexibility | Judgment allowed |
Style preferences:
Situational guidance:
Quality targets:
Clear preference: "Prefer composition over inheritance"
With exception: "Prefer functional components, unless state management requires class lifecycle methods"
With reasoning: "Typically keep functions under 30 lines (for readability), but prioritize clarity over length"
# Soft Constraints
- Prefer named exports over default exports
- Typically use TypeScript strict mode
- When possible, colocate tests with source files
- Generally avoid comments for obvious code
The right mix gives AI enough guidance to be helpful while enough freedom to be intelligent.