Last month, Saturday Night Live premiered “RBG,” a parody rap featuring self-proclaimed comedians Pete Davidson and Chris Redd screaming the praises of Supreme Court Justice Ruth Bader Ginsburg. The repetitive lyrics and simplistic production, coupled with the inexplicably ear-splitting vocals, make for an excruciating attempt at musical comedy.

Such grating sketches make me nostalgic for a better time, when SNL was home to songs that weren’t just shoddy hagiography of moderate judges, when it had parodies that were slickly produced, well-written and, above all else, hilarious.

Ten years ago this week, that era got its start, when The Lonely Island erupted onto the scene with “Jizz In My Pants.”

This wasn’t the first dose of fame for Andy Samberg, Akiva Schaffer and Jorma Taccone. They went viral with the 2005 sketch “Lazy Sunday,” in which Samberg and fellow SNL star Chris Parnell aggressively rap about The Chronicles of Narnia (emphasis on “Chronic”). They won an Emmy for the Justin Timberlake-featuring “Dick in a Box” — which is pretty self-explanatory — and put together the 2007 box office bomb Hot Rod.

But The Lonely Island’s distinct brand, a blend of surreal humor and cringe comedy, didn’t really catch on until “Jizz In My Pants.” It’s a pitch-perfect imitation of mid-aughts synth-pop, with pounding bass providing the backdrop for Andy and Jorma’s Received Pronunciation lamentations of their sensitivity. And the pop tropes in the music video — the dim lighting, the flashing strobes, the oversized sunglasses, the sleeveless vests — tie the whole thing together.

“Jizz In My Pants” premiered on SNL on Dec. 6, 2008, and was uploaded to the Lonely Island’s YouTube channel the same day. It racked up 3.6 million views within five days (which was a lot back then) and reached 13.3 million by year’s end. It charted on the Billboard Hot 100 in January 2009, and eventually it was certified as platinum — quite a feat for a song about two guys who have to wear condoms all the time.

Many parody artists — Epic Rap Battles of History comes to mind — try to take aim at public figures or news items, and end up covering the same ground as many others. The Lonely Island takes a different approach: They parody the music itself, zeroing in on a specific element or subset of a genre and working backward to find a way to blow it to pieces (often with the assistance of guest stars who have actually worked in said genre).

“I’m On a Boat” is a sendup of the materialism prevalent in hip-hop. Andy and Akiva flex alongside T-Pain after winning a (presumably brief) free boat ride from a cereal box. Decked out in tuxedos, they pop champagne, host a barbecue and fool around with mermaids aboard a yacht they don’t own.

“I Just Had Sex” takes the increasing use of innuendo in popular music to its logical confusion, with Andy, Jorma and Akon as earnest losers bragging about how their penises feel over an bouncing pop beat.

“Jack Sparrow” satirizes the patchwork nature of rap-pop collaborations, which are often written in pieces and thrown together in the studio. Asked to write a hook for a song about hitting the club, Michael Bolton responds with a passionate ode to the Pirates of the Caribbean protagonist — much to The Lonely Island’s bewilderment.

“Motherlover” — the sequel to “Dick in a Box” — brings Andy and JT back as two confident casanovas looking for love and Mother’s Day gifts. Like in many R&B songs, they croon in dulcet tones about how they’ll seduce their mates; unlike in many R&B songs, those mates happen to be each other’s mothers.

Hits like these earned The Lonely Island a cult following of suburban white kids of a certain age (like me), and brought them popularity with music fans of all stripes. The absurdity of the premises, juxtaposed with the high production values, make them difficult to dislike, and since they focus on music rather than current events, their work is rarely political (“Spring Break Anthem” being a notable exception).

The Lonely Island’s parodies come from a place of love. They’ve always been fans of hip-hop, and they’re more interested in poking fun than tearing down. And their songs are self-deprecating, which is something any schlubby hip-hop fan — or horribly awkward teenager — can certainly relate to.

All of this started with “Jizz In My Pants,” which has aged remarkably well for a song about prematurity. Compared to the worse-than-Soundcloud rap that passes for parody on SNL these days, The Lonely Island’s works are a master class in musical comedy. If the show can’t find someone who’s funny enough to fill their shoes, maybe it should look for an audience with a shorter attention span.