Steven Moffat was inspired by Audrey Niffenegger's novel "The Time-Traveler's Wife". He would go on to write the screenplay for The Time Traveler's Wife (2022).
Steven Moffat was dismayed to discover that the key exchange between Rose and Reinette in which they discuss The Doctor and the monsters had largely been trimmed down to just a few lines. He subsequently convinced Euros Lyn to reinsert the remainder of the dialogue.
Steven Moffat drew upon an element of his idea of a space library (which he first used in the short story Continuity Errors, which would have been connected via window-like portals to all the libraries of the past.
This was planned as the second episode of the 2006 series, however when Russell T. Davies realised how experimental it had become in Steven Moffat's hands, he decided to move it to fourth in the running order between School Reunion (2006) and Rise of the Cybermen (2006). As a result, Mickey was added to the narrative, since School Reunion culminated in his decision to join the Doctor and Rose in their travels.