I guess I am a mixture of both. I plan our meals about ten days in advance, and make sure I have everything I need for them in the shop, but I plan meals that are seasonal, so I kind of expect things to be in the shop. That way is a cheaper way to eat I find. If I have forgotton something I need then I trnd to improvise, although I will stock up on fresh vegetables/milk through the week, I know what I am buying later in the week. I take my list with me. Because I market shop sometimes I occasionally find a gem that I did not expect too, or there is a special offer on something, or, now because I am finding ingrediants that are new to me, I will cross out a meal on my list and then replace on the hoof...I tend to be pretty organised now about buying food.planning meals - my budget demands it!
I follow a recipe the first time I make something, and then I know what I want to change next time, I am a bit of an adder, ie I add a bit of whatever is to hand that I think will work. My favourite recipes are the ones that are my own, but they're success depends on me having followed a recipe before.
I think I am a mixture of your two types of cook.