A person acting in the capacity of a contractor or home inspector may not bring an action in a court of this state for the collection of compensation for the performance of work or for breach of a contract for which registration is required under this chapter without alleging and proving that the contractor or home inspector was a registered contractor or registered home inspector, as applicable, at the time of contracting for the performance of the work.