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.initWhen the original command text references , , or named arguments, map them from the user's current request.
{{INPUT}}$1这是Claude命令 的Agent技能封装。
/speckit.init当原始命令文本引用 、 或命名参数时,从用户当前请求中映射对应参数。
{{INPUT}}$1Command Instructions
命令说明
Set up the directory structure for Specification-Driven Development in the current project by downloading the latest files from the upstream repository.
.specify/github/spec-kit通过从上游 仓库下载最新文件,在当前项目中为规范驱动开发(Specification-Driven Development)搭建 目录结构。
github/spec-kit.specify/Steps
步骤
-
Check for existing setup: Look forin the project root. If it already exists, stop and tell the user to run
.specify/instead./speckit.init.update -
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. -
Copy files from upstream into the project root, preserving the paths exactly:
Upstream source Local 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.mdCreate any intermediate directories as needed. Preserve file permissions (especially executable bits on shell scripts). -
Clean up:bash
rm -rf "$UPSTREAM_DIR" -
Detect project name: Try in order —(extract repo name from URL),
git remote get-url originpackage.jsonfield,nameapp name, directory basename. Use this asmix.exs.PROJECT_NAME -
Personalize: Replace placeholder tokens in the downloaded file:
.specify/memory/constitution.md- → detected project name
[PROJECT_NAME] - → today's date in ISO format
[YYYY-MM-DD]
-
Create: Make this directory for feature specification artifacts (one subdirectory per feature). This directory is not present in upstream.
.specify/specs/ -
Update: Only if
.gitignoreexists and does not already contain.gitignore. Append.specify/as a new line. If no.specify/exists, skip and note it..gitignore -
Report all directories and files created with their paths.
-
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 -
Next step: "Runto complete your project constitution with project-specific principles, then
/speckit.constitutionto write your first feature spec."/speckit.specify
-
检查现有配置:在项目根目录中查找。如果已存在,请停止操作并告知用户应运行
.specify/命令。/speckit.init.update -
克隆上游仓库:bash
UPSTREAM_DIR=$(mktemp -d) git clone --depth 1 https://github.com/github/spec-kit.git "$UPSTREAM_DIR"如果克隆失败,报告错误并停止操作。 -
将上游文件复制到项目根目录,严格保留路径:
上游源文件 本地目标路径 .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脚本的可执行权限)。 -
清理临时文件:bash
rm -rf "$UPSTREAM_DIR" -
检测项目名称:按以下顺序尝试获取 ——(从URL中提取仓库名称)、
git remote get-url origin的package.json字段、name的应用名称、目录基名。将其设为mix.exs。PROJECT_NAME -
个性化:替换下载文件中的占位符:
.specify/memory/constitution.md- → 检测到的项目名称
[PROJECT_NAME] - → 当天的ISO格式日期
[YYYY-MM-DD]
-
创建目录:用于存放功能规范工件(每个功能对应一个子目录)。该目录不存在于上游仓库中。
.specify/specs/ -
更新:仅当
.gitignore存在且尚未包含.gitignore时执行。在文件末尾添加新行.specify/。如果.specify/不存在,则跳过并告知用户。.gitignore -
报告所有创建的目录和文件及其路径。
-
展示SDD工作流概述:
规范驱动开发(Spec-Driven Development)工作流: /speckit.constitution → 定义指导原则(每个项目运行一次) /speckit.specify → 编写功能规范 /speckit.clarify → 解决规范中的歧义 /speckit.plan → 生成技术方案 + 数据模型 + 契约 /speckit.analyze → 验证工件间的一致性(只读) /speckit.tasks → 生成基于阶段的任务分解 /speckit.checklist → 为规范创建质量检查清单 /speckit.implement → 分阶段执行实现工作 /speckit.taskstoissues → 将任务转换为GitHub Issues -
下一步操作:"运行以使用项目特定原则完成项目章程,然后运行
/speckit.constitution编写你的第一个功能规范。"/speckit.specify