Melt the butter in a small pan over medium heat and cook until it turns amber and smells nutty, then pour it into a bowl and let it cool until warm.
Add the brown sugar and white sugar to the butter and whisk until smooth and shiny.
Mix in the egg and vanilla until the batter looks thick and glossy.
Stir in the sourdough discard until the mixture is smooth with no streaks.
Add the flour, baking soda, and salt, then stir gently until a soft dough forms with no dry spots.
Fold in the chocolate chips until they are spread evenly through the dough.
Scoop tall mounds of dough onto a parchment-lined baking sheet, leaving space between them.
Press a few extra chocolate chips on top of each mound so they show after baking.
Bake at 350°F (175°C) for 10–13 minutes until the edges are light golden and the centers still look soft.
Sprinkle flaky salt on top right after baking if using, then let the cookies cool on the pan for 10 minutes before moving them.