AI coding tools are everywhere, but most teams still use them as autocomplete. On a production LMS with hundreds of thousands of users, I wanted something more useful: a review step that catches the boring-but-dangerous problems before a human reviewer even opens the pull request.
What the AI reviewer checks
The review focuses on three areas. Narrow, specific instructions give far fewer false positives than one generic "review this code" prompt.
- Security - unescaped output, missing nonces and capability checks, raw SQL without
$wpdb->prepare(), unsafe file handling. - Performance - queries inside loops, missing indexes on new meta queries, uncached remote calls, heavy work on
init. - Accessibility - missing labels, buttons without accessible names, color-only states, focus management in new UI.
Automated PHPUnit coverage
The second half of the workflow is automated PHPUnit coverage for new or changed code. The rule that matters most: a generated test is only kept if it passes and actually asserts behavior - not if it just calls a method and checks that it returns something.
Tests were generated automatically for all new code, which saved a lot of time; however, there were instances when the AI didn't understand the logic correctly and generated tests that made no sense.
Why human review stays
The AI pass is a filter, not a gate. It removes the obvious issues so the human reviewer can focus on architecture, business logic and edge cases the model has no context for. Every suggestion is reviewed before merge.
Lessons learned
- Small, specific checklists beat one huge prompt.
- Give the agent project conventions (coding standards, folder structure) or it will invent its own.
- Track false positives and adjust instructions - otherwise people start ignoring the bot.
- Never let generated tests lower the bar: a passing meaningless test is worse than no test.
If you want a similar setup for your PHP or WordPress team, get in touch.
