1) Act immediately and aggressively at the first sign of potential virus.
2) Get your population used to wearing masks when ill with cold like viruses and thus ensure sufficient supplies and willingness to wear masks when the government mandates it.
3) Preferably be an island or have absolute control of your country (China)
There was a period when countries could've done what Taiwan did but once the virus got a hold in continental europe and usa it was over.