Climate change mitigation and transformation strategies with expansion targets for renewable energy sources are defined at the national level. Due to the decentralised character of these sources, local energy system planning plays an important role. However, local communities often lack the capacity to develop energy concepts and thus exploit local renewable potentials consistently. This study develops a highly transferable methodology for deriving local energy system transformation scenarios in line with national greenhouse gas reduction strategies. Thus, an energy system optimisation model is substantially extended to collectively optimise the transformation of final energy demand in the residential, industry, tertiary and transport sectors, as well as established and niche greenhouse gas reduction technologies. Here, a focus is set on the building stock transformation, and a stochastic model is presented to better grasp and represent the dynamic developments and heterogeneity of the local building stock. Based on superordinate parameters such as retrofit rates and heating technology diffusion, the stochastic model generates informative building stock scenarios that are used as input for the developed energy system optimisation model. Exemplarily, the model is applied to the central European city of Karlsruhe. The results show that an increase of the retrofit rate to 2 %/a and strong electrification of the heat supply in the building sector is economically and environmentally beneficial. Furthermore, an accelerated expansion of photovoltaics compared to the national expansion rate can save costs and CO2 emissions. Building on the methodology presented, transferable infrastructure models for the electricity, gas and district heating network should be developed that can be used to assess the feasibility of the transformation paths determined by the methodology presented.