In a bowl (or stand mixer), add the butter and sift over the icing sugar and cocoa powder (and cayenne if using).
Beat for 2–3 minutes until smooth and combined, scraping down twice.
Add the egg yolks while mixing. Beat for 30 seconds, scrape down, then mix for another 30 seconds.
Add the flour and salt, mixing on low just until combined (about 15 seconds). Do not overmix.
Shape into a disc, wrap, and refrigerate for 1 hour.
Let the dough soften slightly, then roll out on a floured surface.
Cut bases using mini tart rings.
Roll remaining dough into thin strips and line the sides, pressing gently to seal.
Trim edges and freeze for 30 minutes.
Preheat oven to 175°C (160°C fan).
Bake for 20–25 minutes (check at 18 minutes for minis).
Lightly brush with egg wash and bake for another 8–10 minutes until set.
Cool completely.