analyze
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<Purpose>
Analyze performs deep investigation of architecture, bugs, performance issues, and dependencies. It routes to the architect agent or Codex MCP for thorough analysis and returns structured findings with evidence.
</Purpose>
<Use_When>
- User says "analyze", "investigate", "debug", "why does", or "what's causing"
- User needs to understand a system's architecture or behavior before making changes
- User wants root cause analysis of a bug or performance issue
- User needs dependency analysis or impact assessment for a proposed change
- A complex question requires reading multiple files and reasoning across them </Use_When>
<Do_Not_Use_When>
- User wants code changes made -- use executor agents or instead
ralph - User wants a full plan with acceptance criteria -- use skill instead
plan - User wants a quick file lookup or symbol search -- use agent instead
explore - User asks a simple factual question that can be answered from one file -- just read and answer directly </Do_Not_Use_When>
<Why_This_Exists>
Deep investigation requires a different approach than quick lookups or code changes. Analysis tasks need broad context gathering, cross-file reasoning, and structured findings. Routing these to the architect agent or Codex ensures the right level of depth without the overhead of a full planning or execution workflow.
</Why_This_Exists>
<Execution_Policy>
- Prefer Codex MCP for analysis when available (faster, lower cost)
- Fall back to architect Claude agent when Codex is unavailable
- Always provide context files to the analysis tool for grounded reasoning
- Return structured findings, not just raw observations </Execution_Policy>
<Tool_Usage>
- Before first MCP tool use, call to discover deferred MCP tools
ToolSearch("mcp") - Use with
ask_codexas the preferred analysis routeagent_role: "architect" - Pass with all relevant source files for grounded analysis
context_files - Use as fallback when ToolSearch finds no MCP tools or Codex is unavailable
Task(subagent_type="oh-my-claudecode:architect", model="opus", ...) - For broad analysis, use agent first to identify relevant files before routing to architect </Tool_Usage>
explore
<Escalation_And_Stop_Conditions>
- If analysis reveals the issue requires code changes, report findings and recommend using or executor for the fix
ralph - If the analysis scope is too broad ("analyze everything"), ask the user to narrow the focus
- If Codex is unavailable and the architect agent also fails, report what context was gathered and suggest manual investigation paths </Escalation_And_Stop_Conditions>
<Final_Checklist>
- Analysis addresses the specific question or investigation target
- Findings reference specific files and line numbers where applicable
- Root causes are identified (not just symptoms) for bug investigations
- Actionable recommendations are provided
- Analysis distinguishes between confirmed facts and hypotheses </Final_Checklist>
Task: {{ARGUMENTS}}
<Purpose>
Analyze(分析)功能可对架构、Bug、性能问题及依赖项展开深度调查。它会将任务转交给architect agent(架构师代理)或Codex MCP进行全面分析,并返回带有证据的结构化调查结果。
</Purpose>
<Use_When>
- 用户提及“analyze”“investigate”“debug”“why does”或“what's causing”等词汇时
- 用户需要在进行变更前了解系统的架构或行为时
- 用户希望对Bug或性能问题进行根本原因分析时
- 用户需要对拟议变更进行依赖项分析或影响评估时
- 复杂问题需要读取多个文件并进行跨文件推理时 </Use_When>
<Do_Not_Use_When>
- 用户希望进行代码变更时——请改用executor agents或
ralph - 用户需要包含验收标准的完整计划时——请改用技能
plan - 用户需要快速文件查找或符号搜索时——请改用agent
explore - 用户提出可从单个文件中找到答案的简单事实性问题时——直接读取并作答即可 </Do_Not_Use_When>
<Why_This_Exists>
深度调查所需的方法与快速查找或代码变更不同。分析任务需要广泛收集上下文、进行跨文件推理,并生成结构化调查结果。将这些任务转交给architect agent或Codex,可确保达到合适的深度,同时避免完整规划或执行工作流带来的额外开销。
</Why_This_Exists>
<Execution_Policy>
- 若可用,优先使用Codex MCP进行分析(速度更快、成本更低)
- 当Codex不可用时,回退使用architect Claude agent
- 始终向分析工具提供上下文文件,以实现基于事实的推理
- 返回结构化调查结果,而非仅原始观察数据 </Execution_Policy>
<Tool_Usage>
- 在首次使用MCP工具前,调用以发现延迟加载的MCP工具
ToolSearch("mcp") - 优先使用设置的
agent_role: "architect"作为分析路径ask_codex - 传入包含所有相关源文件的,以实现基于事实的分析
context_files - 当ToolSearch未找到MCP工具或Codex不可用时,使用作为回退方案
Task(subagent_type="oh-my-claudecode:architect", model="opus", ...) - 对于大范围分析,先使用agent确定相关文件,再转交给architect agent </Tool_Usage>
explore
<Escalation_And_Stop_Conditions>
- 若分析发现问题需要进行代码变更,报告调查结果并建议使用或executor进行修复
ralph - 若分析范围过宽(如“analyze everything”),请用户缩小关注范围
- 若Codex不可用且architect agent也失败,报告已收集的上下文并建议手动调查路径 </Escalation_And_Stop_Conditions>
<Final_Checklist>
- 分析内容针对具体问题或调查目标
- 调查结果在适用情况下引用了具体文件和行号
- 针对Bug调查,已确定根本原因(而非仅症状)
- 提供了可操作的建议
- 分析区分了已确认的事实与假设 </Final_Checklist>
任务:{{ARGUMENTS}}