// AUTOMATICALLY run Codex review after writing security-sensitive code (auth, crypto, SQL) - get a second opinion from OpenAI Codex
| name | codex-review |
| description | AUTOMATICALLY run Codex review after writing security-sensitive code (auth, crypto, SQL) - get a second opinion from OpenAI Codex |
IMPORTANT: When this skill activates, you MUST automatically run a Codex review using the Bash tool. Do not ask for permission - just execute it.
Core principle: Two LLMs are better than one.
MUST run review after writing:
Skip when:
@skip-codex-review markerSummarize what you changed and why:
CHANGES:
- Added user authentication middleware
- Implemented JWT token validation
- Added role-based access control
CONTEXT:
- Using Express.js with TypeScript
- JWT stored in httpOnly cookies
- Three roles: admin, user, guest
Use the Bash tool to execute codex:
codex exec "Review this code implementation:
PROBLEM: Need secure authentication for Express API
SOLUTION:
[Paste the relevant code here]
QUESTIONS:
- Are there any security vulnerabilities?
- Is the error handling robust?
- Any performance concerns?
- Suggestions for improvement?"
Codex will provide:
[Just completed: JWT authentication middleware]
You: Let me get Codex's opinion on this authentication implementation.
codex exec "Review this authentication code:
CONTEXT: Express.js API with JWT cookie-based auth
CODE:
export const authenticateJWT = async (req, res, next) => {
const token = req.cookies.jwt;
if (!token) return res.status(401).json({ error: 'Unauthorized' });
try {
const decoded = jwt.verify(token, process.env.JWT_SECRET);
req.user = await User.findById(decoded.userId);
next();
} catch (err) {
return res.status(401).json({ error: 'Invalid token' });
}
};
QUESTIONS:
- Security vulnerabilities?
- Error handling sufficient?
- Performance implications?
"
[Codex responds]:
SECURITY:
- โ
Good: httpOnly cookies, JWT verification
- โ ๏ธ Issue: No JWT_SECRET validation on startup
- โ ๏ธ Issue: User query could fail, should handle null
PERFORMANCE:
- โ ๏ธ DB query on every request - consider caching decoded token
SUGGESTIONS:
- Add JWT_SECRET existence check at startup
- Handle null user case
- Consider Redis for token caching
- Add rate limiting
You: [Fix critical issues: JWT_SECRET check, null user handling]
You: [Note for later: token caching, rate limiting]
With code-reviewer subagent:
With TDD:
With git workflow:
Automatic skip:
@skip-codex-review commentSKIP_CODEX_REVIEW=1Manual skip:
1. Be specific in prompts:
# Good
codex exec "Review for SQL injection vulnerabilities in this query builder"
# Less effective
codex exec "Review this code"
2. Provide context:
3. Focus reviews:
4. Batch related changes:
codex exec "Security review for authentication code:
[code]
Focus on: injection attacks, token handling, timing attacks"
codex exec "Performance review for data processing:
[code]
Focus on: algorithmic complexity, database queries, memory usage"
codex exec "Logic review for workflow engine:
[code]
Focus on: edge cases, state transitions, error paths"
โ Catch blind spots: Different LLM, different perspective โ No blocking: Suggestion only, no workflow disruption โ Fast: 2-10 seconds for review โ Cost-effective: Single API call for entire changeset โ Learning: See alternative approaches and patterns
Remember: Codex review is advisory. Use your engineering judgment for final decisions.