ln-301-task-creator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUniversal 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 for Linear vs File mode operations.
shared/references/storage_mode_detection.md必读: 加载 以了解Linear与文件模式的操作方式。
shared/references/storage_mode_detection.mdInvocation (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: , teamId, Story data (id/title/description with AC, Technical Notes, Context).
taskType - 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.
- 通用参数:、teamId、需求(Story)数据(ID/标题/包含验收标准的描述、技术说明、上下文)。
taskType - 实现任务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)
工作流程(精简版)
- DRY Check (Codebase Scan): For EACH Task in plan:
- Extract keywords: function type, component name, domain from Task description
- Scan codebase: for similar functionality
Grep(pattern="[keyword]", path="src/", output_mode="files_with_matches") - IF similar code found (≥70% keyword match):
- Add section to Task description BEFORE Implementation Plan:
⚠️ DRY Warningmarkdown> [!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)
- Add
- IF no duplication → Proceed without warning
- Rationale: Prevents code duplication BEFORE implementation starts
- Template select: Load template based on taskType (see "Template Loading" section).
- Generate docs: Fill sections for each task in plan/request using provided data, guide links, and DRY warnings.
- Validate type rules: Stop with error if violation (see table below).
- Preview: Show titles/goals/estimates/AC/components, DRY warnings count, and totals.
- Confirmation required: Proceed only after explicit confirm.
- Create issues: Call Linear create_issue with parentId=Story, state=Backlog; capture URLs.
- Update kanban: Add under Story in Backlog with correct Epic/indent.
- Return summary: URLs, counts, hours, guide link count, DRY warnings count; next steps (validator/executor).
- 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:说明为何需要重新实现(记录在技术方案中)
- 在任务描述的「实现计划」前添加
- 若未发现重复代码 → 直接继续
- 设计目的:在实现开始前避免代码重复
- 选择模板: 根据taskType加载对应模板(见「模板加载」章节)。
- 生成文档: 使用提供的数据、指南链接及DRY警告,填充计划/请求中每个任务的对应章节。
- 验证类型规则: 若违反规则则终止操作并返回错误(见下方表格)。
- 预览: 展示任务标题/目标/预估工时/验收标准/涉及组件、DRY警告数量及汇总信息。
- 需确认: 仅在用户明确确认后继续执行。
- 创建议题: 调用Linear的create_issue接口,设置parentId=需求ID,state=Backlog;记录议题链接。
- 更新看板: 在Backlog中对应需求下添加任务,并关联正确的Epic/设置缩进。
- 返回汇总: 包含议题链接、任务数量、总工时、指南链接数量、DRY警告数量;以及后续步骤(验证/执行)。
Type Rules (must pass)
类型规则(必须满足)
| taskType | Hard rule | What to verify |
|---|---|---|
| implementation | No new test creation | Scan text for "write/create/add tests" etc.; allow only updating existing tests |
| refactoring | Regression strategy required | Issues listed with severity; plan in 3 phases; regression strategy (Baseline/Verify/Failure); preserve functionality |
| test | Risk-based plan required | Priority ≤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 when calling create_issue. Linear defaults to team's default status (often "Postponed") if not specified.
state: "Backlog" - DRY Check: Scan codebase for EACH Task before generation. If similar code found (≥70% keyword match) → add section with 3 options (reuse/extend/justify). Skip scan for test tasks (no implementation code).
⚠️ DRY Warning - 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时必须传递 。若未指定,Linear会默认使用团队的默认状态(通常为「推迟」)。
state: "Backlog" - 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 for template copy workflow.
shared/references/template_loading_pattern.mdTemplate Selection by taskType:
- →
implementationtask_template_implementation.md - →
refactoringrefactoring_task_template.md - →
testtest_task_template.md
Local copies: (in target project)
docs/templates/*.md必读: 加载 以了解模板复制流程。
shared/references/template_loading_pattern.md按任务类型选择模板:
- →
implementationtask_template_implementation.md - →
refactoringrefactoring_task_template.md - →
testtest_task_template.md
本地副本: (目标项目中)
docs/templates/*.mdReference 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.mdshared/templates/test_task_template.md - Local copies: (in target project)
docs/templates/*.md - 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.mdshared/templates/test_task_template.md - 本地副本:(目标项目中)
docs/templates/*.md - 看板格式:
docs/tasks/kanban_board.md
版本: 3.0.0
最后更新: 2025-12-23
",