Preheat oven to 350°F and line a baking sheet with parchment paper.
Cream butter, brown sugar, and granulated sugar together until light and smooth.
Add egg and vanilla extract, then mix until fully combined.
Add flour, baking soda, cinnamon, and nutmeg. to the wet mixture and mix until just combined.
Fold in shredded carrots and chopped pecans if using.
Scoop about 2 tablespoons of dough per cookie (this makes about 12 large cookies). You can make smaller cookies if you prefer, just reduce the bake time slightly.
Place on the baking sheet and gently flatten slightly.
Bake for 10–12 minutes, until edges are set and centers are still soft.
Remove from oven and allow cookies to cool completely on a wire rack.
In a bowl, beat the powdered sugar and butter until smooth.
Add the cream cheese and vanilla extract, mixing until thick and creamy.
Spoon or pipe a swirl of cream cheese frosting onto each cooled cookie.
Sprinkle with some chopped pecans ontop if you like.