The Time of the Doctor
Capaldi briefly appears in the 50th anniversary special. Moffat stated that it was his "plan from the start" that all the Doctors would fly in to save Gallifrey, and he knew there would be a new one at that time. He wrote it before knowing who would be cast. Capaldi filmed his appearance on 3 October 2013, long after principal photography for the special had ended, and the same day he filmed his debut scene for "The Time of the Doctor".