AgentSkillsCN

expert-analysis-guide

多视角专家分析框架,用于设计前评估。在统筹专家分析、启动并行专家代理,或在提及“专家分析”、“多视角”或“并行分析”时自动加载。

SKILL.md
--- frontmatter
name: expert-analysis-guide
description: Multi-perspective expert analysis framework for pre-design evaluation. Automatically loaded when orchestrating expert analysis, spawning parallel expert agents, or when "expert analysis", "multi-perspective", or "parallel analysis" are mentioned.

Multi-Expert Analysis Guide

Purpose

Provide multi-perspective analysis of a task before design begins. By examining the problem through different expert lenses in parallel, the orchestrator gathers diverse insights that inform the Design Doc — catching blind spots, surfacing trade-offs, and identifying cross-cutting concerns early.

Expert Persona Reference Table

Each aspect maps to an expert persona with defined focus areas:

AspectExpert PersonaFocus Areas
SecuritySecurity ArchitectAuthentication, authorization, data protection, OWASP Top 10, input validation, secrets management
API DesignAPI Design ExpertContracts, versioning strategy, error response formats, backward compatibility, pagination
ArchitectureSystems ArchitectLayer boundaries, coupling analysis, dependency direction, module cohesion, separation of concerns
PerformancePerformance EngineerQuery optimization, caching strategy, bottleneck identification, resource management, scalability
Data ModelingData ArchitectSchema design, migrations, referential integrity, indexing strategy, data lifecycle
TestabilityTest EngineerTest surface area, mockability, edge case identification, integration test boundaries
Error HandlingReliability EngineerFailure modes, recovery strategies, observability, circuit breakers, graceful degradation
UX ImpactUX EngineerUser-facing behavior changes, accessibility implications, loading states, error messaging

Fan-Out Pattern (Parallel Spawning)

How the Orchestrator Selects Aspects

  1. Examine the task requirements and affected files
  2. Select 3-5 aspects most relevant to the task (see Aspect Selection Heuristics)
  3. Spawn one expert-analyst agent per selected aspect in parallel using the Task tool
  4. Each agent receives: aspect, expertPersona, taskContext, affectedFiles

Spawning Template

For each selected aspect, the orchestrator calls:

yaml
subagent_type: expert-analyst
description: "[Aspect] expert analysis"
prompt: |
  Aspect: [aspect name]
  Expert Persona: [persona name]
  Task Context: [requirement summary and scope]
  Affected Files: [list of files from requirement-analyzer]
  Design Constraints: [any known constraints]

  Analyze the task from your expert perspective. Investigate actual project code, generate options with pros/cons, and provide a recommendation.

All expert-analyst calls MUST be made in a single message to enable parallel execution.

Fan-In Synthesis (Merging Results)

After all expert-analyst agents complete, the orchestrator:

  1. Collect all JSON responses
  2. Identify conflicts between expert recommendations (e.g., Security recommends strict validation vs. Performance recommends minimal processing)
  3. Resolve conflicts by documenting the trade-off and noting both perspectives
  4. Synthesize a consolidated brief with:
    • Key recommendations per aspect
    • Cross-cutting concerns (issues raised by 2+ experts)
    • Unresolved trade-offs (for the user or technical-designer to decide)
    • Interaction points between aspects

Synthesis Output Structure

yaml
expertAnalysisSynthesis:
  aspectsCovered: [list of aspects analyzed]
  keyRecommendations:
    - aspect: "Security"
      recommendation: "..."
      confidence: high|medium|low
    - aspect: "Architecture"
      recommendation: "..."
      confidence: high|medium|low
  crossCuttingConcerns:
    - concern: "..."
      raisedBy: ["Security", "Architecture"]
      impact: "..."
  unresolvedTradeoffs:
    - tradeoff: "..."
      perspectives: { "Performance": "...", "Security": "..." }
  interactionPoints:
    - between: ["API Design", "Data Modeling"]
      issue: "..."

Passing to Technical Designer

The synthesis is included in the technical-designer prompt as additional context:

code
Expert Analysis Results: [synthesis JSON]
Consider these expert perspectives when creating the Design Doc.
Unresolved trade-offs require explicit design decisions.

Aspect Selection Heuristics

Task CharacteristicsRecommended Aspects
New API endpointAPI Design, Security, Data Modeling, Error Handling
Database schema changeData Modeling, Performance, Architecture
Authentication/authorizationSecurity, Architecture, Testability
UI feature with backendUX Impact, API Design, Error Handling
Performance optimizationPerformance, Architecture, Data Modeling
Refactoring / restructuringArchitecture, Testability, Error Handling
External integrationSecurity, Error Handling, API Design, Testability

Minimum: Always include Architecture for 3+ file changes. Maximum: 5 aspects — more adds noise without proportional insight.

Skip Conditions

Expert Analysis Phase should be skipped when:

  • Small scale (1-2 files): Overhead exceeds value
  • Pure bug fix: Root cause already identified, no design decisions needed
  • Documentation-only changes: No code impact
  • Dependency updates: Unless major version with breaking changes
  • Task marked as "straightforward" by requirement-analyzer with confidence ≥ 0.9

When skipped, the orchestrator proceeds directly to the next phase in the flow.