Your refrigerator is one of the toughest kitchen elements to plan. It’s huge and requires specific clearances on all sides.
If you decide to position your fridge up against a wall or window, you’ll need extra space to accommodate the door swing. If you don’t plan ahead for this, you could get all the way through installation before realizing your door won’t open 90 degrees (and this is not often discussed in the product literature).
The plan view here is from Katy’s kitchen (profiled in this blog article). Here, the adjacent wall had a window with large trim. That caused us to need even more space so the door wouldn’t hit the window trim. Six inches is usually plenty — you may be able to get by with less depending on the model of your refrigerator and proximity of nearby obstructions.