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
PromptingBeginner
Use XML Tags for Structure
Claude is specifically trained to recognize and parse XML tags to separate instructions from content. Wrapping your prompt in named sections removes ambiguity.
xmlstructureclarity
View snippet
PromptingBeginner
Specify Output Format Explicitly
Tell Claude exactly what structure you want: JSON, Markdown, TypeScript types, numbered lists—avoid post-processing by baking format into the prompt.
jsonformatstructured-output
View snippet