A versatile cooperative template-directed coating method to construct uniform microporous carbon shells for multifunctional core-shell nanocomposites.