While collaborating on Hidamari Sketch and Bakemonogatari, Akiyuki Shinbo told Aniplex producer Atsuhiro Iwakami he wanted to create a new magical girl series, beginning the development of Puella Magi Madoka Magica. During the early planning stage, Iwakami decided not to adapt an existing work to give Shinbo more freedom in his direction style. Another goal of the project was to develop an anime that would appeal to a wider audience than the usual demographic for media within the magical girl subgenre. Iwakami and Shinbo intended their series to be accessible to "the general anime fan". Shinbo then asked Gen Urobuchi to work on the project as a scriptwriter and Ume Aoki as original character designer. Takahiro Kishida was engaged to adapt Aoki's character designs for the television series.
In his role as producer, Iwakami took a mostly hands-off approach. Because Puella Magi Madoka Magica is an original series rather than an adaptation of an existing work, his main goal was "coming up with a high-quality piece of entertainment". After helping to recruit the staff, he allowed them freedom to develop the content of the story, providing minimal guidance. After viewing the character designs that Aoki created, he was sure he could trust the creative talent of the team. In an interview with Anime News Network after the series finished airing in Japan, Iwakami said, "I don't matter much; it's up to those talents to do their work. If something comes to a stand-still I might intervene, but they did an excellent job and I was very happy seeing the results in episode one."
writing
During the pre-writing planning phase, Iwakami asked Urobuchi to make the storyline "heavy". Shinbo specified it should contain copious amounts of blood and violence, elements that were unusual in the magical girl genre. Iwakami also asked for many of the magical girl characters to be killed throughout the series. Urobuchi said he had no trouble with these requirements, referencing his past reputation as a writer of very dark and somber stories, the extent of which Shinbo had not known.
One objective was for the script to contrast starkly with the way the anime was to be marketed. Shinbo planned to advertise the series innocently and purely that would deliberately conceal its dark undertones. For example, the title logo was rendered using rounded fonts that would appear harmless to audiences. Urobuchi further misled fans by using his Twitter account to persuade them the plot of the series was innocuous. The true nature of the series was disguised because Shinbo wanted its dark themes to be a complete surprise to the viewers. Iwakami later defended the mature themes in the Puella Magi Madoka Magica, stating, "the story of Madoka is serious but it's not entirely inappropriate for children. For example, there's nothing sexually explicit in it. There's some death, but it's not gratuitous; it can be explained within the context of the story."
Shinbo granted Urobuchi a large amount of autonomy in writing the series and determining the path of the story. In describing his interactions with Iwakami and Shinbo while working on the series, Urobuchi commented that "neither one is the type to show their hand, they would always wait for me to make the next move". To create a successful deconstruction of the magical girl genre, Urobuchi studied aspects of traditional magical girl media that were "troubling or overlooked". He also stated the plot development was heavily influenced by the character drawings by Aoki, and credited horror fiction author Stephen King and Shinbo's previous projects such as Hidamari Sketch and Magical Girl Lyrical Nanoha as inspirations for the series.
Urobuchi attributed his experience working on projects with screenwriters Ichiro Itano and Yōsuke Kuroda as a major influence in his writing for Puella Magi Madoka Magica, and has referred to both of them as his mentors. To set the initial pacing of the series, Urobuchi used a technique he credited to Kuroda. The first episode would throw the viewer into a specific part of the story with unknown context. The second episode would define the rules governing the story's setting. The third episode would divulge the revelation in the plot to hook the viewer. The twist in the third episode was determined during the project proposal stage and involves the death of Mami, the main character's 'mentor'. This decision was controversial; Urobuchi said production staff continually approached him and asked him to reconsider because of their fondness for the character. He refused and the plot remained unchanged during production. Urobuchi realized this progression could be very hard for viewers to accept and might hurt the overall series' success with some audiences; he said, "I always thought this is an age where entertainment basically is about soothing and healing, like adopting a style where unchanging day-to-day life is to continue forever".
In an interview with Ultra Jump Egg, Urobuchi gave insight into his writing philosophy, stating that he believed the overarching plot of a story was more important than its characters. He said he would first determine the actions and the ultimate fate of a character before even assigning it a name, and contrasted this with other writing methods that first focused on developing the characters and then creating a storyline for them to follow. He again defended his decision to have Mami die, saying this could have the effect of making the character more memorable, saying, "I think there are quite many characters who became immortal exactly because they died, like Caesar Zeppeli in JoJo's Bizarre Adventure or Raoh in Fist of the North Star. Precisely because of the way they died, they were able to live forever."
character design
Urobuchi stated that Sayaka was his favorite character overall and said her plotline was the most enjoyable to write. Shinbo believed that Sayaka's grim fate by the end of the series was a slightly unfair destiny, and asked Urobuchi if it was possible to change the plot so Sayaka could be spared. Urobuchi declined, saying her death was integral to the overarching story. Shinbo then asked if she could be brought back to life, saying he had become very attached to the character. Urobuchi again refused, saying this would be impossible because of the already-established rules governing the story. Shinbo acquiesced to this, but said he believed there may have been too large a burden placed on the characters who were young, middle-school girls.
The alien character Kyubey was also envisioned and designed by Urobuchi. Iwakami stated that as one of the primary antagonists in the series, "the mash-up of cuteness and darkness is the central theme to Madoka, and Kyubey is an epitome of that theme". A central goal in Urobuchi's writing was to highlight the moral and ethical dissonance between Kyubey and the young middle school girls, which was done through actions such as Kyubey eating its own corpse to recycle energy. He compared the character to monsters in the works of horror fiction author H. P. Lovecraft, commenting of Kyubey: "he isn't evil, it is his lack of feelings that make him scary". Urobuchi also remarked upon the moral ambiguity the series displays in an interview with Asahi Shimbun, stating "Al-Qaeda brought down the Twin Towers due to their self-righteousness. Justice for some people is an evil for others. Good intentions, kindness, and hope will not necessarily make people happy."
Due to unforeseen scheduling problems at Shaft, production of the series was postponed for three years following the completion of its writing. Once the issues were resolved, production began without further complications. The animation studio led the conception and design of the witches, and created each one's individual backstory. Urobuchi had originally envisioned the witches to be similar to conventional monsters such as Godzilla, but upon seeing the surreal concept art for one of the main witches, Walpurgisnacht, he said; "How can Homura possibly fight against something like this?" Designers from Shaft added quotations from the German folklorist Faust to the series. Throughout production, the animation production team Gekidan Inu Curry had freedom to insert new details and to modify existing ones from the original script; for example, during a scene in the final episode in which the team added black wings to Homura—something that was not included in Urobuchi's writing. Urobuchi praised this aspect of the production, commenting, "additions by the animation production team added more mystery and depth to the characters, and without them, it would have been very difficult to write any further stories in the world of the series".
music
Iwakami and Shinbo recruited Yuki Kajiura to compose the soundtrack for the series after Urobuchi recommended her. Shinbo had previously worked with Kajiura on Le Portrait de Petit Cossette; Urobuchi told of the inspirational effect the music from that series had on him while writing parts of the script. Urobuchi said he had long been a fan of Kajiura's anime soundtracks and praised her work ethic, saying she would always familiarize herself with the story's plotline while composing for it. Japanese pop music duo ClariS was also commissioned to perform the series' opening theme "Connect" (コネクト, Konekuto). Iwakami involved himself in the song's development to ensure it would fit with the series, marking one of the few times he intervened in an aspect of the production. Both "Connect" and the ending theme "Magia" by Kalafina were revealed in a television commercial several weeks before the series' premiere in Japan.