Energy planning tools play a key role in achieving sustainable development goals and in the energy transition toward a zero-carbon future. Energy security and decentralization are, as well, additional benefits from a rational energy planning applied to a territory. In particular, the relevance of territorial energy planning grows at the local scale, the peculiarities of a territory being a key point. This is especially true for Municipalities, which represent the smallest units with political responsibility. Cities are often the most unsustainable environments, being responsible for 75% of global energy use, 70% of global CO2 emissions, and considering that the percentage of the global population living in cities is expanding from 50% in 2022 to 70% in 2050. In this regard, the European Community has already designed a specific energy planning tool, called SECAPs (Sustainable Energy and Climate Action Plans), an evolution of SEAPs (Sustainable Environmental Action Plans) that allows the quantification of energy flowing throughout the territory to support the local economy. The greenhouse gases emission commitments are, as well, considered and could be fulfilled being the cornerstone of the European deal on climate change. Waiting for a zero Carbon economy, the intention of the cited plans is to propose mitigation and adaptation actions to delay or to react to climate change manifestations. A formidable new planning tool is certainly “Energy Communities”, where cities, public and private companies, citizens, energy producers and consumers (so called prosumers) can share renewable energy in whatever form is locally available, improving energy security and partial independence from the grid. The paper presents, for a small/medium size Italian city located in the Apennine Mountain hinterland some criteria to design energy communities demonstrating how the potential energy generation based on renewable sources can fulfil energy demand when an Energy Community is organized. The starting point is the knowledge of thermal and electricity consumptions available from SEAPs. Hourly load profiles for them were reconstructed and coupled to renewable energy production availability which is a peculiarity of a territory. Thanks to a suitable diversification of energy production, the fulfilment of the energy needs can be achieved with only a residual grid assistance. Consistency is given to the concept of energy resilience.