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
    ralph
    instead
  • User wants a full plan with acceptance criteria -- use
    plan
    skill instead
  • User wants a quick file lookup or symbol search -- use
    explore
    agent instead
  • 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>
<Steps> 1. **Identify the analysis type**: Architecture, bug investigation, performance, or dependency analysis 2. **Gather relevant context**: Read or identify the key files involved 3. **Route to analyzer**: - Preferred: `ask_codex` with `agent_role: "architect"` and relevant `context_files` - Fallback: `Task(subagent_type="oh-my-claudecode:architect", model="opus", prompt="Analyze: ...")` 4. **Return structured findings**: Present the analysis with evidence, file references, and actionable recommendations </Steps>
<Tool_Usage>
  • Before first MCP tool use, call
    ToolSearch("mcp")
    to discover deferred MCP tools
  • Use
    ask_codex
    with
    agent_role: "architect"
    as the preferred analysis route
  • Pass
    context_files
    with all relevant source files for grounded analysis
  • Use
    Task(subagent_type="oh-my-claudecode:architect", model="opus", ...)
    as fallback when ToolSearch finds no MCP tools or Codex is unavailable
  • For broad analysis, use
    explore
    agent first to identify relevant files before routing to architect </Tool_Usage>
<Examples> <Good> User: "analyze why the WebSocket connections drop after 30 seconds" Action: Gather WebSocket-related files, route to architect with context, return root cause analysis with specific file:line references and a recommended fix. Why good: Clear investigation target, structured output with evidence. </Good> <Good> User: "investigate the dependency chain from src/api/routes.ts" Action: Use explore agent to map the import graph, then route to architect for impact analysis. Why good: Uses explore for fact-gathering, architect for reasoning. </Good> <Bad> User: "analyze the auth module" Action: Returning "The auth module handles authentication." Why bad: Shallow summary without investigation. Should examine the module's structure, patterns, potential issues, and provide specific findings with file references. </Bad> <Bad> User: "fix the bug in the parser" Action: Running analysis skill. Why bad: This is a fix request, not an analysis request. Route to executor or ralph instead. </Bad> </Examples>
<Escalation_And_Stop_Conditions>
  • If analysis reveals the issue requires code changes, report findings and recommend using
    ralph
    or executor for the fix
  • 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
    技能
  • 用户需要快速文件查找或符号搜索时——请改用
    explore
    agent
  • 用户提出可从单个文件中找到答案的简单事实性问题时——直接读取并作答即可 </Do_Not_Use_When>
<Why_This_Exists> 深度调查所需的方法与快速查找或代码变更不同。分析任务需要广泛收集上下文、进行跨文件推理,并生成结构化调查结果。将这些任务转交给architect agent或Codex,可确保达到合适的深度,同时避免完整规划或执行工作流带来的额外开销。 </Why_This_Exists>
<Execution_Policy>
  • 若可用,优先使用Codex MCP进行分析(速度更快、成本更低)
  • 当Codex不可用时,回退使用architect Claude agent
  • 始终向分析工具提供上下文文件,以实现基于事实的推理
  • 返回结构化调查结果,而非仅原始观察数据 </Execution_Policy>
<Steps> 1. **确定分析类型**:架构分析、Bug调查、性能分析或依赖项分析 2. **收集相关上下文**:读取或确定涉及的关键文件 3. **转交给分析工具**: - 首选方式:调用`ask_codex`,设置`agent_role: "architect"`并传入相关`context_files` - 回退方式:创建`Task(subagent_type="oh-my-claudecode:architect", model="opus", prompt="Analyze: ...")` 4. **返回结构化调查结果**:呈现带有证据、文件引用和可操作建议的分析内容 </Steps>
<Tool_Usage>
  • 在首次使用MCP工具前,调用
    ToolSearch("mcp")
    以发现延迟加载的MCP工具
  • 优先使用设置
    agent_role: "architect"
    ask_codex
    作为分析路径
  • 传入包含所有相关源文件的
    context_files
    ,以实现基于事实的分析
  • 当ToolSearch未找到MCP工具或Codex不可用时,使用
    Task(subagent_type="oh-my-claudecode:architect", model="opus", ...)
    作为回退方案
  • 对于大范围分析,先使用
    explore
    agent确定相关文件,再转交给architect agent </Tool_Usage>
<Examples> <Good> 用户:“analyze why the WebSocket connections drop after 30 seconds” 操作:收集与WebSocket相关的文件,将任务转交给带有上下文的architect agent,返回包含具体文件:行号引用及建议修复方案的根本原因分析。 为何优秀:调查目标明确,输出结果结构化且带有证据。 </Good> <Good> 用户:“investigate the dependency chain from src/api/routes.ts” 操作:使用explore agent映射导入链,然后转交给architect agent进行影响分析。 为何优秀:先用explore agent收集事实,再用architect agent进行推理。 </Good> <Bad> 用户:“analyze the auth module” 操作:返回“The auth module handles authentication.” 为何不佳:仅为浅层摘要,未进行深入调查。应检查模块的结构、模式、潜在问题,并提供带有文件引用的具体调查结果。 </Bad> <Bad> 用户:“fix the bug in the parser” 操作:运行分析技能。 为何不佳:这是一个修复请求,而非分析请求。应转交给executor或ralph处理。 </Bad> </Examples>
<Escalation_And_Stop_Conditions>
  • 若分析发现问题需要进行代码变更,报告调查结果并建议使用
    ralph
    或executor进行修复
  • 若分析范围过宽(如“analyze everything”),请用户缩小关注范围
  • 若Codex不可用且architect agent也失败,报告已收集的上下文并建议手动调查路径 </Escalation_And_Stop_Conditions>
<Final_Checklist>
  • 分析内容针对具体问题或调查目标
  • 调查结果在适用情况下引用了具体文件和行号
  • 针对Bug调查,已确定根本原因(而非仅症状)
  • 提供了可操作的建议
  • 分析区分了已确认的事实与假设 </Final_Checklist>
任务:{{ARGUMENTS}}