Heat the olive oil or butter in a large skillet over medium-low heat.
Add the thinly sliced shallots and cook, stirring frequently, until soft and translucent and beginning to caramelize, about 8 to 10 minutes.
Stir in the minced garlic and cook for about 30 seconds until fragrant.
Add the trimmed green beans, soy sauce, salt, pepper, and 1/2 cup water; increase heat to bring the liquid to a boil.
Reduce heat to low, cover the skillet, and simmer until the beans are tender-crisp, about 8 minutes.
Remove the lid, raise heat to medium-high, and cook, stirring frequently, until the liquid evaporates and the beans are tender and the shallots are jammy, about 5 to 6 minutes more.
Taste and adjust seasoning with more salt and pepper if needed, then serve warm.