The research aims to generate a workflow, which subdivides the complex problem of optimizing the buildings energy consumption in smaller problems that can easier be solved. The workflow starts from the definition of the insertion context of the building, which influences it principally regarding the climate, the sun exposure and the shadings. The successive step is choosing one or more optimal wall stratigraphies which show the best combination of different parameters, like cost, transmittance, thickness and emergy. The last step concerns the optimization of the shape as a function of the previously defined stratigraphies and of the energy consumptions for lighting, heating, cooling and electrical equipment.