Preheat the oven to 360°F/180°C and line two baking sheets with parchment paper (Note 5).
Melt butter in a small saucepan (or the microwave). Leave to cool slightly until needed.
Mix flour, baking powder, salt, and cocoa powder in a bowl. Set them aside.
Beat brown sugar, granulated white sugar, and egg in a large bowl until creamy. Stir in the vanilla extract.
Alternating, add the melted and cooled butter and the flour mixture to the sugar-egg mixture and mix well. The dough will be smooth, dense, and slightly sticky.
Sprinkle the chopped walnuts on top of the dough. Mix them with a spoon or hand, ensuring they are evenly distributed in the dough.
Form about 30 balls and place them on the prepared cookie sheets leaving enough place between them (they will spread).
Bake for 12 minutes in the preheated oven. Leave them on the baking sheet for about 10 minutes until they are firm enough to move, then transfer them to a wire rack to cool completely.
Glaze: Mix the confectioners’ sugar and ½ tablespoon milk in a small bowl to form a paste. Add a tiny bit more milk if necessary to obtain the desired consistency, a thick yet pourable paste.
Sprinkle the chocolate cookies with the glaze (use a teaspoon) and then with the sprinkles.