Heat milk in a saucepan over medium heat until it just simmers
Whisk sugar, egg yolks, and cornstarch until smooth and pale
Slowly pour about half the hot milk into the egg mixture while whisking constantly to temper the eggs
Pour the tempered mixture back into the saucepan and cook over medium heat, whisking constantly, until it thickens and gently boils
Remove from heat and stir in butter and vanilla until smooth and glossy
Strain through a fine sieve into a bowl
Cover surface directly with plastic wrap to prevent skin formation and chill for at least 2–3 hours
For chocolate version: whisk sugar, egg yolks, cornstarch, and cocoa powder together until smooth
Add chopped chocolate, butter, and vanilla to chocolate mixture and stir until completely melted and smooth
For lemon curd: whisk together lemon juice, zest, sugar, egg yolks, and salt in a saucepan
Cook over medium-low heat, stirring constantly, until mixture thickens and coats the back of a spoon
