5 ounces semisweet or bittersweet chocolate, finely chopped
2 tablespoons unsalted butter, cut into pieces
1 teaspoon vanilla extract
Store-bought mini pastry shells
Lightly whipped cream
1 tablespoon finely chopped pistachios with a pinch of salt (or ground chili flakes or whole almonds or pecans)
In a medium-size saucepan over high heat, combine 2 cups milk, 1/4 cup sugar, and salt; bring to a boil, stirring to dissolve the sugar. Remove from heat.
In a medium-size bowl, whisk together cornstarch, unsweetened cocoa powder, and remaining 1/4 cup sugar. Add remaining 1/4 cup milk and whisk until smooth.
Whisk this mixture into the hot milk in the saucepan and bring to a boil over moderate heat, whisking constantly. Reduce heat to moderately low and simmer, whisking constantly, until pudding is thick enough to coat the back of a spoon, about 2 minutes.
In a medium-size bowl, whisk whole egg with egg yolks. Gradually whisk about 1 cup of hot cocoa pudding into eggs until thoroughly incorporated; then scrape pudding back into saucepan. Cook pudding over moderate heat, whisking constantly, until it just comes to aa boil, about 2 minutes.
Strain pudding into a medium-size heatproof bowl. Add chopped chocolate, butter, and vanilla; whisk until chocolate and butter are melted and incorporated and pudding is smooth, about 2 minutes.
Transfer to a bowl or to six 6-ounce ramekins. Press a piece of plastic wrap directly onto the surface of the pudding and refrigerate until chilled.
To serve, place in a pastry bag and portion into pastry shells. Top with whipped cream; garnish with ground pistachios, chili flakes, or whole nuts, or make a mixed platter of all three.