{"id":"code-work-sb-python-photo-rename-dry-run","audience":"small-business","category":"coding","track":"coding","technique":"constraints","title":"Preview product photo renames without touching files","free":false,"task":"Write a Python script (standard library only) that reads mapping.csv and, for each row, prints what the photo in the photos folder would be renamed to, like IMG_1234.jpg -> ck-lav8.jpg (the SKU lowercased plus .jpg). This is a dry run: Bea wants to check the list first, so the script must not rename, move or copy anything. If a photo isn't in the photos folder, print MISSING IMG_1240.jpg instead. One code block, at most 12 lines, then under 25 words outside the code.","materialLabel":"The mapping file and the folder (attached to your prompt automatically)","material":"mapping.csv (made by Bea from the shop's product list)\nphoto,sku\nIMG_1234.jpg,CK-LAV8\nIMG_1235.jpg,CK-CED16\nIMG_1236.jpg,CK-TRIM\nIMG_1240.jpg,CK-SAMP\n\nphotos/ folder right now:\nIMG_1234.jpg\nIMG_1235.jpg\nIMG_1236.jpg\nIMG_1237.jpg (blurry retake, not used)\n\nNotes from Bea:\n- The shop platform matches photos to products by file name, all lowercase.\n- Last time I renamed photos by hand, two products ended up with each other's pictures.\n- The sampler box photo is still on my phone.\n- I run scripts from the folder that holds mapping.csv and photos/.\n- About 60 products in total.","rules":[{"type":"codeBlocks","count":1},{"type":"maxCodeLines","max":12},{"type":"maxProseWords","max":25}],"mistakes":[{"title":"Not saying it's a dry run","why":"The AI renames the files straight away, so mistakes can't be caught first.","fix":"Add: \"Dry run: only print old -> new, never rename.\"","checks":["r1"]},{"title":"Not showing the new name","why":"The AI keeps the SKU's capitals, which the shop platform won't match.","fix":"Add: \"New name is the SKU lowercased plus .jpg.\"","checks":["r0"]},{"title":"Forgetting missing photos","why":"The AI's script crashes or stays quiet when a photo isn't there.","fix":"Add: \"If the photo is missing, print MISSING <name>.\"","checks":["r2"]},{"title":"Getting a menu of options","why":"The AI likes to offer two or three versions of the script, so you're left to pick and test them yourself.","fix":"Add: \"Give one script only, in one code block, no alternatives.\"","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 12 words. Nothing else.\"","checks":["maxProseWords"]}],"promptHints":[{"label":"Says it's a dry run","patterns":["dry run","don'?t rename","only print","preview"]},{"label":"Shows the new name","patterns":["lower","ck-lav8\\.jpg","->"]},{"label":"Handles missing photos","patterns":["missing","doesn'?t exist|not (in|there)"]},{"label":"Rules out extra libraries","patterns":["standard library","csv module","no pandas"]},{"label":"Caps the code length","patterns":["\\d+\\s*lines","at most","under \\d+","short"]}],"hint":"Bea wants to look before anything changes. Tell the AI that, plus the exact line to print for each photo, including missing ones.","rubricLabels":["Reads mapping.csv with the csv module and builds the new name as the SKU lowercased plus .jpg (ck-lav8.jpg)","Only prints lines like IMG_1234.jpg -> ck-lav8.jpg and never calls os.rename, shutil.move, shutil.copy or Path.rename","Checks whether photos/<photo> exists (os.path.exists or Path.exists) and prints MISSING IMG_1240.jpg for missing ones"]}