Spec URL slugs for titles in any language

Vibe codingEasy20 min

Your task

Your blog platform needs URL slugs, so the post "Hello, World" lives at /posts/hello-world. Writers publish in English, German, Danish and Japanese, and some titles are only emoji. An agent will write make_slug(title, post_id, taken) in Python.

Write the spec you would hand the agent.

What you know:

  • a slug may hold only a to z, 0 to 9 and hyphens, at most 60 characters
  • taken is the set of slugs in use, and the posts.slug column has a unique index
  • every post has a numeric id before its slug is made, and a slug never changes after publishing
  • Python 3.12, standard library only

Then, in a few sentences: what does a lazy "make a slug from the title" prompt get wrong?