When to ask for a rewrite

Consider requesting a rewrite when:

  • The response is close to what you need but lacks specific details or formatting
  • The output doesn’t fully adhere to the constraints outlined in your initial prompt
  • You are unsure if the result is accurate and want Claude to double check to make sure (consider it a mini one-off LLM-graded eval)

Rewrites are particularly useful when your prompt contains multiple constraints, such as a specific format (e.g., a poem or list) and specific content topics. Sometimes, Claude may prioritize one constraint over another, especially if there are many complex steps to follow. Asking for a rewrite allows you to emphasize the importance of whatever constraints Claude initially missed.

How to request a rewrite

When sending requests through the API (including the functions in Claude for Sheets), you must always include the previously generated text in your prompt. Here’s an example prompt template:

UserHere’s a paragraph:

I’d like you to rewrite it using the following instructions:

Please put your rewrite in <rewrite></rewrite> tags.
Assistant (prefill)<rewrite>

For lower volume use cases, you can paste the paragraph to be rewritten in place of {{PARAGRAPH}}. To automate this process, consider setting up a prompt chain so that Claude’s response to a previous prompt gets substituted for the {{PARAGRAPH}} placeholder.

When using Claude for Sheets, you can structure your Sheet so that each row contains a different set of instructions to be substituted for the {{INSTRUCTIONS}} placeholder. This allows you to generate multiple types of rewrites simultaneously. Check out our Claude for Sheets prompting examples spreadsheet for a sample Sheet structure that demonstrates this and other techniques.

Crafting effective rewrite instructions

To get the most out of Claude’s rewrite capabilities, provide clear and specific instructions that outline your expectations for the revised content. Consider including:

  • The desired format (e.g., paragraph, list, dialogue)
  • The target tone or style (e.g., formal, conversational, humorous)
  • Any additional information or context to include
  • Specific areas of the original response to focus on or modify
  • A rubric for Claude to asses the quality and accuracy of its previous response, and to understand what a high quality result entails

Here’s an example of how you might request a rewrite to emphasize certain constraints:

UserTell me about all the ways I can get fitter.
Assistant (Claude’s response)Here are some ways you can get fitter: [list-style response]
UserRewrite this as a single paragraph of text, focusing on the most effective strategies.
Assistant (Claude’s response)If you’re looking to get fitter, some of the most effective strategies include: [brief paragraph-style response]

By breaking down the prompt into sequential steps and providing targeted rewrite instructions, you can guide Claude to generate output that better meets your specific needs.

A note on fact-checking

If you’re asking Claude to rewrite a response to ensure factual accuracy, consider utilizing the “I don’t know” technique to prevent hallucinations. This approach encourages Claude to acknowledge when it lacks the necessary information to make a correction rather than generating a potentially inaccurate “fix.”

Iterative rewrites

Sometimes, a single rewrite may not be enough to achieve the perfect output. In these cases, consider engaging in an iterative process, requesting multiple revisions based on evolving criteria. With each round of feedback, Claude can learn more about your preferences and refine its responses accordingly.

Remember, the key to successful rewrites is providing clear, actionable guidance. The more specific your instructions, the more likely Claude is to generate content that aligns with your vision.

Additional resources

  • Prompt engineering techniques: Explore other strategies for optimizing your prompts and enhancing Claude’s performance.
  • Anthropic cookbook: Browse a collection of Jupyter notebooks featuring copy-able code snippets that demonstrate highly effective and advanced techniques, integrations, and implementations using Claude.
  • Prompt library: Get inspired by a curated selection of prompts for various tasks and use cases.