Preheat your oven to 350°F (175°C).
In a bowl, whisk together flour, baking soda, baking powder, cinnamon, nutmeg, and salt.
In another bowl, cream the softened butter, brown sugar, and granulated sugar until light and fluffy.
Add the egg and vanilla extract to the butter mixture, mixing well.
Gradually add the dry ingredients to the wet mixture, stirring until combined.
Fold in the grated carrots and chopped walnuts, if using.
Drop spoonfuls of the dough onto a lined baking sheet, spacing them 2 inches apart.
Bake for 12-15 minutes, or until the edges are golden.
Remove from the oven and let them cool on the baking sheet for 5 minutes.
Transfer to a wire rack to cool completely before frosting.