Back to Library
PromptingBeginner

Use Negative Constraints

Tell Claude what NOT to do. "Do not add comments", "Do not use any external libraries" — negative constraints are just as powerful as positive ones.

constraintsguardrailsfocused-output

The Strategy

Claude's default behavior is often to add comments, import helpers, and explain what it did. Negative constraints prune these default behaviors when you need clean, precise output.

prompt.txt
<task>
Implement a debounce function in plain JavaScript.
</task>

<constraints>
- Do NOT use lodash or any external library
- Do NOT use class syntax
- Do NOT include JSDoc or comments
- DO make it work with TypeScript generics
- DO return the debounced function with a .cancel() method
</constraints>

You might also need