Spec URL slugs for titles in any language
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
atoz,0to9and hyphens, at most 60 characters takenis the set of slugs in use, and theposts.slugcolumn 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?