Where this gets fuzzy for me is in the case where a client asks for CMS to be developed and you deliver it; then another client wants a similar CMS, so you develop it based on what you learned/created the first time.
No lawyer me, but really, what does the contract say? It is like asking a mechanic to fix your car from another country
Theoretically, it all hinges upon what "...so you develop it based on what you learned/created the first time" means. "Based upon learned" is fine, as knowledge is always yours to do with as you will. you learn, you do better.
"Based upon what you created" meaning took huge chunks of code becomes an issue that is solved by what a contract says, and the interpretation of "work for hire" and other issues.
However, if you use GPLed code, you never need to worry, as that licence allows you to use code and modify it, and you can't assign away rights. But if you develop code specifically, you may find some issues if you reuse code chunks.
IMHO, none of this is a real concern, especially if you retain rights to backend code as per the contract. Functions that you develop should remain yours. Specific code for a specific circumstance, say a way to interoperate with an inhouse app, may not though. If you make that clear, then no one can complain.
That said, if, in the past, you have completed projects and not made this clear, then a lawyer may be your best option, anda rethink of your contract.