spec-kit-constitution

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Spec Kit Constitution

Spec Kit 项目章程

Create or amend the project constitution and keep dependent templates aligned.
创建或修改项目章程,并保持关联模板的一致性。

When to Use

适用场景

  • User asks to create the first constitution for a Spec Kit project.
  • User asks to amend governance/principles and update constitution versioning.
  • memory/constitution.md
    is missing or still contains
    [PLACEHOLDER]
    tokens.
  • Principle changes must be propagated into planning/spec/task templates.
  • 用户需要为Spec Kit项目创建首个章程。
  • 用户要求修订治理规则/原则并更新章程版本。
  • memory/constitution.md
    文件缺失或仍包含
    [PLACEHOLDER]
    占位符。
  • 需要将原则变更同步到规划/规格/任务模板中。

Router Fit

路由适配

  • Primary route from
    spec-kit
    when intent is governance/principles.
  • Run before feature planning when constitutional rules changed.
  • Downstream dependency:
    spec-kit-plan
    constitution checks rely on this output.
  • 当意图涉及治理/原则时,从
    spec-kit
    发起的主要路由。
  • 当章程规则变更时,需在功能规划前执行此流程。
  • 下游依赖:
    spec-kit-plan
    的章程检查依赖此流程的输出结果。

Preconditions

前置条件

  • Work from the target project repository root.
  • Treat
    memory/constitution.md
    as the source of truth once created.
  • 从目标项目仓库根目录开始操作。
  • 章程创建完成后,将
    memory/constitution.md
    视为唯一可信源。

Workflow

工作流程

  1. Resolve constitution file:
    • Target:
      {REPO_ROOT}/memory/constitution.md
      .
    • If missing, initialize from
      {REPO_ROOT}/templates/constitution-template.md
      when present; otherwise use
      assets/constitution-template.md
      .
  2. Capture baseline state from existing constitution (if present):
    • Current version.
    • Ratified and last amended dates.
    • Principle/section titles for diff reporting.
    • Any unresolved
      [PLACEHOLDER]
      tokens.
  3. Fill required values from user input first, then repository context.
    • If critical data is unknown, use
      TODO(<FIELD_NAME>): <reason>
      .
  4. Decide semantic version bump and dates:
    • MAJOR
      : backward-incompatible governance/principle redefinition or removal.
    • MINOR
      : new principle/section or materially expanded policy.
    • PATCH
      : clarifications, wording, typo, non-semantic refinements.
    • RATIFICATION_DATE
      : keep original adoption date.
    • LAST_AMENDED_DATE
      : set to today (
      YYYY-MM-DD
      ) only when content changes.
  5. Draft the constitution:
    • Replace placeholders with concrete policy text.
    • Keep heading hierarchy from the template.
    • Make principles declarative and testable (
      MUST
      /
      SHOULD
      with rationale).
    • Keep Governance explicit about amendment process, versioning policy, and compliance review.
  6. Propagate policy changes to dependent templates in the target repo when present:
    • templates/plan-template.md
    • templates/spec-template.md
    • templates/tasks-template.md
      Update constitutional checks, required sections, and task expectations to match revised principles.
  7. Prepend a Sync Impact Report HTML comment to
    memory/constitution.md
    containing:
    • Version change (
      old -> new
      ).
    • Modified principles (including renames).
    • Added/removed sections.
    • Template sync status (
      updated
      vs
      pending
      ) with file paths.
    • Deferred TODO items.
  8. Validate before finalizing:
    • No unexplained bracket placeholders remain.
    • Version/date line matches report and uses
      YYYY-MM-DD
      format.
    • File path is
      memory/constitution.md
      (not
      /memory/constitution.md
      ).
  9. Write
    memory/constitution.md
    and report results to the user.
  1. 定位章程文件:
    • 目标路径:
      {REPO_ROOT}/memory/constitution.md
    • 若文件缺失,优先从
      {REPO_ROOT}/templates/constitution-template.md
      初始化;若该模板也不存在,则使用
      assets/constitution-template.md
  2. 捕获现有章程的基准状态(若存在):
    • 当前版本号。
    • 批准日期和最后修订日期。
    • 用于差异报告的原则/章节标题。
    • 所有未解决的
      [PLACEHOLDER]
      占位符。
  3. 优先从用户输入中填充必填值,其次从仓库上下文获取。
    • 若关键数据未知,使用
      TODO(<FIELD_NAME>): <reason>
      格式标记。
  4. 确定语义化版本升级类型和日期:
    • MAJOR
      :治理/原则的定义被修改或移除,且存在向后兼容性问题。
    • MINOR
      :新增原则/章节,或政策内容大幅扩展。
    • PATCH
      :仅做说明优化、措辞调整、拼写修正等非语义性改进。
    • RATIFICATION_DATE
      :保留最初的批准日期。
    • LAST_AMENDED_DATE
      :仅当内容发生变更时,设置为当前日期(
      YYYY-MM-DD
      格式)。
  5. 起草章程:
    • 用具体政策文本替换占位符。
    • 保留模板的标题层级结构。
    • 原则需采用声明式且可验证的表述(使用
      MUST
      /
      SHOULD
      并附上理由)。
    • 治理章节需明确修订流程、版本控制策略和合规审查要求。
  6. 同步政策变更到目标仓库中的关联模板(若存在):
    • templates/plan-template.md
    • templates/spec-template.md
    • templates/tasks-template.md
      更新章程检查项、必填章节和任务预期,使其与修订后的原则保持一致。
  7. memory/constitution.md
    文件开头添加同步影响报告的HTML注释,内容包括:
    • 版本变更(
      旧版本 -> 新版本
      )。
    • 修改的原则(包括重命名项)。
    • 新增/移除的章节。
    • 模板同步状态(
      已更新
      vs
      待处理
      )及文件路径。
    • 延迟处理的TODO项。
  8. 最终确认前进行验证:
    • 确保无未解释的括号占位符残留。
    • 版本/日期行与报告内容匹配,且使用
      YYYY-MM-DD
      格式。
    • 文件路径为
      memory/constitution.md
      (而非
      /memory/constitution.md
      )。
  9. 写入
    memory/constitution.md
    文件,并向用户报告结果。

Output

输出结果

  • Updated
    memory/constitution.md
    .
  • Updated template files when present and required.
  • Summary including version bump rationale, pending follow-ups, and a suggested commit message.
  • 更新后的
    memory/constitution.md
    文件。
  • 若存在且需要,更新关联模板文件。
  • 包含版本升级理由、待跟进事项和建议提交信息的总结报告。

Common Mistakes

常见错误

  • Updating principles without updating dependent templates.
  • Using a patch bump for material policy changes that require a minor/major bump.
  • Leaving unresolved placeholders without explicit TODO annotations.
  • Writing to
    /memory/constitution.md
    instead of
    memory/constitution.md
    .
  • 仅更新原则但未同步关联模板。
  • 将需要次要/主要版本升级的实质性政策变更错误标记为补丁版本升级。
  • 未使用明确的TODO注释标记未解决的占位符。
  • 错误写入路径为
    /memory/constitution.md
    而非
    memory/constitution.md

References

参考资料

  • references/spec-kit-workflow.dot
    for where constitution work fits in the Spec Kit sequence.
  • assets/constitution-template.md
  • assets/spec-template.md
  • assets/plan-template.md
  • assets/tasks-template.md
  • https://github.com/github/spec-kit/blob/9111699cd27879e3e6301651a03e502ecb6dd65d/templates/commands/constitution.md
  • references/spec-kit-workflow.dot
    :展示章程工作在Spec Kit流程中的位置。
  • assets/constitution-template.md
  • assets/spec-template.md
  • assets/plan-template.md
  • assets/tasks-template.md
  • https://github.com/github/spec-kit/blob/9111699cd27879e3e6301651a03e502ecb6dd65d/templates/commands/constitution.md