init-claude-project

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Init 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
CLAUDE.md
and a
docs/
skeleton.
为AI驱动开发搭建目标代码库。实现AI开发框架V2第二阶段:通过添加基于技术栈的
CLAUDE.md
文件和
docs/
文件夹骨架,将全新或已有项目转变为Claude可高效协作的开发环境。

Core principle

核心原则

CLAUDE.md
MUST be short, stack-specific, and verified. Every line must answer "would removing this cause Claude to make a mistake?" — if no, drop it. Bloated
CLAUDE.md
files cause Claude to ignore real instructions. Use
@path/to/file
imports for anything that's only sometimes relevant.
CLAUDE.md
必须简洁、贴合技术栈且经过验证。每一行都要回答“删除这一行会导致Claude出错吗?”——如果不会,就删掉。臃肿的
CLAUDE.md
会让Claude忽略真实指令。对于仅在特定场景下相关的内容,使用
@path/to/file
导入。

When to use

使用场景

  • Greenfield repo just initialized → start at Phase 1.
  • Existing repo with no
    CLAUDE.md
    → start at Phase 1.
  • Existing
    CLAUDE.md
    needs a refresh → jump to Phase 2 with the existing file as input.
Skip for: single-file scripts, throwaway prototypes, repos that already have a healthy
CLAUDE.md
and
docs/
setup.
  • 刚初始化的全新仓库 → 从第一阶段开始。
  • CLAUDE.md
    的已有仓库 → 从第一阶段开始。
  • 已有
    CLAUDE.md
    需要更新 → 以现有文件为输入,直接进入第二阶段
无需使用的场景:单文件脚本、一次性原型、已具备完善
CLAUDE.md
docs/
结构的仓库。

The 3 phases

三个阶段

Each phase has an INPUT, an OUTPUT artifact, and a HUMAN GATE before advancing.
#PhaseInputOutputPrompt file
1Discover stackTarget repoStack summary (approved)prompts/01-discover-stack.md
2Fill CLAUDE.mdStack summary
CLAUDE.md
at repo root
prompts/02-fill-claude-md.md
3Bootstrap docsApproved CLAUDE.md
docs/
skeleton + README
prompts/03-bootstrap-docs.md
每个阶段都有输入、输出产物,以及进入下一阶段前的人工确认环节
序号阶段输入输出提示文件
1技术栈探测目标仓库技术栈总结(已确认)prompts/01-discover-stack.md
2填充CLAUDE.md技术栈总结仓库根目录下的
CLAUDE.md
prompts/02-fill-claude-md.md
3搭建文档骨架已确认的CLAUDE.md
docs/
文件夹骨架 + README
prompts/03-bootstrap-docs.md

Operating protocol

操作流程

  1. Identify the entry phase — usually Phase 1 unless the user explicitly says they only want a CLAUDE.md refresh or a docs bootstrap.
  2. Read the matching prompt file in
    prompts/
    and run it on the user's repo. Treat the prompt body as a system instruction — follow its rules literally.
  3. Stop at every phase boundary. Show the artifact and ask: approved / refine
    <section>
    / restart phase
    . Do not chain phases without explicit approval.
  4. Phase 2 drafting: copy templates/CLAUDE.md.tmpl and fill it with discovered stack info. Mark anything ambiguous
    ⚠️ NEEDS INPUT: <question>
    .
  5. Phase 3 docs: copy templates/docs-readme.md.tmpl into
    docs/README.md
    .
  6. Final gate: score against references/checklist.md. All five items MUST pass before handoff.
  1. 确定起始阶段 —— 通常为第一阶段,除非用户明确表示仅需更新CLAUDE.md或搭建文档骨架。
  2. 读取
    prompts/
    目录下对应的提示文件
    ,并在用户仓库中执行。将提示内容视为系统指令——严格遵循其规则。
  3. 在每个阶段边界处停止。展示产物并询问:确认通过 / 优化
    <section>
    / 重启本阶段。未获得明确许可前,不得连续执行多个阶段。
  4. 第二阶段起草:复制templates/CLAUDE.md.tmpl模板,填入探测到的技术栈信息。对不明确的内容标记为
    ⚠️ 需要输入:<问题>
  5. 第三阶段文档搭建:将templates/docs-readme.md.tmpl模板复制到
    docs/README.md
  6. 最终确认环节:对照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
    ,
    Cargo.toml
    , or equivalent — verified by reading the file. If you can't verify, use
    ⚠️ NEEDS INPUT:
    .
  • Four mandatory rules in every generated CLAUDE.md (from the framework):
    1. Where designs live (
      docs/designs/
      ) and how to read them.
    2. Where development plans live (
      docs/plans/
      ) and the markdown checkbox format (
      - [ ] Task
      /
      - [x] Done
      ).
    3. Use Conventional Commits.
    4. Run tests after every change (unless a TDD/Superpowers-style skill is already installed — in which case skip this rule, do not duplicate).
  • No TDD-runner instructions duplicated if the target repo already has a TDD skill (
    skills/tdd/
    , Superpowers, GSD) — defer to it.
  • Ambiguity → ASK. Never invent a build command, test runner, or code-style rule.
  • Use
    @imports
    for anything that's only sometimes relevant (e.g.
    @docs/architecture.md
    ,
    @docs/framework.md
    ).
  • CLAUDE.md ≤ 100行。如果超出,将内容移至单独文件并通过
    @path
    导入。
  • 不得编造命令。CLAUDE.md中的所有构建/测试/检查命令必须来自
    package.json
    Makefile
    pyproject.toml
    Cargo.toml
    或等效文件——需通过读取文件验证。若无法验证,使用
    ⚠️ 需要输入:
    标记。
  • 每个生成的CLAUDE.md必须包含四条强制规则(来自框架):
    1. 设计文档的存放位置(
      docs/designs/
      )及阅读方式。
    2. 开发计划的存放位置(
      docs/plans/
      )及Markdown复选框格式(
      - [ ] 任务
      /
      - [x] 已完成
      )。
    3. 使用Conventional Commits规范提交。
    4. 每次修改后运行测试(除非已安装TDD/Superpowers类技能——在此情况下跳过本规则,避免重复)。
  • 若目标仓库已具备TDD技能
    skills/tdd/
    、Superpowers、GSD),不得重复添加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.mdprompts/02-fill-claude-md.mdprompts/03-bootstrap-docs.md
  • 交付检查清单:references/checklist.md
  • 反模式及解决方案:references/anti-patterns.md
  • 规范提交+计划格式:references/conventions.md
  • 源框架:../../docs/framework.md