AgentSkillsCN

analyze

针对设计与架构决策,进行结构化的构思与权衡分析。可通过“头脑风暴创意”“探索这个问题”“思考权衡取舍”“挑战假设”“讨论架构”等语句触发。

SKILL.md
--- frontmatter
name: analyze
description: "Thorough analysis of code, architecture, or topics — produces a structured research report. Supports goal-based modes: Explore (general research), Audit (risk-focused critique), Improve (actionable suggestions), Custom (user-defined lens). Triggers: \"analyze this code\", \"deep dive into\", \"research this topic\", \"investigate how X works\", \"audit this\", \"critique this\", \"suggest improvements\", \"find risks in\"."
version: 3.0
tier: protocol

Thorough analysis of code, architecture, or topics — produces a structured research report.

Deep Research Protocol

Execute §CMD_EXECUTE_SKILL_PHASES.

Session Parameters

json
{
  "taskType": "ANALYSIS",
  "phases": [
    {"label": "0", "name": "Setup",
      "steps": ["§CMD_PARSE_PARAMETERS", "§CMD_SELECT_MODE", "§CMD_INGEST_CONTEXT_BEFORE_WORK"],
      "commands": [],
      "proof": ["mode", "session_dir", "parameters_parsed"]},
    {"label": "1", "name": "Research Loop",
      "steps": [],
      "commands": ["§CMD_APPEND_LOG", "§CMD_TRACK_PROGRESS", "§CMD_ASK_USER_IF_STUCK"],
      "proof": ["log_entries", "key_finding", "open_gaps"]},
    {"label": "2", "name": "Calibration",
      "steps": ["§CMD_INTERROGATE"],
      "commands": ["§CMD_ASK_ROUND", "§CMD_LOG_INTERACTION"],
      "proof": ["depth_chosen", "rounds_completed"]},
    {"label": "3", "name": "Execution",
      "steps": ["§CMD_SELECT_EXECUTION_PATH"],
      "commands": [],
      "proof": ["path_chosen", "paths_available"]},
    {"label": "3.A", "name": "Inline Analysis",
      "steps": [],
      "commands": ["§CMD_APPEND_LOG"],
      "proof": []},
    {"label": "3.B", "name": "Agent Handoff",
      "steps": ["§CMD_HANDOFF_TO_AGENT"], "commands": [], "proof": []},
    {"label": "3.C", "name": "Parallel Agent Handoff",
      "steps": ["§CMD_PARALLEL_HANDOFF"], "commands": [], "proof": []},
    {"label": "4", "name": "Synthesis",
      "steps": ["§CMD_RUN_SYNTHESIS_PIPELINE"], "commands": [], "proof": []},
    {"label": "4.1", "name": "Checklists",
      "steps": ["§CMD_VALIDATE_ARTIFACTS", "§CMD_RESOLVE_BARE_TAGS", "§CMD_PROCESS_CHECKLISTS"], "commands": [], "proof": []},
    {"label": "4.2", "name": "Debrief",
      "steps": ["§CMD_GENERATE_DEBRIEF"], "commands": [], "proof": ["debrief_file", "debrief_tags"]},
    {"label": "4.3", "name": "Finding Triage",
      "steps": ["§CMD_WALK_THROUGH_RESULTS"], "commands": [], "proof": ["findings_triaged", "delegated", "deferred", "dismissed"]},
    {"label": "4.4", "name": "Pipeline",
      "steps": ["§CMD_MANAGE_DIRECTIVES", "§CMD_PROCESS_DELEGATIONS", "§CMD_DISPATCH_APPROVAL", "§CMD_CAPTURE_SIDE_DISCOVERIES", "§CMD_MANAGE_ALERTS", "§CMD_REPORT_LEFTOVER_WORK"], "commands": [], "proof": []},
    {"label": "4.5", "name": "Close",
      "steps": ["§CMD_REPORT_ARTIFACTS", "§CMD_REPORT_SUMMARY", "§CMD_CLOSE_SESSION", "§CMD_PRESENT_NEXT_STEPS"], "commands": [], "proof": []}
  ],
  "nextSkills": ["/brainstorm", "/implement", "/document", "/fix", "/chores"],
  "directives": [],
  "logTemplate": "assets/TEMPLATE_ANALYSIS_LOG.md",
  "debriefTemplate": "assets/TEMPLATE_ANALYSIS.md",
  "requestTemplate": "assets/TEMPLATE_ANALYSIS_REQUEST.md",
  "responseTemplate": "assets/TEMPLATE_ANALYSIS_RESPONSE.md",
  "modes": {
    "explore": {"label": "Explore", "description": "Broad, curiosity-driven investigation", "file": "modes/explore.md"},
    "audit": {"label": "Audit", "description": "Adversarial, risk-focused critique", "file": "modes/audit.md"},
    "improve": {"label": "Improve", "description": "Constructive, actionable suggestions", "file": "modes/improve.md"},
    "custom": {"label": "Custom", "description": "User provides framing, agent blends modes", "file": "modes/custom.md"}
  }
}

0. Setup

§CMD_REPORT_INTENT:

Analyzing ___. Mode: ___. Loading context, selecting analysis lens, preparing research workspace. Focus: ANALYSIS — session activation, mode selection, context ingestion.

§CMD_EXECUTE_PHASE_STEPS(0.0.*)

  • Scope: Understand the [Subject] and [Question] provided by the user.

Mode Selection (§CMD_SELECT_MODE):

On selection: Read the corresponding modes/{mode}.md file. It defines Role, Goal, Mindset, Research Topics, Calibration Topics, and Walk-Through Config.

On "Custom": Read ALL 3 named mode files first (modes/explore.md, modes/audit.md, modes/improve.md), then accept user's framing. Parse into role/goal/mindset.

Record: Store the selected mode. It configures:

  • Phase 0 role (from mode file)
  • Phase 1 research topics (from mode file)
  • Phase 2 calibration topics (from mode file)
  • Phase 4.3 walk-through config (from mode file)

Phase Transition

Execute §CMD_GATE_PHASE: custom: "Skip to Phase 2: Calibration | I want to guide the analysis direction before research begins"


1. Research Loop (Autonomous Deep Dive)

Do not wait for permission. Explore the context immediately.

§CMD_REPORT_INTENT:

Researching ___. Exploring loaded context autonomously. Logging findings continuously via §CMD_APPEND_LOG. Target: 5+ log entries before Calibration.

§CMD_EXECUTE_PHASE_STEPS(1.0.*)

A. Exploration Strategy

Iterate through the loaded files/docs using the Research Topics from the selected mode preset. Do not just read — Interrogate.

B. The Logging Stream (Your Scratchpad)

For every significant thought, execute §CMD_APPEND_LOG.

  • High Volume: Aim for 5-20 log entries per session.
  • A thin log leads to a shallow report. You need raw material.
  • Cadence: Log at least 5 items before moving to Calibration.

Phase Transition

Execute §CMD_GATE_PHASE: custom: "Skip to Phase 4: Synthesis | Findings are clear, ready to write the report"


2. Calibration (Interactive)

After you have logged a significant batch of findings (5+), STOP and turn to the user.

§CMD_REPORT_INTENT:

Calibrating with ___ findings logged. Aligning analysis direction with the user via §CMD_INTERROGATE. Feedback recorded via §CMD_LOG_INTERACTION.

§CMD_EXECUTE_PHASE_STEPS(2.0.*)

Action: First, ask the user to choose calibration depth. Then execute rounds.

Calibration Depth Selection

Before asking any questions, present this choice via AskUserQuestion (multiSelect: false):

"How deep should calibration go?"

DepthMinimum RoundsWhen to Use
Short3+Findings are clear, user just needs to confirm direction
Medium6+Moderate complexity, some findings need user input
Long9+Complex analysis, many open questions, need deep alignment
AbsoluteUntil ALL questions resolvedCritical research, zero ambiguity tolerance

Record the user's choice. This sets the minimum — the agent can always ask more, and the user can always say "proceed" after the minimum is met.

Calibration Protocol (Rounds)

Round counter: Output it on every round: "Round N / {depth_minimum}+"

Topic selection: Pick from the Calibration Topics defined in the selected mode preset. Do NOT follow a fixed sequence — choose the most relevant uncovered topic based on what you've learned so far.

Repeatable topics (available in all modes, can be selected any number of times):

  • Followup — Clarify or revisit answers from previous rounds
  • Devil's advocate — Challenge assumptions and decisions made so far
  • What-if scenarios — Explore hypotheticals, edge cases, and alternative futures
  • Deep dive — Drill into a specific topic from a previous round in much more detail

Each round:

  1. Pick an uncovered topic (or a repeatable topic).
  2. Execute §CMD_ASK_ROUND via AskUserQuestion (3-5 targeted questions on that topic).
  3. On response: Execute §CMD_LOG_INTERACTION immediately.
  4. If the user asks a counter-question: ANSWER it, verify understanding, then resume.

Calibration Exit Gate

After reaching minimum rounds, present this choice via AskUserQuestion (multiSelect: true):

"Round N complete (minimum met). What next?"

  • "Proceed to Phase 3: Execution"(terminal: if selected, skip all others and move on)
  • "More calibration (3 more rounds)" — Standard topic rounds, then this gate re-appears
  • "Devil's advocate round" — 1 round challenging assumptions, then this gate re-appears
  • "What-if scenarios round" — 1 round exploring hypotheticals, then this gate re-appears
  • "Deep dive round" — 1 round drilling into a prior topic, then this gate re-appears

Execution order (when multiple selected): Standard rounds first -> Devil's advocate -> What-ifs -> Deep dive -> re-present exit gate.

For Absolute depth: Do NOT offer the exit gate until you have zero remaining questions. Ask: "Round N complete. I still have questions about [X]. Continuing..."


3. Execution

§CMD_REPORT_INTENT:

Selecting execution path for analysis.

§CMD_EXECUTE_PHASE_STEPS(3.0.*)

Gateway phase — presents inline/agent/parallel choice, then enters the selected branch.


3.A. Inline Analysis

Continue synthesis in this conversation.

§CMD_EXECUTE_PHASE_STEPS(3.A.*)

Proceed directly to Phase 4: Synthesis.


3.B. Agent Handoff

Hand off to a single autonomous agent.

§CMD_EXECUTE_PHASE_STEPS(3.B.*)

§CMD_HANDOFF_TO_AGENT with:

json
{
  "agentName": "analyzer",
  "startAtPhase": "4: Synthesis",
  "planOrDirective": "Synthesize research findings into ANALYSIS.md following the template. Focus on: [calibration-agreed themes and questions]",
  "logFile": "ANALYSIS_LOG.md",
  "taskSummary": "Synthesize analysis: [brief description from taskSummary]"
}

3.C. Parallel Agent Handoff

Hand off to multiple agents working in parallel on independent analysis chunks.

§CMD_EXECUTE_PHASE_STEPS(3.C.*)

§CMD_PARALLEL_HANDOFF with:

json
{
  "agentName": "analyzer",
  "planFile": "[sessionDir]/ANALYSIS_LOG.md",
  "logFile": "ANALYSIS_LOG.md",
  "taskSummary": "Synthesize analysis: [brief description from taskSummary]"
}

4. Synthesis

When the user is satisfied.

§CMD_REPORT_INTENT:

Synthesizing. ___ findings logged, ___ calibration rounds completed. Producing ANALYSIS.md with strategic themes and recommendations.

§CMD_EXECUTE_PHASE_STEPS(4.0.*)

Debrief notes (for ANALYSIS.md):

  • Synthesize: Don't just summarize. Connect the dots between Log entries.
  • Identify Themes: Group isolated findings into "Strategic Themes".
  • Highlight: Top Risks and Sparks.
  • Recommend: Concrete next steps.

4.3. Finding Triage (Action Planning)

Convert analysis into action. Walk through each finding with the user and decide its fate.

§CMD_REPORT_INTENT:

Triaging ___ findings into action items. Walking through each finding via §CMD_WALK_THROUGH_RESULTS. Decisions logged to DETAILS.md.

§CMD_EXECUTE_PHASE_STEPS(4.3.*)

Execute §CMD_WALK_THROUGH_RESULTS with the Walk-Through Config from the selected mode preset.

Walk-through config:

code
§CMD_WALK_THROUGH_RESULTS Configuration:
  (uses Walk-Through Config from the selected mode preset)

Post-Synthesis: If the user continues talking (without choosing a skill), obey §CMD_RESUME_AFTER_CLOSE.