Rewrite CS macros to one style guide and banned-word list
Standardize customer support canned responses to a unified style guide and banned-word list while verifying variable preservation with Python.
When 30 customer support macros have conflicting greetings and abrupt phrasing across different agents, customer trust erodes. Asking an LLM to rewrite responses often results in corrupted placeholder variables like {order_id} or {item_name}, or leaves prohibited phrasing intact. Structuring the prompt around constructive instructions rather than mere negative bans, and validating placeholders with a verification script, standardizes the entire set reliably. For matching terminology across drafts, see glossary consistency checking.
[1] Prepare the 30 support macros and the tone guide. In a virtual pet supply store ("PawStore"), support macros contained mixed greetings ("Dear buyer", "Hey there", "Customer", "Sir/Madam", "Pet parent") and abrupt phrasing. The 10 prohibited phrases targeted for replacement are: "obviously", "you must", "your fault", "no refunds", "impossible", "calm down", "as I said", "policy is policy", "not our problem", and "don't blame us".
You are a customer support quality assurance expert.Rewrite the following 30 customer support macros ([M-01] to [M-30]) for a virtual pet supply store ("PawStore") according to the style guide and transformation rules below. [Transformation Rules]1. Standard Greeting: Unify all greeting styles ("Hey guys", "Dear buyer", "Valued customer", "Customer", "Sir/Madam", "Friend", "Pet parent"). If the original macro contains {customer_name}, use "Hello {customer_name},". If the original macro does NOT contain {customer_name}, use "Hello," without adding new variable placeholders.2. Professional and Courteous Tone: Use a polite, supportive, professional tone across all macros. Avoid abrupt imperatives, slang, or emotional language.3. Replace Banned Phrases with Constructive Alternatives: - "obviously" -> "as noted" or "per our records" - "you must" -> "please ensure you" or "we kindly ask you to" - "your fault" -> "during personal handling" or "due to customer usage" - "no refunds" -> "we are unable to process a refund" - "impossible" -> "we cannot accommodate this request" or "is currently unavailable" - "calm down" -> "we understand your concern" or "we appreciate your patience" - "as I said" -> "to reconfirm" or "as previously shared" - "policy is policy" -> "per our store return policy" - "not our problem" -> "falls outside our warranty coverage" - "don't blame us" -> "we apologize for any inconvenience caused"4. Protect Variable Placeholders: Every curly-bracket placeholder (such as {order_id}, {item_name}, {tracking_number}, {carrier}, {payment_amount}, {refund_amount}, {restock_date}, {points_balance}, {deduction_amount}, {ticket_number}) must be preserved exactly as written. Do NOT invent new variables or delete existing ones.5. Output Format: Keep the identifier code ([M-01] to [M-30]) at the beginning of each line. Output only the rewritten macro text, one paragraph per macro. Do not add conversational filler, intros, or summaries. [Few-Shot Examples][EX-01]Original: [EX-01] Hey friend, shipping for your {item_name} ({order_id}) is delayed. Obviously courier strikes made it impossible to deliver this week, calm down.Rewritten: [EX-01] Hello, we are writing to update you on your order {order_id} ({item_name}). Due to unexpected courier service disruptions, delivery is currently delayed this week. We understand your concern and sincerely appreciate your patience. [EX-02]Original: [EX-02] Dear buyer, you opened the pet food package so no refunds. Policy is policy and you must pay return shipping.Rewritten: [EX-02] Hello, regarding your order, opened pet food items cannot be accepted for return per our store return policy. For eligible unopened items, please ensure you cover return postage as outlined in our guidelines. [30 Macros to Rewrite][M-01] Dear buyer, your payment for {item_name} (Order ID: {order_id}) is confirmed. Same-day dispatch cutoff is 3 PM, obviously don't blame us if you ordered late.[M-02] Customer, your order {item_name} has shipped via {carrier}. Tracking number is {tracking_number}. Tracking updates will appear by tonight.…[M-30] Valued member, as I said earlier, there was a typo in your tracking number. The correct tracking code with {carrier} is {tracking_number}.[2] Run the prompt without workspace or global instructions interfering with the output.
$ claude -p --model claude-sonnet-5-5 --max-turns 1 --tools "" --setting-sources "" --strict-mcp-config < run/rewrite_macros_en_v2.prompt.txt > run/rewrite_macros_en_v2.out.txt[3] Review the raw model output. All 30 macro IDs are preserved and each message has been converted to professional phrasing.
[M-01] Hello, your payment for {item_name} (Order ID: {order_id}) has been confirmed. As noted, our same-day dispatch cutoff is 3 PM, and we apologize for any inconvenience caused if an order is placed after this time.[M-02] Hello, your order {item_name} has shipped via {carrier}. Your tracking number is {tracking_number}, and tracking updates will appear by tonight.…[M-08] Hello, to exchange sizes for {item_name}, we kindly ask you to transfer the return shipping fee to our account before we process the exchange.…[M-12] Hello, because the seal on the pet treats has been broken, we are unable to process a refund per our store return policy. We appreciate your understanding.…[M-30] Hello, to reconfirm, there was a typo in the tracking number previously provided. The correct tracking code with {carrier} is {tracking_number}.[4] Write a Python verification script. It checks three things: whether any of the 10 banned phrases remains in a rewrite (case-insensitive), whether the list of {…} placeholders in each rewrite equals the one in the original, in order, and whether one of the old greetings remains. It also counts the macros. It does not judge tone or whether a replacement phrase fits the sentence, and it only finds the exact banned strings.
import re, sys BANNED = ["obviously", "you must", "your fault", "no refunds", "impossible", "calm down", "as I said", "policy is policy", "not our problem", "don't blame us"]GREETINGS = [r"\bDear buyer\b", r"\bValued (member|customer)\b", r"\bSir/Madam\b", r"\bPet parent\b", r"\bHey (there|friend|guys)\b", r"^Customer\b"]VAR = r"\{[^{}]+\}" def parse(path): macros, cur = {}, None for line in open(path, encoding="utf-8"): m = re.match(r"\[(M-\d{2})\]\s*(.*)", line.strip()) if m: cur = m[1] if cur in macros: print(f"duplicate id {cur}") macros[cur] = m[2] elif cur and line.strip(): macros[cur] += " " + line.strip() return macros orig, rev = parse(sys.argv[1]), parse(sys.argv[2])banned, var, greet = [], [], []for mid in (f"M-{i:02d}" for i in range(1, 31)): t, o = rev.get(mid, ""), orig.get(mid, "") banned += [(mid, b) for b in BANNED if b.lower() in t.lower()] if re.findall(VAR, o) != re.findall(VAR, t): var.append((mid, re.findall(VAR, o), re.findall(VAR, t))) greet += [(mid, g) for g in GREETINGS if re.search(g, t, re.I)] print(f"Macros: {len(rev)}/30 | Banned: {len(banned)} | Var mismatch: {len(var)} | Greeting: {len(greet)}")for mid, b in banned: print(f" banned {mid}: {b}")for mid, a, b in var: print(f" var {mid}: {a} -> {b}")for mid, g in greet: print(f" greeting {mid}: {g}")sys.exit(0 if len(rev) == 30 and not (banned or var or greet) else 1)[5] Execute the verification script on the model output.
$ python run/verify_macros_en.py run/rewrite_macros_en_v2.prompt.txt run/rewrite_macros_en_v2.out.txtMacros: 30/30 | Banned: 0 | Var mismatch: 0 | Greeting: 0[6] Test the script on a broken file. bad_sample.en.txt is the model output with four hand-made defects (not model output): As I said added to M-08, {refund_amount} changed to {refund_total} in M-11, Dear buyer, put in front of M-16, and M-23 deleted. The report shows one banned phrase, two placeholder mismatches (the change in M-11 and the deletion of M-23), and one greeting. The deleted M-23 also shows up as 29/30. As I said is found because the comparison lowercases both sides; the first draft of this script lowercased only the text and missed it.
$ python run/verify_macros_en.py run/rewrite_macros_en_v2.prompt.txt run/bad_sample.en.txtMacros: 29/30 | Banned: 1 | Var mismatch: 2 | Greeting: 1 banned M-08: as I said var M-11: ['{item_name}', '{order_id}', '{refund_amount}'] -> ['{item_name}', '{order_id}', '{refund_total}'] var M-23: ['{item_name}', '{order_id}'] -> [] greeting M-16: \bDear buyer\b[7] Observed edge cases and preventive measures.
In the first English run (run/rewrite_macros_en.out.txt) the prompt told the model to unify greetings to Hello {customer_name}, and the examples did the same. The model then put {customer_name} into macros whose originals had no such placeholder. The script above reports 30 placeholder mismatches out of 30 macros for that output. In the second run the rule was changed to: use Hello {customer_name}, only if the original contains it, otherwise Hello, with no new placeholders, and the examples were changed to match. That run had 0 mismatches (run/rewrite_macros_en_v2.out.txt). The Korean prompt was not tested for this problem.
The greeting check is a short list of patterns, so a greeting that is not on the list is not found.