Spec a bulk rename CLI that never overwrites files

Vibe codingMedium25 min

Your task

You want a small Rust command-line tool, rn, that renames many files at once with a pattern. For example, rn 'IMG_(\d+)\.jpg' 'trip-$1.jpg' *.jpg turns IMG_0042.jpg into trip-0042.jpg. A coding agent will build it.

Write the spec you would hand the agent.

What you know:

  • people will run it on folders of photos and documents they have no other copy of
  • the pattern is a regular expression from the regex crate, with $1 style groups in the replacement
  • it must work on Linux, macOS and Windows
  • scripts will call it too, so its output and exit codes matter

Then, in a few sentences: what does a casual "write a file rename CLI" prompt get wrong?