Files
Claude-Code-Workflow/.claude/commands/cli/analyze.md
catlog22 920b179440 docs: 更新所有命令描述并重新生成索引文件
- 更新所有69个命令文件的description字段,基于实际功能重新生成详细描述
- 重新生成5个索引文件(all-commands, by-category, by-use-case, essential-commands, command-relationships)
- 移动analyze_commands.py到scripts/目录并完善功能
- 移除临时备份文件

命令描述改进示例:
- workflow:plan: 增加了工具和代理的详细说明(Gemini, action-planning-agent)
- cli:execute: 说明了YOLO权限和多种执行模式
- memory:update-related: 详细说明了批处理策略和工具回退链

索引文件改进:
- usage_scenario从2种扩展到10种(更精细分类)
- command-relationships覆盖所有69个命令
- 区分built-in(内置调用)和sequential(用户顺序执行)关系

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 15:11:31 +08:00

3.3 KiB

name, description, argument-hint, allowed-tools
name description argument-hint allowed-tools
analyze Read-only codebase analysis using Gemini (default), Qwen, or Codex with auto-pattern detection and template selection [--agent] [--tool codex|gemini|qwen] [--enhance] analysis target SlashCommand(*), Bash(*), TodoWrite(*), Read(*), Glob(*), Task(*)

CLI Analyze Command (/cli:analyze)

Purpose

Quick codebase analysis using CLI tools. Read-only - does NOT modify code.

Tool Selection:

  • gemini (default) - Best for code analysis
  • qwen - Fallback when Gemini unavailable
  • codex - Alternative for deep analysis

Parameters

  • --tool <gemini|qwen|codex> - Tool selection (default: gemini)
  • --agent - Use cli-execution-agent for automated context discovery
  • --enhance - Use /enhance-prompt for context-aware enhancement
  • <analysis-target> - Description of what to analyze

Tool Usage

Gemini (Primary):

--tool gemini  # or omit (default)

Qwen (Fallback):

--tool qwen

Codex (Alternative):

--tool codex

Execution Flow

Standard Mode

  1. Parse tool selection (default: gemini)
  2. Optional: enhance with /enhance-prompt
  3. Auto-detect file patterns from keywords
  4. Build command with analysis template
  5. Execute analysis (read-only)
  6. Save results

Agent Mode (--agent)

Delegates to agent for intelligent analysis:

Task(
  subagent_type="cli-execution-agent",
  description="Codebase analysis",
  prompt=`
    Task: ${analysis_target}
    Mode: analyze
    Tool: ${tool_flag || 'auto-select'}  // gemini|qwen|codex
    Enhance: ${enhance_flag || false}

    Agent responsibilities:
    1. Context Discovery:
       - Discover relevant files/patterns
       - Identify analysis scope
       - Build file context

    2. CLI Command Generation:
       - Build Gemini/Qwen/Codex command
       - Apply analysis template
       - Include discovered files

    3. Execution & Output:
       - Execute analysis
       - Generate insights report
       - Save to .workflow/.chat/ or .scratchpad/
  `
)

Core Rules

  • Read-only: Analyzes code, does NOT modify files
  • Auto-pattern: Detects file patterns from keywords
  • Template-based: Auto-selects analysis template
  • Output: Saves to .workflow/WFS-[id]/.chat/ or .scratchpad/

File Pattern Auto-Detection

Keywords → file patterns:

  • "auth" → @**/*auth* @**/*user*
  • "component" → @src/components/**/*
  • "API" → @**/api/**/* @**/routes/**/*
  • "test" → @**/*.test.* @**/*.spec.*
  • Generic → @src/**/*

CLI Command Templates

Gemini/Qwen:

cd . && gemini -p "
PURPOSE: [goal]
TASK: [analysis type]
MODE: analysis
CONTEXT: @CLAUDE.md [auto-detected patterns]
EXPECTED: Insights, recommendations
RULES: [auto-selected template]
"
# Qwen: Replace 'gemini' with 'qwen'

Codex:

codex -C . --full-auto exec "
PURPOSE: [goal]
TASK: [analysis type]
MODE: analysis
CONTEXT: @CLAUDE.md [patterns]
EXPECTED: Deep insights
RULES: [template]
" -m gpt-5 --skip-git-repo-check -s danger-full-access

Output

  • With session: .workflow/WFS-[id]/.chat/analyze-[timestamp].md
  • No session: .workflow/.scratchpad/analyze-[desc]-[timestamp].md

Notes

  • See intelligent-tools-strategy.md for detailed tool usage and templates