{"id":"code-work-cs-ticket-routing-pseudocode","audience":"customer-support","category":"coding","track":"coding","technique":"format","title":"Write ticket routing rules as clear if/else steps","free":false,"task":"Write the routing rules for new tickets as pseudo-code in one code block, using only IF, ELSE IF and ELSE lines with one action each, at most 8 lines. Enterprise customers always go to the Enterprise queue first, even for refunds. Refund-tagged tickets over $200 (more than, so exactly $200 doesn't count) go to Tier 2 with an internal note; other refund tickets get the Refund under 200 macro; everything else goes to General. Rules must never auto-reply to or close a ticket. Under 25 words outside the code.","materialLabel":"Current setup and the team's notes (attached to your prompt automatically)","material":"HELPDESK SETUP - Copper Kettle support (Ticketly)\n\nTicket fields available to rules:\n- customer.plan (Free, Pro, Enterprise)\n- ticket.tags (refund, shipping, wholesale, bug, ...)\n- order.amount (dollars)\n\nQueues: General, Tier 2, Enterprise\nMacros: \"Refund under 200\" (sends the standard refund steps), \"Shipping delay\"\nActions rules can take: assign queue, apply macro, add internal note, auto-reply, close ticket\n\nWhat happened last month:\n- An Enterprise buyer's $5,000 refund sat in the General queue for two days.\n- A $200 refund went to Tier 2 and waited behind bigger cases.\n- A rule auto-closed tickets tagged \"spam\" that weren't spam.\n\nNotes from Rosa:\n- Tier 2 is two people, Sam and Deb.\n- About 300 tickets a week; roughly 15% are refunds.","rules":[{"type":"codeBlocks","count":1},{"type":"maxCodeLines","max":8},{"type":"maxProseWords","max":25}],"mistakes":[{"title":"Leaving the order open","why":"The AI checks refunds first, so Enterprise refunds miss their queue.","fix":"Add: \"Enterprise first, even for refunds.\"","checks":["r0"]},{"title":"Leaving the edge vague","why":"The AI uses 200 or more, so exactly $200 goes to Tier 2 again.","fix":"Add: \"More than $200, not $200 itself.\"","checks":["r1"]},{"title":"Not ruling out risky actions","why":"The AI adds a friendly auto-reply or closes duplicates.","fix":"Add: \"Never auto-reply or close.\"","checks":["r2"]},{"title":"Not giving the shape","why":"The AI writes paragraphs or a flowchart description.","fix":"Add: \"Only IF / ELSE IF / ELSE lines, one action each, at most 8 lines.\"","checks":["codeBlocks","maxCodeLines"]},{"title":"Getting a tutorial","why":"By default the AI explains every part of the code at length, which you then have to scroll past.","fix":"Add: \"After the code, one line under 10 words. Nothing else.\"","checks":["maxProseWords"]}],"promptHints":[{"label":"Puts Enterprise first","patterns":["enterprise (first|always)","first.{0,20}enterprise","even for refunds"]},{"label":"Sets the $200 edge","patterns":["more than \\$?200","> ?200","over \\$?200"]},{"label":"Rules out risky actions","patterns":["no auto-?reply","never (auto|close)","don'?t close"]},{"label":"Gives the shape","patterns":["if","else","pseudo"]},{"label":"Caps the code length","patterns":["\\d+\\s*lines","at most","under \\d+","short"]}],"hint":"Last month's problems tell you the order and edges that matter. Spell them out, plus the actions rules must never take.","rubricLabels":["The first rule checks customer.plan = Enterprise and assigns the Enterprise queue, before any refund rule","Refund tickets with order.amount > 200 (strictly greater) go to Tier 2 with an internal note, other refund tickets get the Refund under 200 macro, and the final ELSE assigns General","No line uses auto-reply or closes a ticket"]}