Anne Beatts, who broke into the boys’ club of comedy as a writer at National Lampoon and “Saturday Night Live,” where she helped shape the show’s brash, bold and gleefully irreverent sensibility before creating a television series of her own with the sitcom “Square Pegs,” died April 7 at her home in West Hollywood, Calif. She was 74.

Her longtime writing and producing partner, Eve Brandstein, confirmed the death but said she did not know the cause.

Ms. Beatts had written for National Lampoon and the Village Voice before being hired for “Saturday Night Live” along with her boyfriend at the time, Michael O’Donoghue. With Marilyn Suzanne Miller and Rosie Shuster, she was one of three women in the show’s original writer’s room, a space that made her feel “like Wendy on the island of Lost Boys,” as she later put it.

Premiering in 1975, SNL — initially known as “NBC’s Saturday Night” — became a surprise hit, turning cast members such as Dan Aykroyd, John Belushi, Chevy Chase, Laraine Newman and Gilda Radner into stars. Behind the scenes, performers and writers frequently fought, dated, broke up and partied, in what Ms. Beatts described as “a combination of summer camp and concentration camp.”

“It was pretty much any adjective you want to throw at it,” she told the Orange County Register in 2013. “It was exciting, stimulating and fabulous. It was also horrible, boring and exhausting.”

Ms. Beatts worked at SNL until 1980, partnering with Shuster to create recurring characters such as Uncle Roy, a pedophile babysitter played by frequent guest host Buck Henry, and Aykroyd’s Irwin Mainway, a toy company president whose wares include a Johnny Switchblade rubber doll and the aptly named Bag O’Glass, which retails for $1.98.

They were also responsible for Aykroyd’s “Fred Garvin: Male Prostitute,” who offers his clients “professional hygiene, discretion and animal gratification,” and for “the Nerds,” a teenage duo that included noogie-giving, high-pantsed Todd DiLaMuca (Bill Murray) and bespectacled, Tang-drinking Lisa Loopner (Radner).

Ms. Beatts wrote parody commercials as well, appearing in one as a Cleveland homemaker, nuclear physicist and commissioner of consumer affairs. “How does Ellen Sherman do it all? She’s smart,” a voice-over says as Ms. Beatts rattles off her hobbies. “She takes Speed. Yes, Speed: The tiny blue diet pill you don’t have to be overweight to need.”

While at SNL, Ms. Beatts shared five Emmy nominations for outstanding writing in a comedy-variety or music series, winning one in 1976, according to IMDb. Yet even as her writing drew praise, she maintained a complicated relationship with cast members such as Belushi, whom she described as “a genius” who resented her work.

In a 2009 interview with the Television Academy, she said that Belushi told Lorne Michaels, SNL’s creator and producer, to fire the show’s female writers. “He used to refuse to be in pieces that we wrote,” she added. Years later, when she created and produced “Square Pegs,” she hired five female writers and only one man.

“She gave a lot of women their breaks,” said Brandstein, who worked as a casting director on the show. “The first thing I did with her was ‘Square Pegs’ — and she brought together an almost all-female staff. That was really rare. She was really a pioneer as well as an advocate.”

Premiering on CBS in 1982, the sitcom starred Sarah Jessica Parker and Amy Linker as teenage girls trying to fit in at Weemawee High School, “even if it kills us.” Washington Post television critic Tom Shales called the series “an oasis of delightfulness,” while others marveled that a female producer had succeeded in launching her own prime-time show.

“Mary Tyler Moore had Grant Tinker, Carol Burnett had Joe Hamilton and Lucy had Desi; Anne Beatts has chutzpah,” wrote People magazine’s Joshua Hammer.

After 20 episodes, “Square Pegs” was canceled. In the Television Academy interview, Ms. Beatts recalled that she was treated “with some degree of disbelief and disrespect” while working on the show, which was partly inspired by her own adolescence as a gawky young girl who started high school at age 12, with thick glasses and a dry sense of humor.

“I always felt that if I died it would be, ‘Ex-“Saturday Night Live” writer dies in plane crash,’ ” she said. “If they could add the ‘Square Pegs’ credit in there, that would be good.”

Anne Patricia Beatts was born in Buffalo on Feb. 25, 1947, and grew up in Somers, N.Y. Her parents were teachers. She studied English at McGill University in Montreal, where she wrote for the school newspaper, and worked as an advertising copywriter in Toronto before moving to New York City.

By then she was interested in comedy, and had decided there was only one way to break into the field. As she put it: “You needed a guy to get in the room.”

Her breakthrough came via Michel Choquette, a writer she was dating who worked at National Lampoon, which was launched in 1970. He began bringing her to editorial meetings, held at restaurants across the city.

“The other writers at those dinners couldn’t say, ‘Let her eat at home, preferably out of a dog dish,’ because there I was,” she told Rolling Stone in 1983. “I wasn’t about to leave, and I didn’t know anyone else in New York. They weren’t used to having girls. I was the first woman they let in the door.”

As the magazine’s first female contributing editor, Ms. Beatts was perhaps best known for co-creating, with Philip Socci, a mock Volkswagen ad referring to Sen. Edward M. Kennedy’s car accident on Chappaquiddick Island: “If Ted Kennedy drove a Volkswagen, he’d be President today.”

Within a few years, she had left National Lampoon and was living with O’Donoghue, who recommended her to Lorne Michaels. “She thought I was hiring her for the wrong reasons — because O’Donoghue was then her boyfriend — and when we met, she was a combination of friendly and wary,” Michaels told Rolling Stone. “She was a little combative. But that was 1975. Everyone was a little combative in 1975.”

Ms. Beatts said she was hesitant to take the job, believing that television was “just a lava lamp with sound.” She had been working on a book and wanted to finish it. Michaels said she could do both, and in 1976 she published “Titters: The First Collection of Humor By Women,” an anthology that she edited with Deanne Stillman.

She later co-wrote a Broadway comedy show for Radner, which director Mike Nichols adapted into the 1980 movie “Gilda Live,” and wrote the book for the jukebox musical “Leader of the Pack.” For television, she wrote for shows including “Murphy Brown” and produced the first season of “A Different World,” a spinoff of “The Cosby Show.”

In recent years, she taught at Chapman University in Orange, Calif., and was working to launch an animated “Blues Brothers” series, based on the SNL characters played by Belushi and Aykroyd. She was also developing two TV shows with Brandstein: “The Girl in the Room,” a documentary series about women in comedy, and “Funny Boys,” a comedy inspired by her years at National Lampoon.

Survivors include a daughter, Jaylene Beatts, of West Hollywood; a sister; and a brother.

“I am a self-styled girl satirist,” Ms. Beatts told Rolling Stone during the making of “Square Pegs.” “I have always wanted to use the word ‘self-styled’ about myself, but I really am. I have my own style. Humor for me is a weapon. When you’re not popular and you’re standing on the sidelines, you develop a keen sense of observation. At some point, I learned those observations could be funny, and that being funny was a way of being popular.”

“I think that people who were really popular in high school never go beyond that,” she added. “Most successful people I know now were square pegs in high school.”

Correction: An earlier version of this obituary incorrectly referred to a Volkswagen parody ad in National Lampoon. The satirical advertisement was co-created by Philip Socci, not written solely by Ms. Beatts.

Read more: