init-claude-project
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInit Claude Project
初始化Claude项目
Bootstraps a target codebase for AI-driven development. Implements Phase 2 of the AI Development Framework V2: turning a fresh or existing project into one Claude can work in productively, by adding a stack-grounded and a skeleton.
CLAUDE.mddocs/为AI驱动开发搭建目标代码库。实现AI开发框架V2的第二阶段:通过添加基于技术栈的文件和文件夹骨架,将全新或已有项目转变为Claude可高效协作的开发环境。
CLAUDE.mddocs/Core principle
核心原则
CLAUDE.mdCLAUDE.md@path/to/fileCLAUDE.mdCLAUDE.md@path/to/fileWhen to use
使用场景
- Greenfield repo just initialized → start at Phase 1.
- Existing repo with no → start at Phase 1.
CLAUDE.md - Existing needs a refresh → jump to Phase 2 with the existing file as input.
CLAUDE.md
Skip for: single-file scripts, throwaway prototypes, repos that already have a healthy and setup.
CLAUDE.mddocs/- 刚初始化的全新仓库 → 从第一阶段开始。
- 无的已有仓库 → 从第一阶段开始。
CLAUDE.md - 已有需要更新 → 以现有文件为输入,直接进入第二阶段。
CLAUDE.md
无需使用的场景:单文件脚本、一次性原型、已具备完善和结构的仓库。
CLAUDE.mddocs/The 3 phases
三个阶段
Each phase has an INPUT, an OUTPUT artifact, and a HUMAN GATE before advancing.
| # | Phase | Input | Output | Prompt file |
|---|---|---|---|---|
| 1 | Discover stack | Target repo | Stack summary (approved) | prompts/01-discover-stack.md |
| 2 | Fill CLAUDE.md | Stack summary | | prompts/02-fill-claude-md.md |
| 3 | Bootstrap docs | Approved CLAUDE.md | | prompts/03-bootstrap-docs.md |
每个阶段都有输入、输出产物,以及进入下一阶段前的人工确认环节。
| 序号 | 阶段 | 输入 | 输出 | 提示文件 |
|---|---|---|---|---|
| 1 | 技术栈探测 | 目标仓库 | 技术栈总结(已确认) | prompts/01-discover-stack.md |
| 2 | 填充CLAUDE.md | 技术栈总结 | 仓库根目录下的 | prompts/02-fill-claude-md.md |
| 3 | 搭建文档骨架 | 已确认的CLAUDE.md | | prompts/03-bootstrap-docs.md |
Operating protocol
操作流程
- Identify the entry phase — usually Phase 1 unless the user explicitly says they only want a CLAUDE.md refresh or a docs bootstrap.
- Read the matching prompt file in and run it on the user's repo. Treat the prompt body as a system instruction — follow its rules literally.
prompts/ - Stop at every phase boundary. Show the artifact and ask: approved / refine / restart phase. Do not chain phases without explicit approval.
<section> - Phase 2 drafting: copy templates/CLAUDE.md.tmpl and fill it with discovered stack info. Mark anything ambiguous .
⚠️ NEEDS INPUT: <question> - Phase 3 docs: copy templates/docs-readme.md.tmpl into .
docs/README.md - Final gate: score against references/checklist.md. All five items MUST pass before handoff.
- 确定起始阶段 —— 通常为第一阶段,除非用户明确表示仅需更新CLAUDE.md或搭建文档骨架。
- 读取目录下对应的提示文件,并在用户仓库中执行。将提示内容视为系统指令——严格遵循其规则。
prompts/ - 在每个阶段边界处停止。展示产物并询问:确认通过 / 优化/ 重启本阶段。未获得明确许可前,不得连续执行多个阶段。
<section> - 第二阶段起草:复制templates/CLAUDE.md.tmpl模板,填入探测到的技术栈信息。对不明确的内容标记为。
⚠️ 需要输入:<问题> - 第三阶段文档搭建:将templates/docs-readme.md.tmpl模板复制到。
docs/README.md - 最终确认环节:对照references/checklist.md进行评分。必须满足全部五项要求后,方可交付。
Hard rules (non-negotiable)
硬性规则(不可协商)
- CLAUDE.md ≤ 100 lines. If you exceed, move content into a file and import with .
@path - No invented commands. Every build/test/lint command in CLAUDE.md MUST come from ,
package.json,Makefile,pyproject.toml, or equivalent — verified by reading the file. If you can't verify, useCargo.toml.⚠️ NEEDS INPUT: - Four mandatory rules in every generated CLAUDE.md (from the framework):
- Where designs live () and how to read them.
docs/designs/ - Where development plans live () and the markdown checkbox format (
docs/plans//- [ ] Task).- [x] Done - Use Conventional Commits.
- Run tests after every change (unless a TDD/Superpowers-style skill is already installed — in which case skip this rule, do not duplicate).
- Where designs live (
- No TDD-runner instructions duplicated if the target repo already has a TDD skill (, Superpowers, GSD) — defer to it.
skills/tdd/ - Ambiguity → ASK. Never invent a build command, test runner, or code-style rule.
- Use for anything that's only sometimes relevant (e.g.
@imports,@docs/architecture.md).@docs/framework.md
- CLAUDE.md ≤ 100行。如果超出,将内容移至单独文件并通过导入。
@path - 不得编造命令。CLAUDE.md中的所有构建/测试/检查命令必须来自、
package.json、Makefile、pyproject.toml或等效文件——需通过读取文件验证。若无法验证,使用Cargo.toml标记。⚠️ 需要输入: - 每个生成的CLAUDE.md必须包含四条强制规则(来自框架):
- 设计文档的存放位置()及阅读方式。
docs/designs/ - 开发计划的存放位置()及Markdown复选框格式(
docs/plans//- [ ] 任务)。- [x] 已完成 - 使用Conventional Commits规范提交。
- 每次修改后运行测试(除非已安装TDD/Superpowers类技能——在此情况下跳过本规则,避免重复)。
- 设计文档的存放位置(
- 若目标仓库已具备TDD技能(、Superpowers、GSD),不得重复添加TDD运行器指令——以现有技能为准。
skills/tdd/ - 遇到歧义→询问。绝不能编造构建命令、测试运行器或代码风格规则。
- **使用**处理仅在特定场景下相关的内容(例如
@imports、@docs/architecture.md)。@docs/framework.md
What NOT to do
禁止操作
See references/anti-patterns.md. Top four to watch:
- Inventing build/test commands. Every command in CLAUDE.md MUST come from a manifest you actually read. If you can't verify, write .
⚠️ NEEDS INPUT: - Bloated CLAUDE.md. Hard cap 100 lines. "Would removing this cause Claude to make a mistake?" — if no, delete.
- Aspirational rules. Only encode rules the team actually enforces (linter, CI, agreed convention). No "we should write tests" if no one does.
- Silent overwrite of existing CLAUDE.md. Always diff and ask which sections to keep.
详情请见references/anti-patterns.md。需重点关注的四大反模式:
- 编造构建/测试命令。CLAUDE.md中的所有命令必须来自实际读取的清单文件。若无法验证,写入。
⚠️ 需要输入: - 臃肿的CLAUDE.md。严格限制在100行以内。自问“删除这一行会导致Claude出错吗?”——如果不会,就删除。
- 理想化规则。仅编码团队实际执行的规则(检查器、CI、已达成一致的约定)。若团队并未执行“应该编写测试”,则不得添加该规则。
- 静默覆盖现有CLAUDE.md。始终先对比差异,询问保留哪些部分。
References
参考资料
- CLAUDE.md template: templates/CLAUDE.md.tmpl
- docs/README template: templates/docs-readme.md.tmpl
- Phase prompts: prompts/01-discover-stack.md, prompts/02-fill-claude-md.md, prompts/03-bootstrap-docs.md
- Handoff checklist: references/checklist.md
- Anti-patterns and remedies: references/anti-patterns.md
- Conventional commits + plan format: references/conventions.md
- Source framework: ../../docs/framework.md
- CLAUDE.md模板:templates/CLAUDE.md.tmpl
- docs/README模板:templates/docs-readme.md.tmpl
- 阶段提示文件:prompts/01-discover-stack.md、prompts/02-fill-claude-md.md、prompts/03-bootstrap-docs.md
- 交付检查清单:references/checklist.md
- 反模式及解决方案:references/anti-patterns.md
- 规范提交+计划格式:references/conventions.md
- 源框架:../../docs/framework.md