content: 
  ===Writing===
  The episode was written by series co-creators David Benioff and D. B. Weiss.
  "The Spoils of War" was written by the series' creators David Benioff and D. B. Weiss. The episode is the series' shortest episode to date. In the "Inside the Episode" featurette published by HBO following the airing of the episode, David Benioff spoke about the inspiration for the return of Arya Stark to Winterfell, saying it was inspired by Odysseus's return, who is also unrecognizable after making his journey. Benioff also stated that the important part of her return to Winterfell is her relationship with Sansa Stark, with Weiss following up by stating that the intention of the scene in the crypts where they are reunited was to "lay down the beginnings of the storyline where Sansa realizes what Arya is now."
  Speaking about the revelation of the cave drawings with the Children of the Forest and the First Men, Benioff stated that the inspiration for the drawings were the cave paintings created by prehistoric men that were found in France, and that the scene was meant to be evocative in noting the thousands of years that have passed since the drawings were created.
  In writing the battle between the Lannister army, and Daenerys' Dothraki and Drogon, Weiss stated that one of the most exciting elements of the fight involved the fact that two main characters were on opposite sides of the battlefield, and that it is "impossible to really want any one of them to win, and impossible to want any one of them to lose," according to Weiss. He also compared the introduction of a dragon in medieval warfare to using an F-16 fighter aircraft in a medieval battle. According to Nikolaj Coster-Waldau, in an interview with ''Entertainment Weekly'' following the airing of the episode, the script stated that "One of our main characters is about to die." Coster-Waldau also stated about his character, "Jaime is such an idiot that he thinks for a second, 'If I can do this, I can win the whole thing in a 'Hail Mary.'"