speckit-constitution

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Spec Kit Constitution Skill

Spec Kit Constitution Skill

When to Use

使用场景

  • Initial project setup or when governance principles need updates.
  • 项目初始搭建阶段,或治理原则需要更新时。

Inputs

输入信息

  • User-provided principles or amendments.
  • Existing
    .specify/memory/constitution.md
    and templates.
If the request is missing or ambiguous, ask focused questions before proceeding.
  • 用户提供的原则或修订内容。
  • 已有的
    .specify/memory/constitution.md
    文件及相关模板。
如果请求信息缺失或模糊,在执行前需询问明确的问题。

Workflow

工作流程

You are updating the project constitution at
.specify/memory/constitution.md
. This file is a TEMPLATE containing placeholder tokens in square brackets (e.g.
[PROJECT_NAME]
,
[PRINCIPLE_1_NAME]
). Your job is to (a) collect/derive concrete values, (b) fill the template precisely, and (c) propagate any amendments across dependent artifacts.
Follow this execution flow:
  1. Load the existing constitution template at
    .specify/memory/constitution.md
    .
    • Identify every placeholder token of the form
      [ALL_CAPS_IDENTIFIER]
      . IMPORTANT: The user might require less or more principles than the ones used in the template. If a number is specified, respect that - follow the general template. You will update the doc accordingly.
  2. Collect/derive values for placeholders:
    • If user input (conversation) supplies a value, use it.
    • Otherwise infer from existing repo context (README, docs, prior constitution versions if embedded).
    • For governance dates:
      RATIFICATION_DATE
      is the original adoption date (if unknown ask or mark TODO),
      LAST_AMENDED_DATE
      is today if changes are made, otherwise keep previous.
    • CONSTITUTION_VERSION
      must increment according to semantic versioning rules:
      • MAJOR: Backward incompatible governance/principle removals or redefinitions.
      • MINOR: New principle/section added or materially expanded guidance.
      • PATCH: Clarifications, wording, typo fixes, non-semantic refinements.
    • If version bump type ambiguous, propose reasoning before finalizing.
  3. Draft the updated constitution content:
    • Replace every placeholder with concrete text (no bracketed tokens left except intentionally retained template slots that the project has chosen not to define yet—explicitly justify any left).
    • Preserve heading hierarchy and comments can be removed once replaced unless they still add clarifying guidance.
    • Ensure each Principle section: succinct name line, paragraph (or bullet list) capturing non‑negotiable rules, explicit rationale if not obvious.
    • Ensure Governance section lists amendment procedure, versioning policy, and compliance review expectations.
  4. Consistency propagation checklist (convert prior checklist into active validations):
    • Read
      .specify/templates/plan-template.md
      and ensure any "Constitution Check" or rules align with updated principles.
    • Read
      .specify/templates/spec-template.md
      for scope/requirements alignment—update if constitution adds/removes mandatory sections or constraints.
    • Read
      .specify/templates/tasks-template.md
      and ensure task categorization reflects new or removed principle-driven task types (e.g., observability, versioning, testing discipline).
    • Review runtime prompts/agents for outdated references and align with updated principles:
      • .claude/commands/speckit.*.md
      • .codex/prompts/speckit.*.md
      • .gemini/commands/speckit.*.toml
      • .github/prompts/speckit.*.prompt.md
      • .github/agents/speckit.*.agent.md
      • skills/speckit-*/SKILL.md
    • Read any runtime guidance docs (e.g.,
      README.md
      ,
      docs/quickstart.md
      , or agent-specific guidance files if present). Update references to principles changed.
  5. Produce a Sync Impact Report (prepend as an HTML comment at top of the constitution file after update):
    • Version change: old → new
    • List of modified principles (old title → new title if renamed)
    • Added sections
    • Removed sections
    • Templates requiring updates (✅ updated / ⚠ pending) with file paths
    • Follow-up TODOs if any placeholders intentionally deferred.
  6. Validation before final output:
    • No remaining unexplained bracket tokens.
    • Version line matches report.
    • Dates ISO format YYYY-MM-DD.
    • Principles are declarative, testable, and free of vague language ("should" → replace with MUST/SHOULD rationale where appropriate).
  7. Write the completed constitution back to
    .specify/memory/constitution.md
    (overwrite).
  8. Output a final summary to the user with:
    • New version and bump rationale.
    • Any files flagged for manual follow-up.
    • Suggested commit message (e.g.,
      docs: amend constitution to vX.Y.Z (principle additions + governance update)
      ).
Formatting & Style Requirements:
  • Use Markdown headings exactly as in the template (do not demote/promote levels).
  • Wrap long rationale lines to keep readability (<100 chars ideally) but do not hard enforce with awkward breaks.
  • Keep a single blank line between sections.
  • Avoid trailing whitespace.
If the user supplies partial updates (e.g., only one principle revision), still perform validation and version decision steps.
If critical info missing (e.g., ratification date truly unknown), insert
TODO(<FIELD_NAME>): explanation
and include in the Sync Impact Report under deferred items.
Do not create a new template; always operate on the existing
.specify/memory/constitution.md
file.
你需要更新
.specify/memory/constitution.md
路径下的项目章程。该文件是一个包含方括号占位符(如
[PROJECT_NAME]
[PRINCIPLE_1_NAME]
)的模板。你的工作包括:(a) 收集/推导具体值;(b) 精准填充模板;(c) 将所有修订内容同步到相关的关联文件中。
请遵循以下执行流程:
  1. 加载
    .specify/memory/constitution.md
    路径下的现有章程模板。
    • 识别所有
      [全大写标识符]
      格式的占位符。 重要提示:用户要求的原则数量可能与模板中的数量不同。如果指定了数量,请遵循该要求——同时保留模板的整体结构。你需要据此更新文档。
  2. 收集/推导占位符的对应值:
    • 如果用户输入(对话内容)提供了对应值,直接使用该值。
    • 否则,从现有仓库上下文(README、文档、已嵌入的历史章程版本)中推导。
    • 关于治理日期:
      RATIFICATION_DATE
      为最初通过日期(若未知则询问用户或标记为TODO);若进行了更改,
      LAST_AMENDED_DATE
      设为当前日期,否则保留原有值。
    • CONSTITUTION_VERSION
      必须遵循semantic versioning规则进行递增:
      • MAJOR:当存在不兼容的治理/原则移除或重新定义时。
      • MINOR:当添加新原则/章节,或对指导内容进行实质性扩展时。
      • PATCH:当进行说明补充、措辞调整、拼写修正或非语义性优化时。
    • 若版本升级类型不明确,需先给出理由再最终确定。
  3. 起草更新后的章程内容:
    • 用具体文本替换所有占位符(除了项目选择暂不定义而有意保留的模板槽位外,不得留有任何带方括号的标记——对保留的槽位需明确说明理由)。
    • 保留标题层级结构;占位符替换完成后可删除注释,除非注释仍能提供明确的指导信息。
    • 确保每个原则章节包含:简洁的名称行、记录不可协商规则的段落(或项目符号列表);若理由不明显,需明确说明。
    • 确保治理章节列出修订流程、版本控制策略以及合规审查要求。
  4. 一致性同步检查清单(将原有清单转换为主动验证项):
    • 读取
      .specify/templates/plan-template.md
      文件,确保所有「章程检查」项或规则与更新后的原则保持一致。
    • 读取
      .specify/templates/spec-template.md
      文件,检查范围/要求是否一致——若章程添加或删除了强制章节或约束条件,需同步更新该文件。
    • 读取
      .specify/templates/tasks-template.md
      文件,确保任务分类能体现新增或移除的、由原则驱动的任务类型(例如:observability、versioning、testing discipline)。
    • 检查运行时提示词/agents中的过时引用,使其与更新后的原则保持一致:
      • .claude/commands/speckit.*.md
      • .codex/prompts/speckit.*.md
      • .gemini/commands/speckit.*.toml
      • .github/prompts/speckit.*.prompt.md
      • .github/agents/speckit.*.agent.md
      • skills/speckit-*/SKILL.md
    • 读取所有运行时指导文档(例如
      README.md
      docs/quickstart.md
      ,或现有的agent专属指导文件)。更新其中与已更改原则相关的引用内容。
  5. 生成同步影响报告(更新后以HTML注释的形式添加到章程文件顶部):
    • 版本变更:旧版本 → 新版本
    • 修改的原则列表(若重命名则标注:旧标题 → 新标题)
    • 新增章节
    • 移除章节
    • 需要更新的模板(✅ 已更新 / ⚠ 待处理),并标注文件路径
    • 若有占位符被有意延迟定义,列出后续待办事项。
  6. 最终输出前的验证:
    • 不存在未说明的方括号标记。
    • 版本行与报告内容一致。
    • 日期采用ISO格式YYYY-MM-DD。
    • 原则表述需明确、可验证,且无模糊语言(若使用了"should",需在适当情况下替换为MUST/SHOULD并说明理由)。
  7. 将完成的章程写回
    .specify/memory/constitution.md
    文件(覆盖原有内容)。
  8. 向用户输出最终摘要,包含:
    • 新版本号及版本升级理由。
    • 所有标记为需手动跟进的文件。
    • 建议的提交信息(例如:
      docs: amend constitution to vX.Y.Z (principle additions + governance update)
      )。
格式与风格要求:
  • 严格使用模板中的Markdown标题层级(不得降级或升级标题级别)。
  • 为保证可读性,可对较长的理由文本进行换行(理想长度为每行不超过100字符),但不得为换行而强行拆分内容。
  • 章节之间保留一个空行。
  • 避免行尾空格。
若用户提供的是部分更新(例如仅修订一个原则),仍需执行验证和版本决策步骤。
若缺失关键信息(例如确实未知通过日期),插入
TODO(<FIELD_NAME>): explanation
标记,并在同步影响报告的延迟事项中列出。
不得创建新模板;始终基于现有的
.specify/memory/constitution.md
文件进行操作。

Outputs

输出结果

  • Updated
    .specify/memory/constitution.md
    (with Sync Impact Report comment)
  • Any updated templates or runtime guidance files required to stay consistent with the constitution
  • 更新后的
    .specify/memory/constitution.md
    文件(包含同步影响报告注释)
  • 所有为与章程保持一致而需更新的模板或运行时指导文件

Next Steps

后续步骤

After updating the constitution:
  • Specify new features with speckit-specify.
更新章程后:
  • 使用speckit-specify来Specify新功能。