cmd-speckit-init

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

/speckit.init

/speckit.init

Agent skill wrapper for the Claude command
/speckit.init
.
When the original command text references
{{INPUT}}
,
$1
, or named arguments, map them from the user's current request.
这是Claude命令
/speckit.init
的Agent技能封装。
当原始命令文本引用
{{INPUT}}
$1
或命名参数时,从用户当前请求中映射对应参数。

Command Instructions

命令说明

Set up the
.specify/
directory structure for Specification-Driven Development in the current project by downloading the latest files from the upstream
github/spec-kit
repository.
通过从上游
github/spec-kit
仓库下载最新文件,在当前项目中为规范驱动开发(Specification-Driven Development)搭建
.specify/
目录结构。

Steps

步骤

  1. Check for existing setup: Look for
    .specify/
    in the project root. If it already exists, stop and tell the user to run
    /speckit.init.update
    instead.
  2. Clone upstream:
    bash
    UPSTREAM_DIR=$(mktemp -d)
    git clone --depth 1 https://github.com/github/spec-kit.git "$UPSTREAM_DIR"
    If the clone fails, report the error and stop.
  3. Copy files from upstream into the project root, preserving the paths exactly:
    Upstream sourceLocal destination
    .specify/memory/constitution.md
    .specify/memory/constitution.md
    .specify/scripts/bash/common.sh
    .specify/scripts/bash/common.sh
    .specify/scripts/bash/setup-plan.sh
    .specify/scripts/bash/setup-plan.sh
    .specify/scripts/bash/check-prerequisites.sh
    .specify/scripts/bash/check-prerequisites.sh
    .specify/scripts/bash/update-agent-context.sh
    .specify/scripts/bash/update-agent-context.sh
    .specify/scripts/bash/create-new-feature.sh
    .specify/scripts/bash/create-new-feature.sh
    .specify/templates/agent-file-template.md
    .specify/templates/agent-file-template.md
    .specify/templates/checklist-template.md
    .specify/templates/checklist-template.md
    .specify/templates/tasks-template.md
    .specify/templates/tasks-template.md
    .specify/templates/spec-template.md
    .specify/templates/spec-template.md
    .specify/templates/plan-template.md
    .specify/templates/plan-template.md
    Create any intermediate directories as needed. Preserve file permissions (especially executable bits on shell scripts).
  4. Clean up:
    bash
    rm -rf "$UPSTREAM_DIR"
  5. Detect project name: Try in order —
    git remote get-url origin
    (extract repo name from URL),
    package.json
    name
    field,
    mix.exs
    app name, directory basename. Use this as
    PROJECT_NAME
    .
  6. Personalize
    .specify/memory/constitution.md
    : Replace placeholder tokens in the downloaded file:
    • [PROJECT_NAME]
      → detected project name
    • [YYYY-MM-DD]
      → today's date in ISO format
  7. Create
    .specify/specs/
    : Make this directory for feature specification artifacts (one subdirectory per feature). This directory is not present in upstream.
  8. Update
    .gitignore
    : Only if
    .gitignore
    exists and does not already contain
    .specify/
    . Append
    .specify/
    as a new line. If no
    .gitignore
    exists, skip and note it.
  9. Report all directories and files created with their paths.
  10. Present the SDD workflow overview:
    Spec-Driven Development workflow:
      /speckit.constitution  → Define governing principles (run once per project)
      /speckit.specify       → Write a feature spec
      /speckit.clarify       → Resolve ambiguities in the spec
      /speckit.plan          → Generate technical plan + data model + contracts
      /speckit.analyze       → Validate consistency across artifacts (read-only)
      /speckit.tasks         → Generate phase-based task breakdown
      /speckit.checklist     → Create quality checklists for the spec
      /speckit.implement     → Execute implementation phase by phase
      /speckit.taskstoissues → Convert tasks into GitHub issues
  11. Next step: "Run
    /speckit.constitution
    to complete your project constitution with project-specific principles, then
    /speckit.specify
    to write your first feature spec."
  1. 检查现有配置:在项目根目录中查找
    .specify/
    。如果已存在,请停止操作并告知用户应运行
    /speckit.init.update
    命令。
  2. 克隆上游仓库
    bash
    UPSTREAM_DIR=$(mktemp -d)
    git clone --depth 1 https://github.com/github/spec-kit.git "$UPSTREAM_DIR"
    如果克隆失败,报告错误并停止操作。
  3. 将上游文件复制到项目根目录,严格保留路径:
    上游源文件本地目标路径
    .specify/memory/constitution.md
    .specify/memory/constitution.md
    .specify/scripts/bash/common.sh
    .specify/scripts/bash/common.sh
    .specify/scripts/bash/setup-plan.sh
    .specify/scripts/bash/setup-plan.sh
    .specify/scripts/bash/check-prerequisites.sh
    .specify/scripts/bash/check-prerequisites.sh
    .specify/scripts/bash/update-agent-context.sh
    .specify/scripts/bash/update-agent-context.sh
    .specify/scripts/bash/create-new-feature.sh
    .specify/scripts/bash/create-new-feature.sh
    .specify/templates/agent-file-template.md
    .specify/templates/agent-file-template.md
    .specify/templates/checklist-template.md
    .specify/templates/checklist-template.md
    .specify/templates/tasks-template.md
    .specify/templates/tasks-template.md
    .specify/templates/spec-template.md
    .specify/templates/spec-template.md
    .specify/templates/plan-template.md
    .specify/templates/plan-template.md
    根据需要创建中间目录。保留文件权限(尤其是shell脚本的可执行权限)。
  4. 清理临时文件
    bash
    rm -rf "$UPSTREAM_DIR"
  5. 检测项目名称:按以下顺序尝试获取 ——
    git remote get-url origin
    (从URL中提取仓库名称)、
    package.json
    name
    字段、
    mix.exs
    的应用名称、目录基名。将其设为
    PROJECT_NAME
  6. 个性化
    .specify/memory/constitution.md
    :替换下载文件中的占位符:
    • [PROJECT_NAME]
      → 检测到的项目名称
    • [YYYY-MM-DD]
      → 当天的ISO格式日期
  7. 创建
    .specify/specs/
    目录
    :用于存放功能规范工件(每个功能对应一个子目录)。该目录不存在于上游仓库中。
  8. 更新
    .gitignore
    :仅当
    .gitignore
    存在且尚未包含
    .specify/
    时执行。在文件末尾添加新行
    .specify/
    。如果
    .gitignore
    不存在,则跳过并告知用户。
  9. 报告所有创建的目录和文件及其路径。
  10. 展示SDD工作流概述
    规范驱动开发(Spec-Driven Development)工作流:
      /speckit.constitution  → 定义指导原则(每个项目运行一次)
      /speckit.specify       → 编写功能规范
      /speckit.clarify       → 解决规范中的歧义
      /speckit.plan          → 生成技术方案 + 数据模型 + 契约
      /speckit.analyze       → 验证工件间的一致性(只读)
      /speckit.tasks         → 生成基于阶段的任务分解
      /speckit.checklist     → 为规范创建质量检查清单
      /speckit.implement     → 分阶段执行实现工作
      /speckit.taskstoissues → 将任务转换为GitHub Issues
  11. 下一步操作:"运行
    /speckit.constitution
    以使用项目特定原则完成项目章程,然后运行
    /speckit.specify
    编写你的第一个功能规范。"