Cream butter and sugar until light and fluffy.
Add egg and vanilla extract; mix until fully combined.
Whisk flour, cocoa powder, baking soda, and salt in a separate bowl.
Add dry ingredients to wet mixture and mix just until combined.
Cover dough and refrigerate for 30 minutes.
Preheat oven to 350°F (175°C) and line baking sheets with parchment paper.
Scoop about 1 tablespoon dough, roll into balls, and roll in sugar if using.
Place cookies 2 inches apart on baking sheet.
Bake for 9–11 minutes until edges are set and centers are soft.
Remove from oven and immediately press one caramel candy into the center of each cookie.
Cool on baking sheet for 5 minutes, then transfer to a wire rack to cool completely.
Sprinkle flaky sea salt on top while warm if desired.