Four days before his scheduled release from California’s oldest prison, Daniel Martinez was covered in flour in a San Quentin kitchen, beating eggs, kneading dough and chopping nuts.

Next week, when his seven classmates graduate from the Quentin Cooks program, Martinez plans to be at home with his wife in Sacramento, following up on a few job opportunities he’s been connected with through the prison’s culinary training course.

“I’m very ambitious,” he said Wednesday, pausing from the flow of washing dishes, “very determined to succeed out there.”

Martinez, who has been inside San Quentin State Prison for the past 16 months, signed up for the 12-week cooking class series in part because he wants to keep up with his wife in the kitchen at home after he’s released.

“She’s a great cook,” he said.

A former restaurant manager, Martinez was also eager to learn skills that would boost his understanding of back-of-the-house operations. He plans to jump back into the service industry.

“I just wanted to enhance my skills and have more options to provide for my wife and I,” he said.

Martinez is confident that he’ll find a job quickly. That confidence is what Helaine Melnitzer envisioned when she co-created the Quentin Cooks program in 2016.

“We’re giving them phenomenal skills,” she said.

Melnitzer, a food industry veteran, saw an opportunity to benefit both Bay Area restaurants, many of which are often starving for employees, and formerly incarcerated people, who sometimes struggle to find employment after they are released from prison.

She assembled a team of volunteer chefs to teach weekly classes to San Quentin inmates scheduled for release. At the end of the course, graduates take the ServSafe exam and, if they pass, they receive a food handler certificate, a credential that many kitchens require.

Melnitzer and the other volunteers follow up with the participants after they are released and help them find employment. The current class will be the fifth to graduate from the program.

At the graduation ceremony on Wednesday, the inmates will serve a meal to roughly 50 guests who will come to learn about the program. According to Melnitzer, many of the attendees will be food industry representatives and some might be interested in hiring graduates.

For Derry Brown, the weekly classes have been both fun and productive.

“I like cooking but I didn’t have any structure to it,” he said. “This class has given me some structure.”

On Wednesday, chef Huw Thornton taught the class how to make pasta by hand. The eight inmates each folded eggs into flour and formed balls of pasta dough that they rolled out into strips and cut into small gnocchi dumplings.

Later, a guard brought out knives hooked to chains and locked them to prep tables, allowing the men to cut vegetables and nuts they used to make pasta sauce.

From a kitchen window, rows of coiled razor wire could be seen lining a fence that surrounds the prison. But for the inmates making pasta and savoring the flavors of a meal cooked from scratch, the cooking class was a chance to be distracted from the reality of prison life, some said.

“I’ve had one of the guys tell me, ‘Doesn’t this food taste like freedom?’” Melnitzer said.