SPOILER ALERT: Do not read if you have not yet watched the final episodes of “Unbreakable Kimmy Schmidt,” streaming on Netflix.

Sometimes in comedy all it takes is the idea for a one-line joke to spark a conversation that leads to something greater. That was the case for “Unbreakable Kimmy Schmidt” co-creators and co-showrunners Robert Carlock and Tina Fey and their team of writers to develop the “Sliding Doors” double-episode of the final season of their Netflix series.

“We thought it would just be a joke in an episode, and it kind of just grew into, ‘Well, it might be fun to see if we could explore that and see what would happen to people,'” Carlock tells Variety.

Fey notes that the movie came out early enough that Kimmy (Ellie Kemper) would have been aware of it, and that formed the basis of a joke, but what really interested the team was diving into who people would be “if their lives had not been touched by Kimmy,” as well as who Kimmy would be if she had not lost years of her life to being trapped in a bunker.

“[It was] exploring the idea that even the worst things that happen to you can shape you in a positive way if you’re built like Kimmy mentally,” Fey says.

In fleshing out the specifics of where that alternate universe episode would find the characters, Carlock says the goal was “to do things that were diametrically opposed to how we normally see them.” Therefore, after Kimmy opted not to get in Reverend Richard Wayne Gary Wayne’s (Jon Hamm) van, she was able to go down a more traditional path of a long-term relationship and working towards a career. Meanwhile, Titus (Tituss Burgess) actually saw success as a movie star — thanks in large part to a Scientology-esque organization; Jacqueline (Jane Krakowski) failed to marry rich the first time and was stuck living with Mikey (Mike Carlsen) and a bunch of kids; and Lillian (Carol Kane) was running a street gang.

Carlock admits that in that scenario, “Kimmy and Titus’ lives look better.” They have had professional success, and they do still find a way to meet each other and even get married — but their romantic relationship is of course a lie because he is still closeted.

“You can have all of the trappings of a good life on paper and still be very glad when you come back to that basement apartment and that broken sliding door to Kimmy’s room,” Carlock says.

The episode was also another way to “take advantage of this platform that we have while we’re still on it,” Fey says of working with the streamer. “We’ve done some straightforward stories, how can we play with form?” was an important conversation while breaking the final season in the writers’ room.

The first half of the season saw an episode break the traditional half-hour structure to turn in a documentary-style piece entitled “Party Monster: Scratching the Surface” that dug into the Reverend’s past in a way that showed Kimmy she lived in a world where “certain people have convinced themselves that he’s innocent,” Carlock reminds. The “Sliding Doors” double episode was a way to further break boundaries.

“Unbreakable Kimmy Schmidt,” originally developed for NBC but picked up by Netflix in 2014, started with its titular character — and a handful of other women — being rescued from an underground bunker where they had been held captive for years after being kidnapped. Right from the jump, the show was seeded with themes of “how women are treated by our society,” Carlock notes. But as time has gone on, those themes continued to be relevant, which led Carlock and Fey to evolve the commentary around the subject.

In the final season, that led to a more direct story about sexual harassment — both through Titus, who it turned out had been asked to perform sexual acts on a puppet during an audition with a highly regarded figure in entertainment, as well as Kimmy herself, whose childlike enthusiasm was misunderstood at her place of business, leading allegations to be brought against her briefly, as well.

“All our ‘Saturday Night Live’ blood is compelled to talk about the world as it is in the moment that we’re writing,” Fey admits. “But we were mindful of how long it takes to write the show. … For example, Kimmy voting for the first time and having this decision to make would have been great if we knew the way our seasons lined up — that by the time we got to it, [the world] would have been really beyond [the election] and people were depressed and fatigued and tired of hearing about it.”

In the past, Fey continues, they also shied away from exposing “Unbreakable Kimmy Schmidt” characters to the media, purposely keeping the “mole women” from getting famous or giving them access to things that seemed too big or unrealistic. However, in the back-half of the final season, the show brought in Ronan Farrow to guest star as himself, trying to get Titus to tell his story.

“Maybe partly because this was the run-out and maybe partly because it was the nature of those stories, Ronan felt within the boundaries of what could happen,” Fey says.

The final season also paid off a long-running reference to Donald Trump being the Reverend’s “personal hero” when the kidnapper appeared on the Trump-hosted “The Apprentice” in the alternate universe episode (in which Jacqueline also tried to sleep with him as part of her quest to get rich).

“He incredibly became increasingly unavoidable…so it was just fun to keep calling it back,” Carlock says.

But even more important than having their characters face timely real-world figures and issues was developing ways for them to grow in the “short runway” that ended up being the final seven episodes. The final season was split in half, with the first six episodes launching May 30, 2018 and the final seven on Jan. 25, 2019.

“We wanted to make sure there was a shape to the first six, which is something we don’t always have to worry about,” Carlock says. “We tried a little harder to make sure in the midpoint — at the end of the first-half — there was a bit of a cliffhanger, something to pull us through.”

Carlock and Fey wanted to make sure Jacqueline would be standing on her own two feet by the end of the series — and they also “felt like it would be nice to have a man in her life that appreciates her unique life experiences and appreciates her for the things that no one’s ever appreciated for her before,” Carlock says. They wanted “Lillian to let go of the past and be in the present,” Fey adds, and they wanted Titus to “get out of his own way” both personally and professionally to find happiness.

For Kimmy, they most wanted to see her “try to make the world a better place” and see success — specifically in a “J.K. Rowling sort of way,” Fey says. After reading about Rowling’s tougher times as a single mother on welfare before she wrote “Harry Potter,” the writers and producers saw a parallel that led them to want to make Kimmy’s “childlike mind and the dark experience she’s had come together to form a positive.”

This is what led them to have Kimmy author a book — and then have that book develop a devout, widespread following. Also similar to “Harry Potter,” Kimmy’s book spawned a theme park, which also allowed to bring the show full-circle in a way. “That sort of ended in the beginning kind of way because Kimmy was conceived on a roller coaster, we believe,” Fey points out.

Kimmy also fully embraced her found family but wasn’t forced into a romantic relationship by the series’ end. “It would have felt reductive [to do that],” Fey admits.

Adds Carlock: “I leave feeling like, ‘Oh Kimmy will be happy, personally. She draws people to her and she’ll find the right person she wants to be with if that’s what she wants.’ But her goals are so much broader than that, and the idea of trying to pursue success in these ‘I’m going to fix the world’ [ways], it felt like it would have been tagged on or it would have been just the wrong emphasis for her as a character.”

The series finale of “Unbreakable Kimmy Schmidt” is only a goodbye to the characters for now, as Netflix has ordered a movie — “a one-off special,” according to Fey — that will allow them to revisit the characters one more time in a “cool, fun way.” But Carlock thinks “it certainly fits this show” to not firmly wrap things up.

“Part of the message of the show is that you’ve got to keep working to be a person,” he says.