We present a simple and fast numerical procedure to search for good quantum codes for storing logical qubits in the presence of independent per-qubit noise. In a key departure from past work, we use the worst-case fidelity as the figure of merit for quantifying code performance, a much better indicator of code quality than, say, entanglement fidelity. Yet our algorithm does not suffer from inefficiencies usually associated with the use of worst-case fidelity. Specifically, using a near-optimal recovery map, we are able to reduce the triple numerical optimization needed for the search to a single optimization over the encoding map. We can further reduce the search space by using the Cartan decomposition, focusing our search over the nonlocal degrees of freedom resilient against independent per-qubit noise, while not suffering much in code performance. © 2020 American Physical Society.