Sorry. Serious answer: I honestly don’t believe there are any actual codified grammar rules for this. There are SO many different constructions, even sincere ones (rather than the joke ones like Baltimoron), and they’re mostly SO different from each other.
The majority of them appear to have one of four derivations:
[ul][li]The suffixes -(i)an(s) or -er(s)[/li][li]Derivation from the city name by relatively simple rules, e.g., cities with names ending in -town are often inhabited by -tonians; Names such as Toronto or Cairo are treated as if Latin nominatives.[/li][li]The rules applicable in the language spoken in the foreign city and its namesakes are applied also in English, e.g., Moscow, Muscovite; Krakow, Krakovian; Madrid, Madrileño; Padua, Padovan.[/li][li]The actual old Latin name for the community is reverted to for the derived inhabitan name: Manchester, Mancunia, Mancunian; Cambridge, Cantabrigia, Cantabri(d)gian; Marseilles, Massilia, Massilian [rare but I have seen it]; Carthage, Carthago [gen. -aginis], Carthaginian.[/ul] [/li]
Occasionally, English will borrow a slangy foreign form, e.g., Rio de Janeiro, Ca. Rio, Carioca.
You might try looking for the word “demonym”, which is the name for a word which describes a population. As long as there are Glaswegians and Bay Staters, though, you won’t find any solid rules. There are many hundreds of standard ones that are easy to figure out, but this is English, so there’s also weirdness afoot.
A modern Russian derivation would be Moscvich not Muscovite. Muscovite is an old Russian derivation that is typically used to refer to Moscow residents of that period.
As for Krakovian, I think that’s an English formation, not Polish. I’d guess a Polish derivation would be Krakowianin or Krakowiak