Andy Samberg, like Robin Williams or Ben Stiller, is one of those jester comics who need to be managed. He’s funniest when the writing is sharp and the producers understand that a little of him can go a long way. His style of humor and his persona — the juvenile in all of us — are best when served up in precise amounts.

The creators of the cop-shop sitcom “Brooklyn Nine-Nine” — Daniel Goor and Michael Schur of “Parks and Recreation” — handle Samberg perfectly. His adult kid, Detective Jake Peralta, is an important part of the workplace ensemble, but he doesn’t overwhelm the show. While’s he’s prominent in the premiere, Tuesday at 8:30 p.m., he’s balanced out by the promise of a strong cast, most notably Andre Braugher as the tough new house captain. Just as Goor and Schur have built an extraordinarily faceted ensemble on “Parks and Recreation,” they’ve stocked the precinct house in “Brooklyn Nine-Nine” with potential. From the klutzy Joe Lo Truglio (“Reno 911”) to the witheringly sardonic Chelsea Peretti, there’s an embarrassment of riches here.

The show is a sendup of TV’s countless crime dramas, goofing on all the “Law & Order”-type clichés and plots. Peralta and his partner, the by-the-book Amy Santiago (Melissa Fumero), solve murders that are fairly ridiculous, and perp chases sometimes end up with a cop slathered in ice cream. But that aspect of “Brooklyn Nine-Nine” is primarily the backdrop for the barbs, the banter, and the nascent romantic tensions of the cops. Peralta and Santiago are intensely competitive with each other over who can crack the most cases, but underneath the taunts — yes, it’s a sitcom — they’re probably flirting.

The show’s central dynamic is between Peralta and Braugher’s Captain Ray Holt, between cocky irreverence and authoritarianism. Peralta has been able to get away with being silly and unconventional because he’s such a good cop. “The only puzzle he hasn’t solved,” says Sergeant Terry Jeffords (Terry Crews), “is how to grow up.” Holt wants to take on Peralta, to force him to wear a tie and act more professionally. That leads to a great battle of wits between the two that Peralta keeps losing. Where their struggle ends up and why Holt is so committed to the rules — well, there are a few surprises on “Brooklyn Nine-Nine.” While there’s something vintage about the show, as it follows in the footsteps of “Barney Miller,” it’s also got fresh twists that firmly place it in the now.

Braugher anchors Samberg’s performance, and indeed he anchors the whole show. He slides from his expert deadpan to poignancy and back again almost invisibly — it’s a marvelous trick. After watching him look so complex and troubled on a number of dramas including “Homicide: Life on the Street,” I wasn’t sure Braugher could be funny. Then I saw him deliver a relaxed, often humorous performance on the extraordinary “Men of a Certain Age,” using his gravitas for laughs, and I realized that he’s quite versatile. On “Brooklyn Nine-Nine” he takes his comedic skills to another level, per the demands of a sitcom, although he never falls into stereotypically broad sitcom habits — no fast-talking, no mugging for the camera. I look forward to seeing where he takes his character.

And I look forward to seeing whether “Brooklyn Nine-Nine” stays good. Fox sent out only one episode for review, so I can’t be sure if the show will continue to be as effortless, amusing, and buoyant and if it is in fact the fall season’s best new network comedy.