Codex-Claude Engineering Loop Skill
When to use
Recommended after the following (plan validation runs only on request/approval):
- After building a non-trivial plan (3+ steps, architecture impact, multi-file changes) -> run plan validation only if user requests/approves
- After implementation completes (new feature, refactor, API change)
- Final validation before build/deploy
- Quality gate check after major work
Do not use for:
- Simple config changes (env vars, formatter settings)
- Documentation-only updates
- 1-2 line trivial edits (typos, minor styling)
Role
- Base role follows
CLAUDE.md. Codex is a reviewer for plan/implementation.
- The last agent that summarized continues the work.
Constraint-based guardrails (Gemini prompt strategy)
- Specify context scope: do not guess/assume/edit beyond target files/folders. Cite evidence by file/line.
- Fix output format: keep requested output format (Plan/Implementation/Review) and length constraints.
- Declare allowed/forbidden actions: no external resources, no new deps, no large refactors without approval.
- Handle uncertainty: ask briefly when info is missing; mark as "needs confirmation" instead of guessing.
- Checklist self-check: before sending, verify key constraints (file scope, format, forbidden items, risks).
Response template
User context
- Target files/folders:
- Current behavior:
- Additional context:
- (If needed) constraints/priorities: allowed/forbidden actions, output length/format, whether questions needed
Example
- Target files/folders:
src/app/page.tsx
src/store/dashboardStore.ts
- Current behavior: fetch data from server and store in local state
- Additional context: can use Suspense / useOptimistic for React 19 support
Task
- Summarize the user request as bullets.
- Example:
- Split dashboard state management into Zustand + Immer
- Minimize potential breakage in existing code
- Consider type safety (narrowing, ReturnType, etc.)
- Re-summarize constraints (allowed/forbidden actions, format, length, confirm needs).
Output format
- Plan: summarize key steps, assumptions, risks.
- Implementation: summarize file-by-file changes and evidence.
- Review: summarize edge cases, test approach, remaining risks.
Final instruction
- Always respond in Plan -> Implementation -> Review order.
Codex-Claude Loop Procedure
- Plan (Claude): build a detailed plan and record it in
{tasksRoot}/context.md.
- Plan validation (Codex) (optional): when requested/approved, ask MCP to validate in background.
- Use
mcp__codex__spawn_agent
- Prompt example:
Review this implementation plan and find issues:
[Claude's plan]
Focus on:
- Logic errors and missing edge cases
- Data/flow consistency and API contract violations
- Type safety (narrowing, null/undefined) and error handling
- Performance/resource waste
- Security/auth/input validation
- Framework/language best practices
- Project code conventions and repo rules (CLAUDE.md, etc.)
Constraints:
- Keep Plan/Implementation/Review format, summary only
- Do not mention files/deps not in context; mark "needs confirmation" if unknown
- Cite evidence near file/line
- Summarize results: extract only key issues from Codex response for the user (full logs only if needed)
- Feedback loop: summarize Codex issues, update the plan, and ask the user whether to re-validate or proceed.
- Implementation (Claude): implement step-by-step following the validated plan and record errors/changes explicitly.
- Cross review (Codex): request background review after implementation.
- Use
mcp__codex__spawn_agent
- Prompt example:
Review the implementation and check:
- Logic/flow errors, missing edge cases
- Type safety and null/undefined guards, error/exception handling
- API contract and data model consistency
- Performance/resource waste
- Security/auth/input validation
- Framework/language best practices
- Project code conventions and repo rules (CLAUDE.md, etc.)
- Code complexity and maintainability
Constraints:
- Summarize response in Plan/Implementation/Review format
- Do not suggest deps/files outside context; mark "needs confirmation" if required
- Cite file/line evidence for each issue
- Summarize results: classify as critical issues, warnings, suggestions
- Re-validate and continue: fix critical issues immediately; confirm large changes with the user; re-validate if needed.
- Error handling: on Codex or implementation errors, analyze cause -> adjust strategy -> confirm before large-impact changes.
Codex Result Summary Guide
Summary principles
- Only the essentials: critical issues > warnings > suggestions
- Brevity: deliver only 3-5 key points
- Context savings: do not dump full Codex logs
- Action-oriented: include a fix approach for each issue
Summary template
Codex validation complete:
Critical issues (fix immediately):
- [Issue 1]: [short description] -> [action]
Warnings (improve if possible):
- [Issue 2]: [short description] -> [action]
Suggestions:
- [Issue 3]: [short description]
Example
Codex validation complete:
Critical issues:
- Type safety: PagingResponse<T> missing -> apply PagingResponse type to API response
Warnings:
- Error handling: Either Left case missing -> add fold handling
Suggestions:
- Performance: consider useMemo for list filtering
Notes
- Plan validation: run plan validation via
mcp__codex__spawn_agent
- Implementation: use Claude Edit/Write/Read tools
- Review: run review prompt via
mcp__codex__spawn_agent
- Parallel validation: use
mcp__codex__spawn_agents_parallel for multi-angle checks
1---2name: claude-codex-guardrail-loop3description: Use after planning or implementing non-trivial tasks - runs Codex MCP background verification/review for quality gates (plan validation + implementation review)4---5
6# Codex-Claude Engineering Loop Skill
7
8## When to use
9
10**Recommended after the following (plan validation runs only on request/approval):**
11- After building a non-trivial plan (3+ steps, architecture impact, multi-file changes) -> run plan validation only if user requests/approves
12- After implementation completes (new feature, refactor, API change)
13- Final validation before build/deploy
14- Quality gate check after major work
15
16**Do not use for:**
17- Simple config changes (env vars, formatter settings)
18- Documentation-only updates
19- 1-2 line trivial edits (typos, minor styling)
20
21## Role
22- Base role follows `CLAUDE.md`. Codex is a reviewer for plan/implementation.
23- The last agent that summarized continues the work.
24
25## Constraint-based guardrails (Gemini prompt strategy)
26- **Specify context scope**: do not guess/assume/edit beyond target files/folders. Cite evidence by file/line.
27- **Fix output format**: keep requested output format (Plan/Implementation/Review) and length constraints.
28- **Declare allowed/forbidden actions**: no external resources, no new deps, no large refactors without approval.
29- **Handle uncertainty**: ask briefly when info is missing; mark as "needs confirmation" instead of guessing.
30- **Checklist self-check**: before sending, verify key constraints (file scope, format, forbidden items, risks).
31
32## Response template
33### User context
34- Target files/folders:
35- Current behavior:
36- Additional context:
37- (If needed) constraints/priorities: allowed/forbidden actions, output length/format, whether questions needed
38
39#### Example
40- Target files/folders:
41 - `src/app/page.tsx`
42 - `src/store/dashboardStore.ts`
43- Current behavior: fetch data from server and store in local state
44- Additional context: can use Suspense / useOptimistic for React 19 support
45
46### Task
47- Summarize the user request as bullets.
48- Example:
49 - Split dashboard state management into Zustand + Immer
50 - Minimize potential breakage in existing code
51 - Consider type safety (narrowing, ReturnType, etc.)
52- Re-summarize constraints (allowed/forbidden actions, format, length, confirm needs).
53
54### Output format
551. Plan: summarize key steps, assumptions, risks.
562. Implementation: summarize file-by-file changes and evidence.
573. Review: summarize edge cases, test approach, remaining risks.
58
59### Final instruction
60- Always respond in Plan -> Implementation -> Review order.
61
62## Codex-Claude Loop Procedure
631. **Plan (Claude)**: build a detailed plan and record it in `{tasksRoot}/context.md`.
642. **Plan validation (Codex)** *(optional)*: when requested/approved, ask MCP to validate in background.
65 - Use `mcp__codex__spawn_agent`
66 - Prompt example:
67 ```
68 Review this implementation plan and find issues:
69 [Claude's plan]
70
71 Focus on:
72 - Logic errors and missing edge cases
73 - Data/flow consistency and API contract violations
74 - Type safety (narrowing, null/undefined) and error handling
75 - Performance/resource waste
76 - Security/auth/input validation
77 - Framework/language best practices
78 - Project code conventions and repo rules (CLAUDE.md, etc.)
79
80 Constraints:
81 - Keep Plan/Implementation/Review format, summary only
82 - Do not mention files/deps not in context; mark "needs confirmation" if unknown
83 - Cite evidence near file/line
84 ```
85 - **Summarize results**: extract only key issues from Codex response for the user (full logs only if needed)
863. **Feedback loop**: summarize Codex issues, update the plan, and ask the user whether to re-validate or proceed.
874. **Implementation (Claude)**: implement step-by-step following the validated plan and record errors/changes explicitly.
885. **Cross review (Codex)**: request background review after implementation.
89 - Use `mcp__codex__spawn_agent`
90 - Prompt example:
91 ```
92 Review the implementation and check:
93
94 - Logic/flow errors, missing edge cases
95 - Type safety and null/undefined guards, error/exception handling
96 - API contract and data model consistency
97 - Performance/resource waste
98 - Security/auth/input validation
99 - Framework/language best practices
100 - Project code conventions and repo rules (CLAUDE.md, etc.)
101 - Code complexity and maintainability
102
103 Constraints:
104 - Summarize response in Plan/Implementation/Review format
105 - Do not suggest deps/files outside context; mark "needs confirmation" if required
106 - Cite file/line evidence for each issue
107 ```
108 - **Summarize results**: classify as critical issues, warnings, suggestions
1096. **Re-validate and continue**: fix critical issues immediately; confirm large changes with the user; re-validate if needed.
1107. **Error handling**: on Codex or implementation errors, analyze cause -> adjust strategy -> confirm before large-impact changes.
111
112## Codex Result Summary Guide
113
114### Summary principles
115- **Only the essentials**: critical issues > warnings > suggestions
116- **Brevity**: deliver only 3-5 key points
117- **Context savings**: do not dump full Codex logs
118- **Action-oriented**: include a fix approach for each issue
119
120### Summary template
121
122```
123Codex validation complete:
124
125Critical issues (fix immediately):
126- [Issue 1]: [short description] -> [action]
127
128Warnings (improve if possible):
129- [Issue 2]: [short description] -> [action]
130
131Suggestions:
132- [Issue 3]: [short description]
133```
134
135### Example
136```
137Codex validation complete:
138
139Critical issues:
140- Type safety: PagingResponse<T> missing -> apply PagingResponse type to API response
141
142Warnings:
143- Error handling: Either Left case missing -> add fold handling
144
145Suggestions:
146- Performance: consider useMemo for list filtering
147```
148
149## Notes
150- **Plan validation**: run plan validation via `mcp__codex__spawn_agent`
151- **Implementation**: use Claude Edit/Write/Read tools
152- **Review**: run review prompt via `mcp__codex__spawn_agent`
153- **Parallel validation**: use `mcp__codex__spawn_agents_parallel` for multi-angle checks