Claude has a tendancy to respond with generic preambles such as “Here is what you asked for…”, which can disrupt automations.
You can get Claude to eliminate its tendency to respond with generic preamble introductions by getting it to output in XML tags or by prefilling its response. I explain both approaches below.
In the below video, I’m using Make.com but this appraoch should work regardless of how you’re calling Claude via API (either via code or no-code tools).
Removing Unwanted Preambles with XML Tags
The first tip I share is to use XML tags in your prompts to Claude. By instructing Claude to wrap its response in specific XML tags, you can easily extract the relevant content without any unnecessary explanations or introductions.
For example, when creating a Facebook post, you can add the following instruction to your prompt:
“Write your Facebook post inside <Facebook_message> tags. Do not include any other text or explanations outside of these tags.”
This approach ensures that Claude’s response is clean and ready for use in your automation workflow.
Parsing XML Responses in Make.com
If you’re using Make.com, once you have Claude’s response in XML format, you can easily parse it using Make.com’s XML tools. Here’s how:
- Use the “Parse XML” function in Make.com
- Select the text response from Claude as the input
- Extract the content within the specified XML tags
To further refine the output, you can use the trim() function to remove any extra whitespace at the beginning or end of the extracted text.
Pre-filling Responses for Better Structure
The second tip I demonstrate is pre-filling the response structure in your prompt to Claude. This technique involves providing the initial text or tags you want Claude to use in its response.
For example, you can include the opening XML tag in your prompt:
<Facebook_message>
By doing this, you’re guiding Claude to continue its response within the desired structure, making the output even more reliable and consistent.
Adapting the Technique for Different Formats
This pre-filling technique is versatile and can be applied to various output formats, including:
- JSON structures
- HTML tags
- Custom data formats for specific applications
By implementing these tips, you can significantly improve the usability of Claude’s responses in your automated workflows, regardless of whether you’re using code-based or no-code solutions.