In a large straight-sided skillet with a lid, melt butter over medium-high heat. Add onion and garlic. Cook, stirring occasionally, until translucent, about 3 minutes. Meanwhile, lightly beat egg in a medium bowl. Add groats, and stir until well coated. Add groats to skillet, and increase the heat to high. Cook until the egg has dried on the groats and the kernels are separated, about 2 minutes. Add stock, and season with salt and pepper. Reduce the heat to low, and simmer, covered, until tender and all of the liquid has absorbed, 7 to 10 minutes.