1. For the cookies: Preheat the oven to 375°F. Lightly grease two baking sheets, or line them with parchment paper.
2. In a medium bowl, whisk together the flour, baking soda, baking powder and salt; set aside. In a large mixing bowl, cream together the the butter, brown sugar, and peanut butter. Beat in the vanilla.
3. Add the eggs one at a time, scraping the sides and bottom of the mixing bowl to make sure everything is evenly mixed.
4. Add one third of the dry ingredients, and mix until moistened. Add half of the buttermilk, and mix until combined. Scrape the sides and bottom of the mixing bowl, then add the remaining flour mixture and remaining buttermilk. Scrape the bowl again during this process; the peanut butter tends to stick to the bottom.
5. When the batter is evenly mixed, stir in the chocolate chips, if using. Scoop by the quarter cup for large pies onto the prepared baking sheets, leaving 1 1/2 inches between each scoop.
6. Bake for 12 to 14 minutes, until the tops spring back when lightly touched, and a skewer inserted in the center comes out clean. Remove from the oven and cool completely on a rack before filling.
1. For the filling: Place the cocoa, chips, and salt in a medium bowl.
2. Bring the heavy cream to a simmer, either in the microwave or in a small pan on the stove, and pour it over the chocolate.
3. Stir until the mixture is smooth, add the vanilla, and set aside to cool to room temperature.
4. In a large mixing bowl, cream together the butter and shortening with half of the confectioners' sugar until fluffy.
5. The mixture will go through a crumbly stage, where it doesn't seem it will come together. That's OK; just keep beating.
6. Once the mixture becomes smooth, add half of the cooled chocolate mixture, and beat until it's incorporated.
7. Be sure to scrape the bowl: you can see why.
8. Add the remaining chocolate and confectioners' sugar, and beat until you have a fluffy, spreadable mixture.
9. Add another tablespoon or two of cream if necessary, to adjust the consistency of the filling.
To assemble: Scoop and spread 2 tablespoons of filling onto the bottom of one of the cookies. Place another cookie, bottom toward the filling, to make the whoopie pie.