According to the Energy Performance of Buildings Directive (EPBD) Recast, building energy retrofitting should aim "to achieving cost-optimal levels". However, the detection of cost-optimal levels for an entire building stock is a complex task. This paper tackles such issue by introducing a novel methodology, aimed at supporting robust cost-optimal energy retrofit solutions for building categories. Since the members of one building category provide highly different energy performance, they cannot be correctly represented by only one reference design as stipulated by the EPBD Recast. Therefore, a representative building sample (RBS) is here used to consider potential variations in all parameters affecting energy performance. Simulation-based uncertainty analysis is employed to identify the optimal RBS size, followed by simulation-based sensitivity analysis to identify proper retrofit actions. Then post-processing is performed to investigate the cost-effectiveness of all possible retrofit packages including energy-efficient HVAC systems, renewables, and energy saving measures. The methodology is denoted as SLABE, 'Simulation-based Large-scale uncertainty/sensitivity Analysis of Building Energy performance'. It employs EnergyPlus and MATLAB®. For demonstration, SLABE is applied to office buildings built in South Italy during 1920-1970. The results show that the cost-optimal retrofit package includes the installation of condensing gas boiler, water-cooled chiller and full-roof photovoltaic system.