A lot of these tips come from Serious Eats.
Boil the beans for just three minutes, then chill them thoroughly in cold or iced water. The beans will cook a bit more with the dressing, so this keeps them crispy-tender instead of leathery-mushy.
Toast the almonds in the butter over medium-low heat, stirring frequently. The butter will slowly brown as the almonds toast. It should take about five minutes for the almonds to deeply brown.
Add the shallots and garlic, still stirring. It should take about two more minutes for them to get soft. (They don't need to caramelize.)
Add lemon juice to the pan. Serious Eats says to add a little water as well and form a vinaigrette of sorts, but I figure the beans will bring water with them.
Add the beans and toss to coat. If the beans are wet, gently stir them over medium heat until most of the water evaporates and the dressing is glossy.
This dish is delicious with creamy mashed potatoes, as the crunch of the almonds gives a pleasing contrast in texture.