Luckily, great chefs love a challenge – and that’s who you want on the front lines of gluten-free pasta R&D. They have the skill set, and they find the resources to make it happen. Even then, it can take months of trial and error. Or, in the case of Nicholas Stefanelli at Masseria in D.C., you can pull the lever after a couple of tries and strike it rich.

Ed Scarpone spent about half a year on the gluten-free fresh pasta recipe he developed at Cafe Boulud in New York. “I did a lot of work with different flours,” he says. “We ended up using broad bean and chickpea flours, water, milk, eggs and a little bit of olive oil. A gram here and there could change things.”

Now head chef at DBGB in CityCenterDC, Scarpone also kept in the mix guar and xanthan gums, both widely used components in the gluten-free universe: The former, a natural thickener, adds elasticity to the pasta dough, and the latter emulsifies the wet ingredients and adds body. Fettuccine and pappardelle worked best, he remembers. His gluten-free pasta dough would dry out quickly and could not withstand much manipulation, which meant that shaping and filling it was tricky business. A 10-minute rest for the dough (while vacuum-packed) helped it hold together during cooking, and the cut pasta could be held in the freezer.

He hasn’t re-created a GF pasta program at DBGB – yet. “It’s tough, unless you’re making it every day,” Scarpone says. “It takes finesse. The eggs you use might not be the same size or temperature. You can just throw a gluten-free flour blend together with eggs and such . . . you won’t get a bad product, but I don’t think it mimics good fresh pasta.”

Stefanelli has enchanted diners with his gluten-free maccheroni since shortly after Masseria opened last August. During his previous five-year star turn at the helm of Bibiana downtown, he eventually used an Italian brand of GF pasta. And when it came to cooking it, “angels needed to ride down on a unicorn to get it right,” Stefanelli says dryly. Translation: Either under- or overcooked, the stuff would just crumble.

He admits that developing the product in-house at the new restaurant “wasn’t at the top of my list.” A fan of dried pastas, “I had explored other options and didn’t find anything on the market that did it justice,” he says.

Then, Masseria pastry chef Jemil Gadea decided to experiment with the Italian gluten-free flour blend he had on hand for crostati. The Caputo brand contains cornstarch, rice flour, potato starch, soy flour and xanthan gum. Gadea tinkered with minuscule amounts of an added super-strength tapioca starch called Ultra-Tex 3 (both it and the Caputo blend are available online) and got it right after only a few tries. The chefs used a lot of liquid egg yolks rather than whole eggs, for the grace of added, binding fat.

On a recent afternoon, the restaurant’s gluten-free dough comes up a sunny, cornmeal yellow after several minutes’ turn in a heavy stand mixer. It doesn’t need a rest and can be rolled in a pasta machine – a little thicker than spaghetti – then cut and cooked straight away. Stefanelli slices his maccheroni with surgical, even knife strokes, creating shorter lengths akin to the wheat maccheroni he serves with nduja, tomato and eggplant.

In the few minutes it takes the chef to cook and sauce a single portion, the remaining batch of gluten-free pasta dough on the cutting board becomes noticeably drier. At a visitor’s request, he pinches enough dough to roll a few garganelli against the grooved board he has pulled from a handsome wooden box of pasta tools.

“See? You can do it. But there are little cracks or dry spots in each one,” he says. “The good thing about the gluten-free maccheroni is that it can take a little abuse in the pan.” By abuse, he means tossing the freshly cooked noodles in Masseria’s lip-smacking XO sauce, then twirling them into the shape of a cannelloni, giving it the mummy-strips treatment on the plate.

The visitor’s one bite in, and Stefanelli is chuffed by the reaction of yet another satisfied customer. “It absorbs like regular fresh pasta, right?” he affirms. “And it has an al dente-ness, a bite that holds together. You won’t find that in a lot of gluten-free pastas.”

The good news is, Masseria’s gluten-free maccheroni can be re-created at home. (See the accompanying recipe.) Required: a kitchen scale, a stand mixer, the right ingredients and a steady hand. Some Stefanelli tips: The generously salted water doesn’t need to be at a full, rolling boil, nor does the pot need to be bigger than a large saucepan.

Drop in one portion of the maccheroni at a time. Do not walk away. Once the noodles start to float, cook them for another 30 seconds or so. Strain them, and scoop directly into a pan of warm sauce: say, a simple tomato-basil or aglio e olio. Plate up the order and stick a feather in your cap.