Step 1: Prepare the Pie Shell - Bake the pie shell as per package instructions or pre-bake until golden brown and cool completely.
Step 2: Mix the Dry Ingredients - In a medium mixing bowl, whisk together the sugar, cocoa powder, all-purpose flour, and salt until well blended.
Step 3: Heat the Milk - Heat the milk in a saucepan or double boiler over medium heat until hot but not boiling, stirring occasionally.
Step 4: Combine and Cook - Gradually add hot milk to dry ingredients, whisking to avoid lumps. Return to heat and stir until thickened and bubbling.
Step 5: Add Egg Yolks - Beat egg yolks in a small bowl, then temper and whisk into the thickened filling.
Step 6: Add Vanilla - Stir in vanilla extract for flavor.
Step 7: Fill the Pie Shell - Pour the filling into the cooled pie shell, smoothing the top with a spatula.
Step 8: Chill - Refrigerate for at least 4 hours until set.
Step 9: Serve - Top with Cool Whip or whipped cream before serving.