ln-301-task-creator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Universal Task Creator

通用任务创建器

Worker that generates task documents and creates Linear issues for implementation, refactoring, or test tasks as instructed by orchestrators.
这是一个工作组件,可根据编排器的指令生成任务文档,并为实现、重构或测试任务创建Linear议题。

Purpose & Scope

目标与范围

  • Owns all task templates and creation logic (Linear + kanban updates)
  • Generates full task documents per type (implementation/refactoring/test)
  • Enforces type-specific hard rules (no new tests in impl, regression strategy for refactoring, risk matrix and limits for test)
  • Drops NFR bullets if supplied; only functional scope becomes tasks
  • Never decides scope itself; uses orchestrator input (plans/results)
  • 管理所有任务模板及创建逻辑(Linear + 看板更新)
  • 根据任务类型(实现/重构/测试)生成完整的任务文档
  • 执行特定类型的硬性规则(实现任务中不得新增测试、重构任务需包含回归策略、测试任务需包含风险矩阵与限制)
  • 若提供非功能需求(NFR)要点,将其排除;仅将功能范围转化为任务
  • 绝不自行决定范围;完全依赖编排器输入的计划/结果

Task Storage Mode

任务存储模式

MANDATORY READ: Load
shared/references/storage_mode_detection.md
for Linear vs File mode operations.
必读: 加载
shared/references/storage_mode_detection.md
以了解Linear与文件模式的操作方式。

Invocation (who/when)

调用方式(主体/时机)

  • ln-300-task-coordinator: CREATE (no tasks) or ADD (appendMode) for implementation tasks.
  • Orchestrators (other groups): Create refactoring or test tasks as needed.
  • Never called directly by users.
  • ln-300-task-coordinator: 为实现任务执行CREATE(无现有任务)或ADD(追加模式)操作。
  • 其他编排器: 根据需要创建重构或测试任务。
  • 绝不允许用户直接调用。

Inputs

输入参数

  • Common:
    taskType
    , teamId, Story data (id/title/description with AC, Technical Notes, Context).
  • Implementation CREATE: idealPlan (1-6 tasks), guideLinks.
  • Implementation ADD: appendMode=true, newTaskDescription, guideLinks.
  • Refactoring: codeQualityIssues, refactoringPlan, affectedComponents.
  • Test: manualTestResults, testPlan (E2E 2-5, Integration 0-8, Unit 0-15, Priority ≤15), infra/doc/cleanup items.
  • 通用参数:
    taskType
    、teamId、需求(Story)数据(ID/标题/包含验收标准的描述、技术说明、上下文)。
  • 实现任务CREATE模式:idealPlan(1-6个任务)、guideLinks。
  • 实现任务ADD模式:appendMode=true、newTaskDescription、guideLinks。
  • 重构任务:codeQualityIssues、refactoringPlan、affectedComponents。
  • 测试任务:manualTestResults、testPlan(E2E测试2-5个、集成测试0-8个、单元测试0-15个、优先级≤15)、基础设施/文档/清理项。

Workflow (concise)

工作流程(精简版)

  1. DRY Check (Codebase Scan): For EACH Task in plan:
    • Extract keywords: function type, component name, domain from Task description
    • Scan codebase:
      Grep(pattern="[keyword]", path="src/", output_mode="files_with_matches")
      for similar functionality
    • IF similar code found (≥70% keyword match):
      • Add
        ⚠️ DRY Warning
        section to Task description BEFORE Implementation Plan:
        markdown
        > [!WARNING]
        > **DRY Check:** Similar functionality detected in codebase
        > - Existing: src/services/auth/validateToken.ts:15-42
        > - Similarity: 85% (function name, domain match)
        > - **Recommendation:** Review existing implementation before creating new code
        >   - Option 1: Reuse existing function (import and call)
        >   - Option 2: Extend existing function with new parameters
        >   - Option 3: Justify why reimplementation needed (document in Technical Approach)
    • IF no duplication → Proceed without warning
    • Rationale: Prevents code duplication BEFORE implementation starts
  2. Template select: Load template based on taskType (see "Template Loading" section).
  3. Generate docs: Fill sections for each task in plan/request using provided data, guide links, and DRY warnings.
  4. Validate type rules: Stop with error if violation (see table below).
  5. Preview: Show titles/goals/estimates/AC/components, DRY warnings count, and totals.
  6. Confirmation required: Proceed only after explicit confirm.
  7. Create issues: Call Linear create_issue with parentId=Story, state=Backlog; capture URLs.
  8. Update kanban: Add under Story in Backlog with correct Epic/indent.
  9. Return summary: URLs, counts, hours, guide link count, DRY warnings count; next steps (validator/executor).
  1. DRY检查(代码库扫描): 针对计划中的每个任务:
    • 提取关键词:任务描述中的函数类型、组件名称、领域
    • 扫描代码库:执行
      Grep(pattern="[keyword]", path="src/", output_mode="files_with_matches")
      以查找相似功能
    • 若发现相似代码(关键词匹配度≥70%):
      • 在任务描述的「实现计划」前添加
        ⚠️ DRY警告
        章节:
        markdown
        > [!WARNING]
        > **DRY检查:** 代码库中检测到相似功能
        > - 现有代码:src/services/auth/validateToken.ts:15-42
        > - 匹配度:85%(函数名称、领域匹配)
        > - **建议:** 在创建新代码前先参考现有实现
        >   - 选项1:复用现有函数(导入并调用)
        >   - 选项2:扩展现有函数,新增参数
        >   - 选项3:说明为何需要重新实现(记录在技术方案中)
    • 若未发现重复代码 → 直接继续
    • 设计目的:在实现开始前避免代码重复
  2. 选择模板: 根据taskType加载对应模板(见「模板加载」章节)。
  3. 生成文档: 使用提供的数据、指南链接及DRY警告,填充计划/请求中每个任务的对应章节。
  4. 验证类型规则: 若违反规则则终止操作并返回错误(见下方表格)。
  5. 预览: 展示任务标题/目标/预估工时/验收标准/涉及组件、DRY警告数量及汇总信息。
  6. 需确认: 仅在用户明确确认后继续执行。
  7. 创建议题: 调用Linear的create_issue接口,设置parentId=需求ID,state=Backlog;记录议题链接。
  8. 更新看板: 在Backlog中对应需求下添加任务,并关联正确的Epic/设置缩进。
  9. 返回汇总: 包含议题链接、任务数量、总工时、指南链接数量、DRY警告数量;以及后续步骤(验证/执行)。

Type Rules (must pass)

类型规则(必须满足)

taskTypeHard ruleWhat to verify
implementationNo new test creationScan text for "write/create/add tests" etc.; allow only updating existing tests
refactoringRegression strategy requiredIssues listed with severity; plan in 3 phases; regression strategy (Baseline/Verify/Failure); preserve functionality
testRisk-based plan requiredPriority ≤15 scenarios; E2E 2-5, Integration 0-8, Unit 0-15, Total 10-28; no framework/library/DB tests
任务类型硬性规则验证内容
实现不得创建新测试扫描文本中是否包含「编写/创建/添加测试」等内容;仅允许更新现有测试
重构必须包含回归策略列出问题及严重程度;计划分为3个阶段;包含回归策略(基准/验证/故障处理);需保留原有功能
测试必须包含基于风险的计划场景优先级≤15;E2E测试2-5个、集成测试0-8个、单元测试0-15个,总数量10-28个;不得包含框架/库/数据库测试

Critical Notes

重要说明

  • MANDATORY: Always pass
    state: "Backlog"
    when calling create_issue. Linear defaults to team's default status (often "Postponed") if not specified.
  • DRY Check: Scan codebase for EACH Task before generation. If similar code found (≥70% keyword match) → add
    ⚠️ DRY Warning
    section with 3 options (reuse/extend/justify). Skip scan for test tasks (no implementation code).
  • Foundation-First order for implementation is preserved from orchestrator; do not reorder.
  • No code snippets; keep to approach, APIs, and pseudocode only.
  • Documentation updates must be included in Affected Components/Docs sections.
  • Language preservation: keep Story language (EN/RU) in generated tasks.
DRY Warning Examples:
markdown
Example 1: Email validation (HIGH similarity - 90%)
> [!WARNING]
> **DRY Check:** Similar functionality detected
> - Existing: src/utils/validators/email.ts:validateEmail()
> - Similarity: 90% (exact function name + domain match)
> - **Recommendation:** REUSE existing function (Option 1)

Example 2: User authentication (MEDIUM similarity - 75%)
> [!WARNING]
> **DRY Check:** Partial functionality exists
> - Existing: src/services/auth/login.ts:authenticateUser()
> - Similarity: 75% (domain match, different scope)
> - **Recommendation:** Review existing code, consider EXTEND (Option 2) or JUSTIFY new implementation (Option 3)

Example 3: No duplication (skip warning)
- No similar code found → Proceed without DRY warning
  • 强制要求: 调用create_issue时必须传递
    state: "Backlog"
    。若未指定,Linear会默认使用团队的默认状态(通常为「推迟」)。
  • DRY检查: 在生成任务前,为每个任务扫描代码库。若发现相似代码(关键词匹配度≥70%)→ 添加带有3种选项(复用/扩展/说明理由)的
    ⚠️ DRY警告
    章节。测试任务无需扫描(无实现代码)。
  • 实现任务的「基础优先」顺序需与编排器提供的一致;不得重新排序。
  • 不得包含代码片段;仅保留实现方案、API及伪代码。
  • 文档更新必须包含在「涉及组件/文档」章节中。
  • 语言保留:生成的任务需与原需求使用相同语言(英文/俄文)。
DRY警告示例:
markdown
示例1:邮箱验证(高匹配度 - 90%)
> [!WARNING]
> **DRY检查:** 检测到相似功能
> - 现有代码:src/utils/validators/email.ts:validateEmail()
> - 匹配度:90%(完全匹配函数名称+领域)
> - **建议:** 复用现有函数(选项1)

示例2:用户认证(中匹配度 - 75%)
> [!WARNING]
> **DRY检查:** 存在部分相似功能
> - 现有代码:src/services/auth/login.ts:authenticateUser()
> - 匹配度:75%(领域匹配,范围不同)
> - **建议:** 参考现有代码,考虑扩展(选项2)或说明重新实现的理由(选项3)

示例3:无重复代码(跳过警告)
- 未发现相似代码 → 无需添加DRY警告

Definition of Done

完成标准

  • DRY Check complete: Codebase scanned for EACH Task; similar code detected (Grep); DRY warnings added to Task descriptions if ≥70% similarity found.
  • Context check complete (existing components/schema/deps/docs reviewed; conflicts flagged).
  • Documents generated with correct template, full sections, and DRY warnings (if applicable).
  • Type validation passed (no test creation for impl; regression strategy for refactor; risk matrix/limits for test).
  • Preview shown with DRY warnings count and user confirmed.
  • Linear issues created with parentId and URLs captured; state=Backlog.
  • kanban_board.md updated under correct Epic/Story with indentation.
  • Summary returned with URLs, totals, DRY warnings count, and next steps.
  • DRY检查完成: 为每个任务扫描代码库;通过Grep检测相似代码;若匹配度≥70%,则在任务描述中添加DRY警告。
  • 上下文检查完成(已检查现有组件/架构/依赖/文档;标记冲突)。
  • 使用正确模板生成文档,包含完整章节及DRY警告(若适用)。
  • 类型验证通过(实现任务未创建新测试;重构任务包含回归策略;测试任务包含风险矩阵/限制)。
  • 展示预览内容及DRY警告数量,并获得用户确认。
  • 创建带有parentId的Linear议题,记录链接;状态设置为Backlog。
  • 更新kanban_board.md,在对应Epic/需求下添加任务并设置正确缩进。
  • 返回汇总信息,包含议题链接、汇总数据、DRY警告数量及后续步骤。

Template Loading

模板加载

MANDATORY READ: Load
shared/references/template_loading_pattern.md
for template copy workflow.
Template Selection by taskType:
  • implementation
    task_template_implementation.md
  • refactoring
    refactoring_task_template.md
  • test
    test_task_template.md
Local copies:
docs/templates/*.md
(in target project)
必读: 加载
shared/references/template_loading_pattern.md
以了解模板复制流程。
按任务类型选择模板:
  • implementation
    task_template_implementation.md
  • refactoring
    refactoring_task_template.md
  • test
    test_task_template.md
本地副本:
docs/templates/*.md
(目标项目中)

Reference Files

参考文件

  • Kanban update algorithm:
    shared/references/kanban_update_algorithm.md
  • Template loading:
    shared/references/template_loading_pattern.md
  • Linear creation workflow:
    shared/references/linear_creation_workflow.md
  • Storage mode detection:
    shared/references/storage_mode_detection.md
  • Templates (centralized):
    shared/templates/task_template_implementation.md
    ,
    shared/templates/refactoring_task_template.md
    ,
    shared/templates/test_task_template.md
  • Local copies:
    docs/templates/*.md
    (in target project)
  • Kanban format:
    docs/tasks/kanban_board.md

Version: 3.0.0 Last Updated: 2025-12-23
  • 看板更新算法:
    shared/references/kanban_update_algorithm.md
  • 模板加载:
    shared/references/template_loading_pattern.md
  • Linear创建流程:
    shared/references/linear_creation_workflow.md
  • 存储模式检测:
    shared/references/storage_mode_detection.md
  • 集中式模板:
    shared/templates/task_template_implementation.md
    ,
    shared/templates/refactoring_task_template.md
    ,
    shared/templates/test_task_template.md
  • 本地副本:
    docs/templates/*.md
    (目标项目中)
  • 看板格式:
    docs/tasks/kanban_board.md

版本: 3.0.0 最后更新: 2025-12-23 ",