codex-iterative-fix
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<!-- S0 META-IDENTITY -->
<!-- S0 META-IDENTITY -->
Codex Iterative Fix Skill
Codex迭代修复Skill
LIBRARY-FIRST PROTOCOL (MANDATORY)
库优先协议(强制性要求)
Before writing ANY code, you MUST check:
在编写任何代码之前,你必须检查:
Step 1: Library Catalog
步骤1:库目录
- Location:
.claude/library/catalog.json - If match >70%: REUSE or ADAPT
- 位置:
.claude/library/catalog.json - 匹配度>70%:复用或适配
Step 2: Patterns Guide
步骤2:模式指南
- Location:
.claude/docs/inventories/LIBRARY-PATTERNS-GUIDE.md - If pattern exists: FOLLOW documented approach
- 位置:
.claude/docs/inventories/LIBRARY-PATTERNS-GUIDE.md - 若存在对应模式:遵循文档记录的方法
Step 3: Existing Projects
步骤3:现有项目
- Location:
D:\Projects\* - If found: EXTRACT and adapt
- 位置:
D:\Projects\* - 若找到相关内容:提取并适配
Decision Matrix
决策矩阵
| Match | Action |
|---|---|
| Library >90% | REUSE directly |
| Library 70-90% | ADAPT minimally |
| Pattern exists | FOLLOW pattern |
| In project | EXTRACT |
| No match | BUILD (add to library after) |
| 匹配度 | 操作 |
|---|---|
| 库匹配>90% | 直接复用 |
| 库匹配70-90% | 最小程度适配 |
| 存在对应模式 | 遵循模式 |
| 项目中已有 | 提取使用 |
| 无匹配项 | 构建(完成后添加至库中) |
Kanitsal Cerceve (Evidential Frame Activation)
Kanitsal Cerceve(证据框架激活)
Kaynak dogrulama modu etkin.
来源验证模式已激活。
Purpose
用途
Use Codex CLI's autonomous iteration capability to fix failing tests and debug issues until they pass. This skill leverages Codex's strength at long-horizon coding tasks.
利用Codex CLI的自主迭代能力修复失败的测试并调试问题,直至测试通过。该Skill充分发挥了Codex在长周期编码任务中的优势。
When to Use This Skill
何时使用该Skill
- Multiple tests failing that need iterative fixing
- Debugging issues requiring trial-and-error
- Refactoring with test validation
- CI/CD failures needing automated fixes
- Build errors requiring multiple attempts
- 多个测试失败,需要迭代修复
- 需反复试验的调试问题
- 需测试验证的代码重构
- 需要自动修复的CI/CD失败
- 需多次尝试修复的构建错误
When NOT to Use This Skill
何时不使用该Skill
- Research tasks (use multi-model-discovery)
- Understanding codebase (use gemini-codebase-onboard)
- Critical production code (use sandbox mode first)
- Architecture decisions (use llm-council)
- 研究类任务(请使用multi-model-discovery)
- 了解代码库(请使用gemini-codebase-onboard)
- 关键生产代码(请先使用沙箱模式)
- 架构决策(请使用llm-council)
Workflow
工作流程
Phase 1: Initial Assessment
第一阶段:初始评估
- Identify failing tests/errors
- Determine scope of fixes needed
- Choose appropriate mode:
- : Standard autonomous mode
full-auto - : For risky changes
sandbox - : When speed is critical
yolo
- 识别失败的测试/错误
- 确定所需修复的范围
- 选择合适的模式:
- :标准自主模式
full-auto - :用于高风险修改
sandbox - :对速度要求极高时
yolo
Phase 2: Codex Execution
第二阶段:Codex执行
bash
undefinedbash
undefinedStandard iterative fix
标准迭代修复
./scripts/multi-model/codex-yolo.sh "Fix all failing tests" task-id "." 15 full-auto
./scripts/multi-model/codex-yolo.sh "Fix all failing tests" task-id "." 15 full-auto
With sandbox protection
带沙箱保护
./scripts/multi-model/codex-yolo.sh "Fix tests" task-id "." 10 sandbox
./scripts/multi-model/codex-yolo.sh "Fix tests" task-id "." 10 sandbox
Via delegate.sh
通过delegate.sh调用
./scripts/multi-model/delegate.sh codex "Fix all failing tests and verify they pass" --full-auto
undefined./scripts/multi-model/delegate.sh codex "Fix all failing tests and verify they pass" --full-auto
undefinedPhase 3: Verification
第三阶段:验证
- Codex runs tests after each fix
- Iterates until all tests pass
- Claude reviews final changes
- Summary of what was fixed
- Codex在每次修复后运行测试
- 迭代直至所有测试通过
- Claude审核最终修改
- 生成修复内容摘要
Success Criteria
成功标准
- All targeted tests passing
- No new regressions introduced
- Changes reviewed and validated
- Clear documentation of fixes
- 所有目标测试已通过
- 未引入新的回归问题
- 修改内容已审核并验证
- 修复内容文档清晰
Example Usage
示例用法
Example 1: Test Suite Failures
示例1:测试套件失败
text
User: "CI is failing with 12 test errors"
Codex Process:
1. Run tests, capture failures
2. Analyze first failure
3. Implement fix
4. Re-run tests
5. Repeat until all pass
Output:
- Fixed: 12 tests
- Changes: 8 files modified
- Root causes: Missing null checks, outdated mockstext
用户: "CI因12个测试错误而失败"
Codex流程:
1. 运行测试,捕获失败情况
2. 分析第一个失败问题
3. 实施修复
4. 重新运行测试
5. 重复直至全部通过
输出:
- 已修复: 12个测试
- 修改: 8个文件被修改
- 根本原因: 缺少空值检查、模拟数据过时Example 2: Type Errors
示例2:类型错误
text
User: "TypeScript build has 47 type errors"
Codex Process:
1. Run tsc, capture errors
2. Fix type errors systematically
3. Re-run after each batch
4. Verify build succeeds
Output:
- Fixed: 47 type errors
- Patterns: Missing types, incorrect generics
- Added: 3 new type definitionstext
用户: "TypeScript构建存在47个类型错误"
Codex流程:
1. 运行tsc,捕获错误
2. 系统地修复类型错误
3. 每批修复后重新运行
4. 验证构建成功
输出:
- 已修复: 47个类型错误
- 模式: 缺少类型定义、泛型使用错误
- 新增: 3个新的类型定义Modes Explained
模式说明
| Mode | Command | Use Case | Risk |
|---|---|---|---|
| full-auto | | Standard iteration | Medium |
| sandbox | | Risky refactors | Low |
| yolo | | Speed critical | High |
| 模式 | 命令 | 使用场景 | 风险 |
|---|---|---|---|
| full-auto | | 标准迭代场景 | 中等 |
| sandbox | | 高风险重构 | 低 |
| yolo | | 速度优先场景 | 高 |
Integration with Meta-Loop
与元循环的集成
META-LOOP IMPLEMENT PHASE:
|
+---> codex-iterative-fix
| |
| +---> Codex: Run tests
| +---> Codex: Fix failures
| +---> Codex: Iterate until pass
|
+---> Continue to TEST phase (verification)META-LOOP 实施阶段:
|
+---> codex-iterative-fix
| |
| +---> Codex: 运行测试
| +---> Codex: 修复失败问题
| +---> Codex: 迭代直至通过
|
+---> 进入测试阶段(验证)Memory Integration
内存集成
Results stored at:
- Key:
multi-model/codex/iterative-fix/{project}/{task_id} - Tags: WHO=codex-iterative-fix, WHY=autonomous-fixing
结果存储位置:
- 键:
multi-model/codex/iterative-fix/{project}/{task_id} - 标签: WHO=codex-iterative-fix, WHY=autonomous-fixing
Invocation Pattern
调用模式
bash
undefinedbash
undefinedVia router (automatic detection)
通过路由器(自动检测)
./scripts/multi-model/multi-model-router.sh "Fix all failing tests"
./scripts/multi-model/multi-model-router.sh "Fix all failing tests"
Direct Codex call
直接调用Codex
bash -lc "codex --full-auto exec 'Fix all failing tests and verify they pass'"
undefinedbash -lc "codex --full-auto exec 'Fix all failing tests and verify they pass'"
undefinedGuardrails
防护规则
NEVER:
- Run on production without review
- Skip final verification
- Ignore new test failures
- Exceed iteration limit without human check
ALWAYS:
- Review changes before commit
- Document what was fixed
- Check for regressions
- Store results in Memory-MCP
绝对禁止:
- 在未审核的情况下在生产环境运行
- 跳过最终验证步骤
- 忽略新出现的测试失败
- 未经过人工检查就超出迭代次数限制
必须执行:
- 提交前审核修改内容
- 记录修复的问题
- 检查是否存在回归问题
- 将结果存储至Memory-MCP
Related Skills
相关技能
- : Sandbox experimentation
codex-safe-experiment - : Systematic debugging
smart-bug-fix - : Test generation
testing-quality - : Find existing fixes
multi-model-discovery
- : 沙箱实验
codex-safe-experiment - : 系统化调试
smart-bug-fix - : 测试用例生成
testing-quality - : 查找现有修复方案
multi-model-discovery
Verification Checklist
验证清单
- All targeted tests passing
- No new regressions
- Changes reviewed
- Memory-MCP updated
- Documentation complete
[commit|confident] <promise>CODEX_ITERATIVE_FIX_COMPLETE</promise>
- 所有目标测试已通过
- 无新的回归问题
- 修改内容已审核
- Memory-MCP已更新
- 文档已完善
[commit|confident] <promise>CODEX_ITERATIVE_FIX_COMPLETE</promise>