Preheat your oven to 325°F. Line rimmed baking sheets with parchment paper and set them aside.
In a large bowl, place the flour, xanthan gum, cocoa powder, salt, and granulated sugar, and whisk to combine well. Add the brown sugar, and mix well, breaking up any lumps.
Create a well in the center of the dry ingredients, add the butter, eggs, and vanilla and mix to combine. The dough should come together easily, and be smooth and glossy.
Divide the dough into two equal portions, and place each between two sheets of unbleached parchment paper.
Roll each into a rectangle about 1/4 inch thick, and cut out shapes with a cookie cutter (I used a 3-inch round cutter).
Place the dough on a portable, flat surface like a cutting board and place it in the freezer for 10 minutes.
Remove the prepared cookie dough from the freezer and remove the cookie dough from around the cutouts.
Pulling the parchment paper away from the bottom of each cutout piece of dough, remove them from the paper and place about 1 inch apart on the prepared baking sheets.
With a toothpick or wooden skewer, poke 5 to 6 evenly-spaced holes toward the center of each cutout. These holes will keep the cookies from rising too much.
Sprinkle the tops of the cutouts lightly with the optional coarse sugar, and press the sugar gently to help it adhere to the cookie dough.
Repeat with the remaining dough, including the scraps that you pulled away from the cutout rounds.
Place the baking sheet in the center of the preheated oven and bake until the cookies appear dry on top and have lightened in color, about 7 minutes. Do not overbake.
Remove from the oven and allow to cool on the baking sheet until firm.
Once the cookies are cool, you can make the stiff sandwich cookie filling according to the recipe instructions (follow the link in the ingredients list) and pipe about 2 tablespoons of filling onto the underside of half of the cookies, then top each with one of the remaining cookies.