When playing with one city (or 2-3) - capture and burn all neighboring AI cities. It requires the most extensive space from the borders to your cities, on which you can maneuver the army. You need a lot, a lot of land so that the troops can retreat and heal, because the loss of 1 out of 3 cities is much more painful than the loss of 1 city out of 10-15.
Also, don't wait until the AI decides to declare war on you - when it's ready to do so, it's unlikely you'll be able to stop it without a lot of effort. Declare war yourself in advance, even if your army is weaker.
A dangerous neighbor needs to declare wars on schedule and stretch them out as long as possible - 50-70 turns, until the population starts to rebel. As soon as the truce is over, we start a new campaign. This allows you to conclude a truce in those moments when another empire decides to attack you and there is no desire to fight on two fronts at the same time. Your neighbors should curse you for being near them. Make friends with those who are very far away and have no common borders with you. They won't even think of declaring war on you because of border friction.
Also, the more often you fight, the more Great Generals you have with which you can build Citadels. AI is very bad at fighting Citadels. One Citadel with 1-2 units (swordsman + archer) in a good bottleneck is able to block the entire enemy army.