As far as defenses go, guard the squares that the AI can reach in one turn.
There is a risk that if an AI can take one of your settlements in one turn, your undefended settlements behind it are now vulnerable within that same turn, so you may consider layering your defense- heavy on the borders, lighter behind it- that of course leaves your borders more vulnerable, but could limit the damage from losing multiple cities from a strong first strike to losing just one.
In addition to your defenders, it is good to keep a mobile attack squad to pick off stray attackers or eat at a stack of death.
As long as your cities are close enough for your defenders to move from one city to the next in one turn, faster than your attackers, you can play a shell game with an AI attacker. As long as you can move your defenders from one city to the other in one turn while it takes your AI attackers two turns to move from city to city, you can keep moving your defense from one to the other from turn to turn, forcing the AI to switch its target to the undefended city from turn to turn. While the AI attackers run around in circles, you can hit them with your attack squad and/or artillery each turn until you whittle them away.
As to tech research, some techs are "dead-end" techs. Those are techs that are not necessary to move to the next era, and Democracy is one of those dead-end techs. (They have the stop symbols in the upper right-hand corner of the boxes on the tech tree.) So you can skip Democracy and Printing Press if you never plan to enter Democracy. Only the techs on the last, far right column of the tech tree are necessary to move to the next age.
Disband obsolete units. Spearmen have the same upkeep cost as mechanized infantry. So your modern age spearmen are just eating away at your economy. How far obsolete they should be before you disband them is up to you. Upgrading is always an option, but expensive (if you have Leonardo's Workshop, it's less expensive). If they are one level below your best unit (say spearmen when you can build pikemen), maybe keep them around in case you need to do an emergency upgrade due to an unexpected AI attack. Otherwise, disband them in cities that can use the extra production and build replacements.
I'm not good at specializing my cities, it's not a skill I have developed yet. The main thing is to just be aware that (1) building one improvement prevents you from building another improvement or units, and (2) buildings have upkeep costs. If you are concerned about happiness, increasing your gold production and using the slider to devote 10% of your income to happiness may be more cost effective at providing happiness. Though you may want culture from the temple too. And maybe you think you are being a responsible leader by providing everyone with a temple. But be aware of the costs, alternatives for achieving your goals, and where things fit on your priority list. I tend to build temples everywhere in my games too, but unless my civilization has the Religious trait (which I do like), temples come after population growth (e.g. granaries) and economic growth (e.g. marketplaces).
Granaries and marketplaces are almost always good in any city. Building them as quickly as possible exponentially expands your growth. Early in the game you may want to delay a marketplace in your settler factory, or to build a barracks or two to get your defense rolling. A barracks in every city in your core for emergency unit production may be a good idea, but if you are not using the city primarily to build units, it should go at the bottom of your priority list.
There is a risk that if an AI can take one of your settlements in one turn, your undefended settlements behind it are now vulnerable within that same turn, so you may consider layering your defense- heavy on the borders, lighter behind it- that of course leaves your borders more vulnerable, but could limit the damage from losing multiple cities from a strong first strike to losing just one.
In addition to your defenders, it is good to keep a mobile attack squad to pick off stray attackers or eat at a stack of death.
As long as your cities are close enough for your defenders to move from one city to the next in one turn, faster than your attackers, you can play a shell game with an AI attacker. As long as you can move your defenders from one city to the other in one turn while it takes your AI attackers two turns to move from city to city, you can keep moving your defense from one to the other from turn to turn, forcing the AI to switch its target to the undefended city from turn to turn. While the AI attackers run around in circles, you can hit them with your attack squad and/or artillery each turn until you whittle them away.
As to tech research, some techs are "dead-end" techs. Those are techs that are not necessary to move to the next era, and Democracy is one of those dead-end techs. (They have the stop symbols in the upper right-hand corner of the boxes on the tech tree.) So you can skip Democracy and Printing Press if you never plan to enter Democracy. Only the techs on the last, far right column of the tech tree are necessary to move to the next age.
Disband obsolete units. Spearmen have the same upkeep cost as mechanized infantry. So your modern age spearmen are just eating away at your economy. How far obsolete they should be before you disband them is up to you. Upgrading is always an option, but expensive (if you have Leonardo's Workshop, it's less expensive). If they are one level below your best unit (say spearmen when you can build pikemen), maybe keep them around in case you need to do an emergency upgrade due to an unexpected AI attack. Otherwise, disband them in cities that can use the extra production and build replacements.
I'm not good at specializing my cities, it's not a skill I have developed yet. The main thing is to just be aware that (1) building one improvement prevents you from building another improvement or units, and (2) buildings have upkeep costs. If you are concerned about happiness, increasing your gold production and using the slider to devote 10% of your income to happiness may be more cost effective at providing happiness. Though you may want culture from the temple too. And maybe you think you are being a responsible leader by providing everyone with a temple. But be aware of the costs, alternatives for achieving your goals, and where things fit on your priority list. I tend to build temples everywhere in my games too, but unless my civilization has the Religious trait (which I do like), temples come after population growth (e.g. granaries) and economic growth (e.g. marketplaces).
Granaries and marketplaces are almost always good in any city. Building them as quickly as possible exponentially expands your growth. Early in the game you may want to delay a marketplace in your settler factory, or to build a barracks or two to get your defense rolling. A barracks in every city in your core for emergency unit production may be a good idea, but if you are not using the city primarily to build units, it should go at the bottom of your priority list.