{"id":"data2-dedupe-contacts-latest-csv","audience":"operations","category":"data","track":"data","technique":"constraints","level":"advanced","title":"Dedupe a contact list by email with a keep rule","free":false,"task":"Your CRM export has duplicate contacts and you need one row per person. Write one CSV block (one code block) with the header email,name,updated,phone and one row per unique email, sorted by email, at most 15 words outside it. Treat emails as the same ignoring capitals, write them in lowercase, and keep the most recently updated row. If two duplicates share the latest date, keep the one with a phone number. Don't merge fields.","materialLabel":"Contacts export (attached to your prompt automatically)","material":"CRM contacts export - Alder & Finch (8 rows)\n\nemail | name | updated | phone\nAna.Ruiz@alder.example | Ana Ruiz | 2025-09-01 |\nana.ruiz@alder.example | Ana Ruiz | 2025-10-15 | 555-0101\nlee@birch.example | Lee Park | 2025-08-20 | 555-0102\nLEE@birch.example | Lee Park | 2025-08-20 |\nsam@cedar.example | Sam Ode | 2025-07-04 | 555-0103\ntia@dune.example | Tia Moss | 2025-10-01 | 555-0104\nTia@dune.example | Tia M. | 2025-10-30 |\nnoah@elm.example | Noah Fox | 2025-09-12 | 555-0105\n\nNotes:\n- Dates are ISO (year-month-day).\n- A blank phone is an empty field.\n- The sales team will import the CSV, so the number of data rows must equal the number of unique emails.\n- Some people change how their name is written between updates.","rules":[{"type":"codeBlocks","count":1},{"type":"maxProseWords","max":15}],"mistakes":[{"title":"Merging fields","why":"The AI copies Tia's old phone onto the newest row.","fix":"Add: \"Don't merge fields between rows.\"","checks":["r0"]},{"title":"Wrong tie-break","why":"For Lee's tie the AI keeps the first or last row randomly.","fix":"Add: \"If two rows tie on the latest date, keep the one with a phone number.\"","checks":["r1"]},{"title":"Case-sensitive duplicates","why":"The AI treats Ana.Ruiz@ and ana.ruiz@ as different people.","fix":"Add: \"Treat capitals as the same and lowercase every email.\"","checks":["r2"]},{"title":"Leaving the format to chance","why":"The AI picks its own length and layout unless told the exact shape.","fix":"Add: \"Put the code in exactly 1 code block. Keep the writing outside the code under 15 words.\"","checks":["codeBlocks","maxProseWords"]}],"promptHints":[{"label":"Asks for lowercase emails","patterns":["lowercase","capitals","ignoring case"]},{"label":"Gives the keep rule","patterns":["latest","most recent"]},{"label":"Gives the tie-break","patterns":["tie","phone"]},{"label":"Says don't merge","patterns":["don.t merge","no merging"]},{"label":"Names the header","patterns":["email,name,updated,phone","header"]}],"hint":"Dedupe rules need a keep rule, a tie-break and a 'don't merge' statement, or the AI improvises.","mission":"Remove the duplicates from this list.","musts":["Five unique rows","Latest wins, tie to phone","No merging fields"],"rubricLabels":["The CSV has exactly 5 data rows in this email order: ana.ruiz@alder.example, lee@birch.example, noah@elm.example, sam@cedar.example, tia@dune.example, with emails in lowercase","Ana's row is the 2025-10-15 one with 555-0101, and Lee's row keeps the phone 555-0102 (the tie on 2025-08-20 goes to the row with a phone)","Tia's row is the newest one: Tia M., 2025-10-30 with an empty phone (the older phone is not merged in), and the header is email,name,updated,phone"]}