Yeah, trying too hard to guide with hard rules, instead of asking the LLM for self-review, is going to go wrong. The LLM is much better at code review than it is at writing code.
Use a high effort model and let the llm review it's output and figure it out on its own.
The code still won't be great, but it'll be good enough.