Robust universal quantum gates with an extremely high fidelity hold an important position in large-scale quantum computing. Here, we propose a scheme for several robust universal photonic quantum gates on a two-or three-photon system, including the controlled-NOT gate, the Toffoli gate, and the Fredkin gate, assisted by low-Q single-sided cavities. In our scheme, the quantum gates are robust against imperfect process occurring with the photons and the electron spins in diamond nitrogen-vacancy (NV) centers inside low-Q cavities. Errors due to the imperfect process are transferred to some heralding responses, which may lead to a direct recycling procedure to remedy the success probability of the quantum gates. As a result, the adverse impact of the imperfect process on fidelity is eliminated, greatly relaxing the restrictions on implementation of various quantum gates in experiments. Furthermore, the scheme is designed in a compact and heralded style, which can increase the robustness against environmental noise and local fluctuation, thus decreasing the operation time, the error probability, and the quantum resource consumption in a large-scale integrated quantum circuit. The near-unity fidelity and not-too-low efficiency with current achievable experimental techniques guarantees the feasibility of the scheme.