  We develop an economical theoretical framework for combined explanations of
the flavor physics anomalies involving muons: $(g-2)_\mu$, $R_{K^{(*)}}$, and
$b \to s \mu^+ \mu^-$ angular distributions and branching ratios, that was
first initiated by some of us in Ref. [1]. The Standard Model (SM) is
supplemented with a lepton-flavored $\mathrm{U}(1)_X$ gauge group. The
$\mathrm{U}(1)_X$ gauge boson with the mass of $\mathcal{O}(0.1)$ GeV resolves
the $(g-2)_\mu$ tension. A TeV-scale leptoquark, charged under the
$\mathrm{U}(1)_X$, carries a muon number and mediates $B$-decays without
prompting charged lepton flavor violation or inducing proton decay. We explore
the theory space of the chiral, anomaly-free $\mathrm{U}(1)_X$ gauge extensions
featuring the above scenario, and identify many suitable charge assignments for
the SM$+3\nu_R$ fermion content with the integer charges in the range $X_{F_i}
\in [-10,10]$. We then carry out a comprehensive phenomenological study of the
muonic force in representative benchmark models. Interestingly, we found models
which can resolve the tension without conflicting the complementary
constraints, and all of the viable parameter space will be tested in future
muonic resonance searches. Finally, the catalog of the anomaly-free
lepton-non-universal charge assignments motivated us to explore different
directions in model building. We present a model in which the muon mass and the
$(g-2)_\mu$ are generated radiatively from a common short-distance dynamics
after the $\mathrm{U}(1)_X$ breaking. We also show how to charge a vector
leptoquark under $\mathrm{U}(1)_{\mu - \tau}$ in a complete gauge model.
