About halfway through the first act of Broadway’s “Something Rotten!” there’s a song called “A Musical.” It’s an over-the-top showstopper, and it brings down the house. It’s not uncommon for audiences to give it a standing O.

But the number, set to be showcased during the Tony Awards ceremony Sunday night, wasn’t originally written as a showstopper at all. It was, in the words of co-book writer John O’Farrell, just a light “little ditty” — until they showed it to director Casey Nicholaw.

“That was Casey’s first note to us,” said Karey Kirkpatrick (pictured right), who co-wrote the musical’s book with O’Farrell (pictured second from right) and collaborated on the songs with his brother Wayne Kirkpatrick (pictured second from left). “He jumped up and went, ‘This is your chance to have a big musical production moment! You want it to go, Ya da da da da!’” he recalled, making the requisite jazz hands. “And it was a great note. We went away and listened to ‘We’re in the Money’ [from ‘Gold Diggers of 1933’] and ‘Forget About the Boy’ [from ‘Thoroughly Modern Millie’] and we came up with the big chorus that’s in there now.”

The guys who wrote “Something Rotten!” have a lot of stories like that. Sometimes they’ll refer to their four-year collaboration on the show as Musical University, with director Nicholaw (pictured left) as their headmaster.

“Something Rotten!,” a broad Broadway comedy set in the Renaissance and centering on two playwriting brothers who invent musical theater in a bid to outshine the spotlight-hogging Shakespeare, picked up 10 nominations for 2015 Tony Awards, including the big award for new musical. Not bad for Broadway first-timers like the Kirkpatricks and O’Farrell, who all came at the project from a variety of different backgrounds.

Karey Kirkpatrick is a screenwriter (“Over the Hedge,” “The Hitchhiker’s Guide to the Galaxy”) and director (“Imagine That”) who’d previously worked with O’Farrell, the British novelist (“The Man Who Forgot His Wife”) and TV sketch writer (“Spitting Image“), on the screenplay to “Chicken Run.” Wayne Kirkpatrick, meanwhile, is a pop-rock producer and composer whose work includes the Grammy-winning Eric Clapton song “Change the World.”

All three are lovers of musicals, but none had ever written one. That’s where Nicholaw came in. The director, Broadway’s go-to guy for musical comedy thanks to his work on shows including “The Book of Mormon” and “Aladdin,” got matched with the “Rotten!” team by producer Kevin McCollum, a longtime friend of Karey Kirkpatrick and the producer of “The Drowsy Chaperone,” which Nicholaw directed. He joined “Something Rotten!” when the show was nothing more than a pitch and five songs.

“At first they just didn’t know the craft of it,” Nicholaw said of his collaborators. “Like how to write into a song or how to write out of it. Or how there’s a different kind of momentum that has to happen in a musical, and there has to be a moment, like 35 minutes into it, when you pick up and roll all the way through to the end of the first act.”

Another lesson learned by the writers: A musical theater song has a lot more work to do, in terms of character development and storytelling, than your average rock song — so it takes a lot longer to write. The Kirkpatricks said they averaged about one song a week, working together in all-day sessions.

“Oh, that’s way longer than for other songs,” noted Wayne Kirkpatrick. “Usually if you’re on a roll, you could write a song in a day. But with this, you spend a week on a song, and that’s just the first pass at it.”

The co-book writers also found that their screenplay experience didn’t always translate to the stage. “It was a steep learning curve for us,” O’Farrell said. “There were jokes in there that were just not musical theater jokes.”

“We would button a scene with a joke, and Casey would remind us that a punchline and a blackout is not the same thing as a cut in a movie,” Karey Kirkpatrick added. “In musicals, it’s all about transitions from one scene to the next.”

With no out-of-town tryout for “Something Rotten!” before its Broadway run, class at Musical University was in session right up until the show’s opening. There was a lot of work, for instance, on a big tap number performed by criminals in the stocks — until the collaborators finally decided to nix the sequence between the last day of rehearsal and the first day of tech. Another song bit the dust in previews.

That’s par for the course for Broadway previews, but it was brand new for the “Something Rotten!” writers: the ongoing give-and-take of putting their work in front of an audience one day, and the next day writing and rehearsing new material to put into the show that night. “The pace we were working at was a big change for me,” O’Farrell said.

Now, with the Broadway opening of “Rotten!” and its subsequent success with the Tony nominators — not to mention its rising weekly box office — the show’s creators can safely assume they’ve graduated from Musical University at last.

Not that Nicholaw ever thought of it as a formal education. “The guys will say, ‘Oh, it’s like that time you told us such-and-such,’ and I’ll think, ‘Did I say that?’ ” Nicholaw said with a laugh. “We were just doing what we do. It’s from the experience of doing it that you learn.”