spec-kit-implement

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Spec Kit Implement

Spec Kit 落地执行

Execute approved feature tasks in dependency order and keep
tasks.md
status accurate.
按照依赖顺序执行已获批的功能任务,并保持
tasks.md
的状态准确。

When to Use

适用场景

  • tasks.md
    exists and you need to execute it phase-by-phase to deliver the feature.
  • Implementation work has started, but task sequencing, checklist gates, or progress tracking is inconsistent.
  • You need deterministic execution behavior before handoff or release readiness checks.
  • 已存在
    tasks.md
    ,且你需要分阶段执行它以交付功能。
  • 实现工作已启动,但任务排序、检查清单关卡或进度跟踪存在不一致。
  • 在移交或发布就绪检查前,你需要确定的执行行为。

When Not to Use

不适用场景

  • tasks.md
    does not exist yet (
    spec-kit-tasks
    first).
  • You are still writing or revising requirements/design artifacts (
    spec-kit-specify
    ,
    spec-kit-clarify
    ,
    spec-kit-plan
    ).
  • You need read-only consistency analysis rather than execution (
    spec-kit-analyze
    ).
  • You need coordinated artifact remediation after gaps are discovered (
    spec-kit-reconcile
    ).
  • 尚未创建
    tasks.md
    (需先使用
    spec-kit-tasks
    )。
  • 你仍在编写或修订需求/设计文档(需使用
    spec-kit-specify
    spec-kit-clarify
    spec-kit-plan
    )。
  • 你仅需要只读一致性分析而非执行操作(需使用
    spec-kit-analyze
    )。
  • 发现缺口后需要协调文档修复(需使用
    spec-kit-reconcile
    )。

Router Fit

流程定位

  • Primary route from
    spec-kit
    after
    spec-kit-tasks
    .
  • Requires planning + task artifacts for the active feature branch.
  • Routes execution-discovered artifact drift to
    spec-kit-reconcile
    .
  • spec-kit
    spec-kit-tasks
    之后的主要流程分支。
  • 需要当前功能分支的规划+任务文档。
  • 将执行过程中发现的文档偏差导向
    spec-kit-reconcile

Preconditions

前置条件

  • Run from repository root (or a subdirectory inside it).
  • Active feature context resolves to a single
    specs/<feature>/
    directory.
  • tasks.md
    reflects the current approved
    plan.md
    .
  • 从仓库根目录(或其内部子目录)运行。
  • 当前功能上下文可解析到单个
    specs/<feature>/
    目录。
  • tasks.md
    与当前获批的
    plan.md
    保持一致。

Workflow

工作流

  1. Resolve feature artifacts and enforce implementation gate:
    • Run
      scripts/check-prerequisites.sh --json --require-tasks --include-tasks
      exactly once.
    • Parse
      FEATURE_DIR
      and
      AVAILABLE_DOCS
      .
    • Derive:
      • TASKS = FEATURE_DIR/tasks.md
      • IMPL_PLAN = FEATURE_DIR/plan.md
    • If prerequisites fail:
      • missing
        tasks.md
        : stop and route to
        spec-kit-tasks
      • missing
        plan.md
        : stop and route to
        spec-kit-plan
  2. Enforce checklist gate when checklists exist:
    • If
      FEATURE_DIR/checklists/
      exists, scan all checklist files.
    • If any unchecked items remain, stop and ask whether to proceed anyway.
    • Continue only after explicit user approval.
  3. Load execution context:
    • Required:
      tasks.md
      ,
      plan.md
      .
    • Optional (when present):
      data-model.md
      ,
      contracts/
      ,
      research.md
      ,
      quickstart.md
      .
    • Use these artifacts as source of truth; do not invent scope beyond them.
  4. Verify ignore-file coverage for active tooling:
    • Check relevant ignore files (
      .gitignore
      ,
      .dockerignore
      ,
      .eslintignore
      ,
      .prettierignore
      , etc.).
    • Add only missing critical patterns; preserve existing user/project conventions.
  5. Parse
    tasks.md
    into an execution plan before running tasks:
    • Extract phase boundaries and phase intent (setup/foundational, user-story phases, polish).
    • Extract per-task fields: task ID, description, file path,
      [P]
      marker, and optional
      [US#]
      label.
    • Build dependency order from task IDs, phase ordering, and explicit sequencing notes.
    • Treat this parsed structure as execution truth for progress and failure handling.
  6. Execute tasks in phase order:
    • Respect ordering and dependency constraints from
      tasks.md
      .
    • Run
      [P]
      tasks in parallel only when there is no file overlap or dependency coupling.
    • Follow tests-before-implementation ordering where test tasks exist.
    • Complete each phase before moving to the next:
      • setup/foundational work first,
      • then user-story phases in priority order,
      • polish and cross-cutting validation last.
  7. Track progress and failures continuously:
    • After each completed task, mark it
      [X]
      in
      tasks.md
      immediately.
    • Halt on critical sequential task failures and report the blocking context.
    • For parallel batches, keep successful items moving and report failed tasks with next actions.
  8. Run completion checks:
    • All required tasks are complete.
    • Implementation aligns with
      spec.md
      /
      plan.md
      intent.
    • Required tests/validation pass per project constraints.
    • If gaps remain (for example missing wiring, acceptance mismatch, integration drift), route to
      spec-kit-reconcile
      with a concrete gap report.
  9. Report implementation result:
    • Absolute path to
      tasks.md
      .
    • Completed vs remaining task counts.
    • Checklist gate outcome (if used).
    • Final status and recommended next step.
  1. 解析功能文档并强制执行实现关卡:
    • 精确运行一次
      scripts/check-prerequisites.sh --json --require-tasks --include-tasks
    • 解析
      FEATURE_DIR
      AVAILABLE_DOCS
    • 推导:
      • TASKS = FEATURE_DIR/tasks.md
      • IMPL_PLAN = FEATURE_DIR/plan.md
    • 若前置条件不满足:
      • 缺少
        tasks.md
        :终止流程并导向
        spec-kit-tasks
      • 缺少
        plan.md
        :终止流程并导向
        spec-kit-plan
  2. 当存在检查清单时强制执行检查关卡:
    • FEATURE_DIR/checklists/
      存在,扫描所有检查清单文件。
    • 若存在未勾选的项,终止流程并询问是否继续。
    • 仅在获得用户明确批准后继续。
  3. 加载执行上下文:
    • 必填:
      tasks.md
      plan.md
    • 可选(若存在):
      data-model.md
      contracts/
      research.md
      quickstart.md
    • 将这些文档作为唯一可信来源,不得超出其范围扩展内容。
  4. 验证当前工具的忽略文件覆盖情况:
    • 检查相关忽略文件(
      .gitignore
      .dockerignore
      .eslintignore
      .prettierignore
      等)。
    • 仅添加缺失的关键规则;保留现有用户/项目约定。
  5. 在运行任务前将
    tasks.md
    解析为执行计划:
    • 提取阶段边界和阶段目标(准备/基础工作、用户故事阶段、优化阶段)。
    • 提取每个任务的字段:任务ID、描述、文件路径、
      [P]
      标记及可选的
      [US#]
      标签。
    • 根据任务ID、阶段顺序和明确的顺序说明构建依赖顺序。
    • 将此解析后的结构作为进度跟踪和故障处理的执行依据。
  6. 按阶段顺序执行任务:
    • 遵循
      tasks.md
      中的顺序和依赖约束。
    • 仅当
      [P]
      任务不存在文件重叠或依赖耦合时,才并行运行它们。
    • 若存在测试任务,遵循先测试后实现的顺序。
    • 完成当前阶段后再进入下一阶段:
      • 先完成准备/基础工作,
      • 然后按优先级顺序执行用户故事阶段,
      • 最后进行优化和跨领域验证。
  7. 持续跟踪进度和故障:
    • 完成每个任务后,立即在
      tasks.md
      中将其标记为
      [X]
    • 遇到关键顺序任务失败时暂停,并报告阻塞上下文。
    • 对于并行批次,继续推进成功项,并报告失败任务及后续操作建议。
  8. 运行完成检查:
    • 所有必填任务均已完成。
    • 实现内容与
      spec.md
      /
      plan.md
      的目标一致。
    • 符合项目约束的必填测试/验证已通过。
    • 若仍存在缺口(例如缺少关联逻辑、验收标准不匹配、集成偏差),则生成具体缺口报告并导向
      spec-kit-reconcile
  9. 报告实现结果:
    • tasks.md
      的绝对路径。
    • 已完成与剩余任务的数量统计。
    • 检查清单关卡的结果(若使用)。
    • 最终状态及推荐的下一步操作。

Output

输出

  • Updated
    tasks.md
    completion state for the active feature.
  • Implementation progress summary with blockers/failures (if any).
  • Final readiness signal for post-implementation verification/review.
  • 更新当前功能的
    tasks.md
    完成状态。
  • 包含阻塞点/故障(若有)的实现进度摘要。
  • 用于实现后验证/评审的最终就绪信号。

Key Rules

核心规则

  • Treat
    tasks.md
    ordering as execution truth.
  • Never mark a task
    [X]
    before its work and validations are complete.
  • Do not run
    [P]
    tasks concurrently when they touch the same files or dependent resources.
  • Stop and reroute when prerequisite artifacts are missing or invalid.
  • Do not patch spec/plan/tasks ad hoc during execution; use
    spec-kit-reconcile
    for structured remediation.
  • tasks.md
    中的顺序作为执行依据。
  • 在任务工作和验证完成前,绝不能将任务标记为
    [X]
  • [P]
    任务涉及相同文件或依赖资源时,不得并发运行。
  • 当前置文档缺失或无效时,终止流程并重新导向对应环节。
  • 执行过程中不得临时修改spec/plan/tasks文档;需使用
    spec-kit-reconcile
    进行结构化修复。

Common Mistakes

常见错误

  • Starting implementation with stale or missing
    tasks.md
    .
  • Skipping checklist acknowledgment when unresolved checklist items exist.
  • Forgetting immediate
    [X]
    updates in
    tasks.md
    , causing drift between reality and artifact state.
  • Running
    [P]
    tasks together despite file/dependency conflicts.
  • Continuing past critical sequential failures instead of stopping and reporting.
  • Editing
    spec.md
    /
    plan.md
    /
    tasks.md
    informally during implementation instead of routing remediation through
    spec-kit-reconcile
    .
  • 使用过时或缺失的
    tasks.md
    启动实现工作。
  • 存在未解决的检查清单项时跳过确认步骤。
  • 忘记立即更新
    tasks.md
    中的
    [X]
    标记,导致实际状态与文档状态偏差。
  • 尽管存在文件/依赖冲突,仍并行运行
    [P]
    任务。
  • 遇到关键顺序任务失败时未停止并报告,而是继续推进。
  • 实现过程中非正式修改
    spec.md
    /
    plan.md
    /
    tasks.md
    ,未通过
    spec-kit-reconcile
    进行修复。

References

参考资料

  • references/spec-kit-implement-flow.dot
    for implementation execution logic workflow
  • references/spec-kit-workflow.dot
    for overall context of how the implementation fits into the Spec Kit process.
  • scripts/check-prerequisites.sh
  • https://github.com/github/spec-kit/blob/9111699cd27879e3e6301651a03e502ecb6dd65d/templates/commands/implement.md
  • references/spec-kit-implement-flow.dot
    :实现执行逻辑工作流
  • references/spec-kit-workflow.dot
    :实现环节在Spec Kit整体流程中的上下文
  • scripts/check-prerequisites.sh
  • https://github.com/github/spec-kit/blob/9111699cd27879e3e6301651a03e502ecb6dd65d/templates/commands/implement.md