spec-kit-analyze

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Spec Kit Analyze

Spec Kit 分析

Run a non-destructive cross-artifact quality audit before implementation.
在实施前执行无破坏性的跨文档质量审计。

When to Use

适用场景

  • tasks.md
    exists and you want a pre-implementation consistency check across spec/plan/tasks.
  • You suspect coverage gaps, requirement drift, ambiguous language, or contradictory artifacts.
  • You need a constitution-alignment gate without editing artifacts yet.
  • 已存在
    tasks.md
    ,且你希望在实施前对spec/plan/tasks进行一致性检查。
  • 你怀疑存在覆盖缺口、需求偏离、表述模糊或文档矛盾的情况。
  • 你需要一个规范对齐检查环节,且暂时不修改文档。

When Not to Use

不适用场景

  • Any prerequisite artifact is missing (
    spec-kit-specify
    ,
    spec-kit-plan
    , or
    spec-kit-tasks
    first).
  • You need targeted remediation edits now (
    spec-kit-reconcile
    ).
  • You are executing implementation work (
    spec-kit-implement
    ).
  • 缺少任何前置文档(需先执行
    spec-kit-specify
    spec-kit-plan
    spec-kit-tasks
    )。
  • 你现在需要针对性的修正编辑(使用
    spec-kit-reconcile
    )。
  • 你正在执行实施工作(使用
    spec-kit-implement
    )。

Router Fit

流程适配

  • Primary route from
    spec-kit
    after
    spec-kit-tasks
    .
  • Read-only quality gate before
    spec-kit-implement
    .
  • Default handoff to
    spec-kit-reconcile
    when findings require coordinated artifact updates.
  • spec-kit
    spec-kit-tasks
    之后的主要流程节点。
  • spec-kit-implement
    之前的只读质量检查环节。
  • 当发现问题需要协调更新文档时,默认流转到
    spec-kit-reconcile

Critical Constraints

关键约束

  • Strictly read-only: do not modify files.
  • Treat
    memory/constitution.md
    as authoritative; any MUST-level conflict is
    CRITICAL
    .
  • 严格只读:不得修改文件。
  • memory/constitution.md
    视为权威文件;任何违反MUST级要求的冲突均为
    CRITICAL
    (严重)级别。

Preconditions

前置条件

  • Run from repository root (or a subdirectory inside it).
  • Active feature context resolves to one feature directory with
    spec.md
    ,
    plan.md
    , and
    tasks.md
    .
  • 从仓库根目录(或其子目录)运行。
  • 当前功能上下文指向包含
    spec.md
    plan.md
    tasks.md
    的单个功能目录。

Workflow

工作流程

  1. Resolve artifact paths and enforce prerequisite gate:
    • Run
      scripts/check-prerequisites.sh --json --require-tasks --include-tasks
      exactly once.
    • Parse:
      • FEATURE_DIR
      • AVAILABLE_DOCS
    • Derive:
      • SPEC = FEATURE_DIR/spec.md
      • PLAN = FEATURE_DIR/plan.md
      • TASKS = FEATURE_DIR/tasks.md
    • If any required artifact is missing, stop and route to the owning sibling skill.
  2. Load focused sections from:
    • spec.md
      : requirements, stories, acceptance criteria, edge cases.
    • plan.md
      : architecture/stack decisions, phases, constraints.
    • tasks.md
      : task IDs, phase grouping,
      [P]
      markers, referenced paths.
    • memory/constitution.md
      : principle names and normative MUST/SHOULD statements.
  3. Build internal maps:
    • Requirement inventory (functional + non-functional) with stable keys.
    • Story/action inventory with acceptance-test intent.
    • Task-to-requirement/story coverage mapping.
    • Constitution obligations relevant to spec/plan/tasks scope.
  4. Detect and classify issues:
    • Duplication: overlapping or near-duplicate requirements.
    • Ambiguity/placeholders: vague quality terms, TODO/TKTK/placeholder tokens.
    • Underspecification: requirements lacking measurable outcomes or clear objects.
    • Constitution conflicts: violations against MUST principles (
      CRITICAL
      ).
    • Coverage gaps: requirements without tasks and tasks without mapped requirement/story.
    • Cross-artifact inconsistency: terminology drift, entity mismatch, ordering contradictions.
    • Cap findings at 50 rows; summarize overflow counts by category.
  5. Assign severity and output a compact report with stable IDs, coverage table, and metrics.
    • CRITICAL
      : constitution MUST violations, missing core coverage that blocks baseline behavior.
    • HIGH
      : conflicting/duplicate requirements, untestable or high-risk ambiguity.
    • MEDIUM
      : terminology drift, non-functional coverage gaps, underspecified edge cases.
    • LOW
      : wording/style cleanup without execution impact.
  6. Recommend next actions:
    • If
      CRITICAL
      /
      HIGH
      findings require cross-artifact edits, block
      spec-kit-implement
      and route to
      spec-kit-reconcile
      with a concise gap summary.
    • If only one artifact needs focused updates, route to its owner skill (
      spec-kit-specify
      ,
      spec-kit-plan
      , or
      spec-kit-tasks
      ).
    • Otherwise provide prioritized improvements and whether implementation can proceed.
  7. Offer follow-up only:
    • Ask whether to run
      spec-kit-reconcile
      using top findings as the gap report.
    • Do not apply any edits in this skill.
  1. 解析文档路径并执行前置检查:
    • 准确执行一次
      scripts/check-prerequisites.sh --json --require-tasks --include-tasks
      脚本。
    • 解析以下内容:
      • FEATURE_DIR
      • AVAILABLE_DOCS
    • 推导路径:
      • SPEC = FEATURE_DIR/spec.md
      • PLAN = FEATURE_DIR/plan.md
      • TASKS = FEATURE_DIR/tasks.md
    • 如果缺少任何必需文档,停止流程并流转到对应的关联工具。
  2. 加载以下文档的重点内容:
    • spec.md
      :需求、用户故事、验收标准、边缘案例。
    • plan.md
      :架构/技术栈决策、阶段划分、约束条件。
    • tasks.md
      :任务ID、阶段分组、
      [P]
      标记、引用路径。
    • memory/constitution.md
      :原则名称及规范性的MUST/SHOULD声明。
  3. 构建内部映射表:
    • 需求清单(功能性+非功能性)及稳定键值。
    • 用户故事/动作清单及验收测试意图。
    • 任务到需求/用户故事的覆盖映射。
    • 与spec/plan/tasks范围相关的规范约束。
  4. 检测并分类问题:
    • 重复:重叠或近乎重复的需求。
    • 歧义/占位符:模糊的质量术语、TODO/TKTK/占位符标记。
    • 规格不足:缺少可衡量结果或明确对象的需求。
    • 规范冲突:违反MUST级原则(标记为
      CRITICAL
      )。
    • 覆盖缺口:未对应任务的需求,以及未映射到需求/用户故事的任务。
    • 跨文档不一致:术语偏差、实体不匹配、顺序矛盾。
    • 最多显示50条问题;超出部分按类别汇总数量。
  5. 分配问题严重程度,并输出包含稳定ID、覆盖表和指标的简洁报告:
    • CRITICAL
      (严重):违反MUST级规范、缺失阻碍基线功能的核心覆盖。
    • HIGH
      (高):需求冲突/重复、不可测试或高风险的歧义。
    • MEDIUM
      (中):术语偏差、非功能性需求覆盖缺口、规格不足的边缘案例。
    • LOW
      (低):不影响执行的措辞/风格优化。
  6. 推荐后续操作:
    • 如果
      CRITICAL
      /
      HIGH
      级问题需要跨文档编辑,阻止
      spec-kit-implement
      流程,并流转到
      spec-kit-reconcile
      ,同时提供简洁的缺口摘要。
    • 如果仅需更新单个文档,流转到对应的工具(
      spec-kit-specify
      spec-kit-plan
      spec-kit-tasks
      )。
    • 否则提供优先级排序的改进建议,以及是否可以继续实施。
  7. 仅提供后续操作选项:
    • 询问是否使用发现的主要问题作为缺口报告,运行
      spec-kit-reconcile
    • 本工具不执行任何编辑操作。

Output

输出

  • Markdown report only (no file writes) containing:
    • Findings table:
      ID | Category | Severity | Location(s) | Summary | Recommendation
    • Requirement coverage table:
      Requirement Key | Has Task? | Task IDs | Notes
    • Constitution alignment issues (if any)
    • Unmapped tasks (if any)
    • Metrics:
      • Total requirements
      • Total tasks
      • Coverage percentage
      • Ambiguity count
      • Duplication count
      • Critical issues count
    • Next-step routing recommendation
  • 仅输出Markdown报告(不写入文件),包含:
    • 问题表:
      ID | 类别 | 严重程度 | 位置 | 摘要 | 建议
    • 需求覆盖表:
      需求键值 | 是否有对应任务 | 任务ID | 备注
    • 规范对齐问题(若有)
    • 未映射任务(若有)
    • 指标:
      • 总需求数
      • 总任务数
      • 覆盖百分比
      • 歧义问题数
      • 重复问题数
      • 严重问题数
    • 后续流程流转建议

References

参考资料

  • references/command-analyze.md
  • scripts/check-prerequisites.sh
  • https://github.com/github/spec-kit/blob/9111699cd27879e3e6301651a03e502ecb6dd65d/templates/commands/analyze.md
  • references/command-analyze.md
  • scripts/check-prerequisites.sh
  • https://github.com/github/spec-kit/blob/9111699cd27879e3e6301651a03e502ecb6dd65d/templates/commands/analyze.md