Rashida Jones as Celeste and Andy Samberg as Jesse in “Celese and Jesse Forever.” (David Lanzenberg/Sony Picture Classics)

If life followed the well-worn formula of romantic comedy, the recently ubiquitous actress Rashida Jones would be married to creative collaborator and character actor Will McCormack. After an auspicious introduction, the pair might have dodged enticing suitors, unraveled misunderstandings and endured a few mildly humiliating sight gags — a naked somersault down a staircase, maybe — just in time to enjoy a reunion that was teary, but not so hysterical that Jones’s mascara made a break for it.

Instead, Jones and McCormack dated for a few weeks in the late 1990s, shortly after Jones graduated from Harvard and moved to New York. It didn’t take long before the pair realized they were made for each other — as friends. So much for the prediction of McCormack’s sister, “In Plain Sight” star Mary McCormack, who introduced Jones (the daughter of musician Quincy Jones and actress Peggy Lipton) to her brother, certain they were soul mates.

“It turns out we are in a way, just not as romantic partners,” Will McCormack said. “But as writing partners and, you know, life partners.”

“Life partners!” Jones echoed in excited agreement.

It might not be a fairy-tale ending, but it served as partial inspiration for “Celeste and Jesse Forever.” The dramedy marks the first foray into screenwriting for both Jones and McCormack, two actors with long and diverse résumés, ranging from the small screen (Jones is a cast member of “Parks and Recreation,” McCormack did a guest stint on “Brothers and Sisters”) to indie films to bigger-budget movies, including “The Social Network” (Jones) and “Syriana” (McCormack).

Actress Rashida Jones, left, and writer/producer Will McCormack, from “Celeste and Jesse Forever.” (Victoria Will/AP)

Over the course of four months, the two met every day to work on the “Celeste and Jesse” screenplay. They sat side by side, writing every word together, taking anecdotes from their own relationships and the breakups of friends to create a twist on the romantic comedy template that they hope more accurately mimics modern life.

Celeste and Jesse are a married couple played by Jones and “Saturday Night Live” alum Andy Samberg. The movie begins at the relationship’s end, which at first appears to be on the best of terms, and follows along as the two attempt the tricky transition from domestic partnership to friendship. There are laughs aplenty, many thanks to McCormack’s character Skillz, a weed-smoking confidant of both husband and wife. But the movie doesn’t shy away from the crushing impact of heartbreak when each character begins to contemplate and embark on new relationships.

“I think what we wanted to do was pay our respects to the [romantic comedy] conventions that work, because they’re the conventions we grew up on and we loved,” said Jones, 36, who counts “When Harry Met Sally” and “Annie Hall” as favorite examples in the genre. “Then try our best to invert, subvert, convert those into something slightly fresher and maybe add a bit of a surprising element to the convention.”

Added McCormack: “They’re so familiar. You fall in love, you fall out of love and then you fall in love again, so they’re really hard to reinvent.”

Crafting a believable romantic comedy starts with the building blocks of realistic dialogue, which is one of the film’s great assets. In one scene, Celeste and Jesse spontaneously break into German accents (to the disgust of their friends, who are confounded by their breakup) while at another point, the two reenact a lewd running gag that involves caressing a tube of lip balm. Not surprisingly, McCormack and Jones cherry-picked from an arsenal of their own inside jokes.

“Because we spend so much time together, we do some really stupid things just to entertain each other,” Jones said. “We also do stupid voices and sing to each other sometimes when we’re bored. We’re probably a little bit annoying to other people.”

In that same vein, the characters of Celeste and Jesse are more outsized versions of the pair that penned them. Celeste has type-A tendencies and control issues, while Samberg is a laid-back guy hoping to prolong his responsibility-free extended adolescence.

“Their dynamic is our dynamic for sure,” Jones said. “And we took kind of the worst parts of ourselves. Will, what he was when he was more of a man-child. But now you’re grown up,” she added looking over at her creative partner.

“It was a battle, but I’m there,” McCormack responded. “I think.”

The character of Celeste feels like a break from the norm, as well, though somewhat in line with a new trend for female personalities onscreen that includes the subjects of “Bridesmaids” and “Girls.” If Judd Apatow crafted a new archetype — the lovable slacker — this is the female response.

“We were like, why don’t we create a flawed and a little bit of a horrible character, who learns a hard lesson and does it in a way that feels natural that people can relate to,” Jones said.

As a result, Jones had to strip her portrayal of the pristine veneer so common in romantic comedies. In the film, coming to terms with breaking up entails sweat-covered marathon runs, seemingly plucking attire cues from “Grey Gardens” and riffling through an ex’s garbage. It’s not pretty, but that’s the point.

“I feel like sometimes I watch romantic comedies with these kinds of women — “Family Guy” refers to them as busy business women with lots of business meetings in a business suit — and even when they’re at the lowest point in the movie, they’re so adorable, and it’s like: You know what? No you’re not!” Jones said. “I know what it’s like to have my heart broken. It is not adorable.”

In a way, the movie turned into a cathartic experience; as Celeste learned to let go and find peace, the writers came to terms with their own hang-ups.

“I have this thing about acceptance of myself and — sorry this is so psychoanalytical — but this character has to accept some level of gray in life, and I think for me I’ve always wanted to be perceived as perfect and right, and there’s so much other [stuff] going on inside of me that’s not perfect and not right, and a little bit of it I got to show in the movie,” Jones said. “I’m basically saying, I’m pretty flawed, y’all. You might not be cool with that, but here you go. Sorry, this is just who I am. There’s something that’s really a relief about that.”

For McCormack, the screenplay allowed him to consider the discrepancies between what he imagined his life would look like and the reality of his present, also a major theme in the film.

“I’m going through another phase of that now where like everyone I know has children, and I don’t, and I want them,” McCormack said. “And it’s okay to want things, or else what are we doing here? But then it’s also like I have to be okay today and live today the best I can. But you keep getting met with these new challenges. And this movie was challenging professionally and personally.”

As demanding as the process was, McCormack and Jones have continued writing. The pair completed a screenplay adaptation of Jones’s comic book “Frenemy of the State,” about a socialite-turned-spy, and also worked on a pilot together, the details of which are still under wraps. They spend more time together than most couples, McCormack admits. But don’t get any ideas.

“I have some friends that are like — we just went to Italy together — and they’re like, ‘this is the trip, right?’ And I’m like, ‘no dude, not happening. It would be like sleeping with my sister,’ and they’re like, ‘yeah, your really hot sister,’ ” McCormack said, smiling at Jones before adding, “I have a lot of friends who love you.”

“Dudes,” Jones said by way of explanation. “He’s talking about dudes.”

It may be a favorite romantic comedy, but apparently “When Harry Met Sally” had it all wrong. In real life, men and women can be friends — just friends — even if McCormack’s sister still holds out hope at times.

“That’s because she wants to be responsible for the setup,” Jones said. “But this is better; we’ll never get divorced. This is real forever.”

“Celeste and Jesse Forever”

Opens Friday at area theaters.