Melt the butter in the microwave (in a heatproof / microwave-safe bowl) or in a saucepan on the stove and set aside to cool down.
In a large mixing bowl, sift together the flour, cocoa powder, baking powder and salt. Slightly mix to combine.
In a separate large bowl, whisk together the egg and sugar for about 3 to 4 minutes or until the mixture has doubled in size, appears paler and has thickened (see note 1). Mix in the milk.
Add the sifted dry ingredients mix and whisk until just combined. Pour in the cooled melted butter and whisk until you get a thick but smooth batter.
Cover with plastic wrap touching the surface of the batter (see note 2). Place in the fridge and refrigerate for at least 3 hours - preferably overnight.
Preheat your oven on 200 degrees Celsius / 390 degrees Fahrenheit. Generously grease a metal madeleine pan with soft butter.
Transfer the chilled batter into a piping bag and cut out the tip to get an opening of about 1cm (1/2-inch) (see note 3). Pipe the batter into the prepared pan, filling each cavity about halfway up. It is really important not to overfill the mold as the madeleines will rise a lot in the oven.
Place in the oven for 3 minutes then lower the temperature to 180 degrees Celsius / 350 degrees Fahrenheit and bake for an additional 4 to 5 minutes.
Place on a wire rack and leave to cool down for 10 to 15 minutes before gently lifting out the cocoa madeleines. Let the madeleines cool down completely.
Chocolate Shell
If using a chocolate bar, finely chop it first. Place in a heat-proof bowl and melt until very smooth and fluid, either in the microwave in 30 seconds increments or over a double-boiler (see note 4).
Using a teaspoon, pour the melted chocolate inside the madeleine pan cavity (about 1 teaspoon of chocolate per cavity; more or less depending the size of your pan). Spread the chocolate around almost all the way to the top of the cavity using the back of the spoon.
Gently press a madeleine over the chocolate and slightly wiggle it around to make the melted chocolate rise up and insure its bottom is fully coated.
When all the madeleine have been coated, place the madeleine pan in the fridge for 30 minutes then in the freezer for 15. When the shells have completely set, the madeleines should easily pop out of the mold (see note 5)
Notes
I whisk the egg / sugar by hands with a whisk, but you can also use a hand mixer or make the batter straight into the bowl of a stand mixer fitted with the whisk attachment. You will want to switch to the paddle attachment when you add the dry ingredients later on.
Alternatively, transfer the batter into a smaller airtight container or smaller bowl first.
This is optional and you could scoop the batter into the pan instead if you don't want to use a piping bag. Using a piping bag simply makes it easier to get an even amount of batter into each mold.
If you find that the chocolate you are using is quite thick once melted (this could happen based on the chocolate brand and type), you might want to add a drop of neutral oil to make it more fluid.
If the madeleines don't easily come out of the mold, use a small blunt knife to gently lift them out.