Jamie Mathieson revealed on a Reddit Q and A that the Doctor having a cigarette case full of jelly babies was Peter Capaldi's idea.
Jamie Mathieson initially imagined that the Foretold's bandages would be able to operate independently, but this element was eventually dropped.
Steven Moffat recalled that The Big Bang (2010) had ended with the Doctor being summoned to deal with "an Egyptian goddess loose on the Orient Express, in space". He hadn't intended it to be anything more than a one-line gag, but it now inspired the title.
Jamie Mathieson was approached to write the script while working on Flatline (2014). He was given the title, chosen by Steven Moffat, which led Mathieson to look to Agatha Christie for inspiration.
This story is one of few examples in the series of a non-diegetic visual appearing throughout the story. The timer shown during the Foretold's attack can't be seen by any of the characters, and is shown purely for the audience's benefit.