ln-111-root-docs-creator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Root Documentation Creator

根文档创建器

L3 Worker that creates 4 root documentation files using templates and Context Store from coordinator.
这是一个L3 Worker,使用模板和协调器提供的Context Store创建4个根文档文件。

Purpose & Scope

目的与范围

  • Creates 4 root documentation files (entry points for AI agents)
  • Receives Context Store from ln-110-project-docs-coordinator
  • Replaces placeholders with project-specific data
  • Self-validates structure and content (22 questions)
  • Never gathers context itself; uses coordinator input
  • 创建4个根文档文件(AI Agent的入口文件)
  • 接收来自ln-110-project-docs-coordinator的Context Store
  • 使用项目特定数据替换占位符
  • 自我验证结构与内容(22项检查问题)
  • 绝不自行收集上下文;仅使用协调器提供的输入

Invocation (who/when)

调用方式(调用方/时机)

  • ln-110-project-docs-coordinator: ALWAYS invoked as first worker
  • Never called directly by users
  • ln-110-project-docs-coordinator: 始终作为第一个Worker被调用
  • 绝不直接由用户调用

Inputs

输入参数

From coordinator:
  • contextStore
    : Key-value pairs with all placeholders
    • PROJECT_NAME, PROJECT_DESCRIPTION
    • TECH_STACK_SUMMARY
    • DEV_COMMANDS (from package.json scripts)
    • DATE (current date)
    • LEGACY_CONTENT (optional, from ln-100 Phase 0 migration):
      • legacy_principles
        : { principles[], anti_patterns[], conventions[] }
  • targetDir
    : Project root directory
LEGACY_CONTENT is used as base content when creating principles.md. Priority: Legacy > Template defaults.
来自协调器的输入:
  • contextStore
    :包含所有占位符的键值对
    • PROJECT_NAME、PROJECT_DESCRIPTION
    • TECH_STACK_SUMMARY
    • DEV_COMMANDS(来自package.json的脚本)
    • DATE(当前日期)
    • LEGACY_CONTENT(可选,来自ln-100 Phase 0迁移):
      • legacy_principles
        : { principles[], anti_patterns[], conventions[] }
  • targetDir
    : 项目根目录
LEGACY_CONTENT在创建principles.md时用作基础内容。优先级:遗留内容 > 模板默认值

Documents Created (4)

创建的文档(4个)

FileTarget SectionsQuestions
CLAUDE.mdCritical Rules, Documentation Navigation, Development Commands, MaintenanceQ1-Q6
docs/README.mdOverview, Standards, Writing Guidelines, Quick Navigation, MaintenanceQ7-Q13
docs/documentation_standards.mdQuick Reference (60+ requirements), 12 main sections, MaintenanceQ14-Q16
docs/principles.mdCore Principles (8), Decision Framework, Anti-Patterns, Verification, MaintenanceQ17-Q22
文件目标章节检查问题
CLAUDE.md关键规则、文档导航、开发命令、维护Q1-Q6
docs/README.md概述、标准、写作指南、快速导航、维护Q7-Q13
docs/documentation_standards.md快速参考(60+项要求)、12个主要章节、维护Q14-Q16
docs/principles.md核心原则(8项)、决策框架、反模式、验证、维护Q17-Q22

Workflow

工作流

Phase 1: Receive Context

阶段1:接收上下文

  1. Parse Context Store from coordinator
  2. Validate required keys present (PROJECT_NAME, PROJECT_DESCRIPTION)
  3. Set defaults for missing optional keys
  1. 解析来自协调器的Context Store
  2. 验证必填键是否存在(PROJECT_NAME、PROJECT_DESCRIPTION)
  3. 为缺失的可选键设置默认值

Phase 2: Create Documents

阶段2:创建文档

For each document (CLAUDE.md, docs/README.md, documentation_standards.md, principles.md):
  1. Check if file exists (idempotent)
  2. If exists: skip with log
  3. If not exists:
    • Copy template from
      references/templates/
    • Check LEGACY_CONTENT for this document type:
      • For
        principles.md
        : If
        LEGACY_CONTENT.legacy_principles
        exists:
        • Use
          legacy_principles.principles[]
          as base for "## Core Principles" section
        • Use
          legacy_principles.anti_patterns[]
          for "## Anti-Patterns" section
        • Use
          legacy_principles.conventions[]
          for code style rules
        • Augment with template structure (add missing sections)
        • Mark:
          <!-- Migrated from legacy documentation -->
          at top of relevant sections
      • For other documents: Use template as-is (no legacy content applicable)
    • Replace
      {{PLACEHOLDER}}
      with Context Store values
    • Mark
      [TBD: X]
      for missing data (never leave empty placeholders)
    • Write file
针对每个文档(CLAUDE.md、docs/README.md、documentation_standards.md、principles.md):
  1. 检查文件是否已存在(幂等性)
  2. 若已存在:跳过并记录日志
  3. 若不存在:
    • references/templates/
      复制模板
    • 检查该文档类型的LEGACY_CONTENT:
      • 对于
        principles.md
        :若
        LEGACY_CONTENT.legacy_principles
        存在:
        • 使用
          legacy_principles.principles[]
          作为“## 核心原则”章节的基础内容
        • 使用
          legacy_principles.anti_patterns[]
          作为“## 反模式”章节的内容
        • 使用
          legacy_principles.conventions[]
          作为代码风格规则
        • 结合模板结构补充(添加缺失的章节)
        • 在相关章节顶部标记:
          <!-- Migrated from legacy documentation -->
      • 对于其他文档:直接使用模板(不适用遗留内容)
    • {{PLACEHOLDER}}
      替换为Context Store中的值
    • 对缺失的数据标记为
      [TBD: X]
      (绝不保留空占位符)
    • 写入文件

Phase 3: Self-Validate

阶段3:自我验证

For each created document:
  1. Check SCOPE tag in first 10 lines
  2. Check required sections (from questions_root.md)
  3. Check Maintenance section (Update Triggers, Verification, Last Updated)
  4. Check POSIX endings (single newline at end)
  5. Auto-fix issues where possible
针对每个已创建的文档:
  1. 检查前10行中是否包含SCOPE标签
  2. 检查是否包含必填章节(来自questions_root.md)
  3. 检查维护章节(更新触发条件、验证方式、最后更新时间)
  4. 检查POSIX结尾(文件末尾有单个换行符)
  5. 尽可能自动修复问题

Phase 4: Return Status

阶段4:返回状态

Return to coordinator:
json
{
  "created": ["CLAUDE.md", "docs/README.md", ...],
  "skipped": [],
  "tbd_count": 3,
  "validation": "OK"
}
向协调器返回:
json
{
  "created": ["CLAUDE.md", "docs/README.md", ...],
  "skipped": [],
  "tbd_count": 3,
  "validation": "OK"
}

Critical Notes

重要注意事项

Core Rules

核心规则

  • Idempotent: Never overwrite existing files; skip and log
  • No context gathering: All data comes from coordinator's Context Store
  • TBD markers: Use
    [TBD: placeholder_name]
    for missing data, never
    {{PLACEHOLDER}}
  • Language: All root docs in English (universal standards)
  • SCOPE tags: Required in first 10 lines of each file
  • 幂等性: 绝不覆盖现有文件;跳过并记录日志
  • 禁止自行收集上下文: 所有数据均来自协调器的Context Store
  • TBD标记: 对缺失数据使用
    [TBD: placeholder_name]
    ,绝不使用
    {{PLACEHOLDER}}
  • 语言: 所有根文档均使用英文(通用标准)
  • SCOPE标签: 每个文件的前10行必须包含SCOPE标签

NO_CODE_EXAMPLES Rule (MANDATORY)

NO_CODE_EXAMPLES规则(强制性)

Root documents define navigation and standards, NOT implementations:
  • FORBIDDEN: Code blocks, implementation snippets
  • ALLOWED: Tables, links, command examples (1 line)
  • TEMPLATE RULE: All templates include
    <!-- NO_CODE_EXAMPLES: ... -->
    tag - FOLLOW IT
根文档用于定义导航与标准,而非实现细节:
  • 禁止: 代码块、实现片段
  • 允许: 表格、链接、单行命令示例
  • 模板规则: 所有模板均包含
    <!-- NO_CODE_EXAMPLES: ... -->
    标签 —— 必须遵守

Stack Adaptation Rule (MANDATORY)

技术栈适配规则(强制性)

  • All external links must match project stack (detected in Context Store)
  • .NET project → Microsoft docs; Node.js → MDN, npm docs; Python → Python docs
  • Never mix stack references (no Python examples in .NET project)
  • 所有外部链接必须匹配项目技术栈(从Context Store中检测)
  • .NET项目 → 微软文档;Node.js → MDN、npm文档;Python → Python官方文档
  • 绝不混合技术栈引用(.NET项目中不得出现Python示例)

Format Priority (MANDATORY)

格式优先级(强制性)

Tables/ASCII > Lists (enumerations only) > Text (last resort)
表格/ASCII图表 > 列表(仅用于枚举) > 文本(最后选择)

Definition of Done

完成标准

  • Context Store received and validated
  • 4 root documents created (or skipped if exist)
  • All placeholders replaced (or marked TBD)
  • Self-validation passed (SCOPE, sections, Maintenance, POSIX)
  • Status returned to coordinator
  • 已接收并验证Context Store
  • 已创建4个根文档(或因已存在而跳过)
  • 所有占位符已替换(或标记为TBD)
  • 自我验证通过(SCOPE、章节、维护、POSIX结尾)
  • 已向协调器返回状态

Reference Files

参考文件

  • Templates:
    references/templates/claude_md_template.md
    ,
    docs_root_readme_template.md
    ,
    documentation_standards_template.md
    ,
    principles_template.md
  • Questions:
    references/questions_root.md
    (Q1-Q22)

Version: 2.1.0 (Added NO_CODE, Stack Adaptation, Format Priority rules to Critical Notes) Last Updated: 2025-01-12
  • 模板:
    references/templates/claude_md_template.md
    docs_root_readme_template.md
    documentation_standards_template.md
    principles_template.md
  • 检查问题:
    references/questions_root.md
    (Q1-Q22)

版本: 2.1.0(在重要注意事项中新增NO_CODE、技术栈适配、格式优先级规则) 最后更新: 2025-01-12