triage

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
  • First set the /model to Haiku
  • Then read all pending todos in the todos/ directory
Present all findings, decisions, or issues here one by one for triage. The goal is to go through each item and decide whether to add it to the CLI todo system.
IMPORTANT: DO NOT CODE ANYTHING DURING TRIAGE!
This command is for:
  • Triaging code review findings
  • Processing security audit results
  • Reviewing performance analysis
  • Handling any other categorized findings that need tracking
  • 首先将/model设置为Haiku
  • 然后读取todos/目录下所有待处理的待办事项
在此逐一展示所有检查结果、决策或问题以进行处理。目标是逐个处理每个条目,决定是否将其添加到CLI待办事项系统中。
重要提示:处理期间请勿编写任何代码!
此命令用于:
  • 分类代码审查结果
  • 处理安全审计结果
  • 审查性能分析报告
  • 处理任何其他需要追踪的分类检查结果

Workflow

工作流程

Step 1: Present Each Finding

步骤1:展示每个检查结果

For each finding, present in this format:
---
Issue #X: [Brief Title]

Severity: 🔴 P1 (CRITICAL) / 🟡 P2 (IMPORTANT) / 🔵 P3 (NICE-TO-HAVE)

Category: [Security/Performance/Architecture/Bug/Feature/etc.]

Description:
[Detailed explanation of the issue or improvement]

Location: [file_path:line_number]

Problem Scenario:
[Step by step what's wrong or could happen]

Proposed Solution:
[How to fix it]

Estimated Effort: [Small (< 2 hours) / Medium (2-8 hours) / Large (> 8 hours)]

---
Do you want to add this to the todo list?
1. yes - create todo file
2. next - skip this item
3. custom - modify before creating
对于每个检查结果,按以下格式展示:
---
Issue #X: [简短标题]

Severity: 🔴 P1(严重)/ 🟡 P2(重要)/ 🔵 P3(锦上添花)

Category: [安全/性能/架构/漏洞/功能等]

Description:
[问题或改进的详细说明]

Location: [文件路径:行号]

Problem Scenario:
[逐步说明问题所在或可能发生的情况]

Proposed Solution:
[修复方案]

Estimated Effort: [小(<2小时)/ 中(2-8小时)/ 大(>8小时)]

---
是否要将此添加到待办事项列表?
1. yes - 创建待办文件
2. next - 跳过此条目
3. custom - 创建前修改内容

Step 2: Handle User Decision

步骤2:处理用户决策

When user says "yes":
  1. Update existing todo file (if it exists) or Create new filename:
    If todo already exists (from code review):
    • Rename file from
      {id}-pending-{priority}-{desc}.md
      {id}-ready-{priority}-{desc}.md
    • Update YAML frontmatter:
      status: pending
      status: ready
    • Keep issue_id, priority, and description unchanged
    If creating new todo:
    {next_id}-ready-{priority}-{brief-description}.md
    Priority mapping:
    • 🔴 P1 (CRITICAL) →
      p1
    • 🟡 P2 (IMPORTANT) →
      p2
    • 🔵 P3 (NICE-TO-HAVE) →
      p3
    Example:
    042-ready-p1-transaction-boundaries.md
  2. Update YAML frontmatter:
    yaml
    ---
    status: ready # IMPORTANT: Change from "pending" to "ready"
    priority: p1 # or p2, p3 based on severity
    issue_id: "042"
    tags: [category, relevant-tags]
    dependencies: []
    ---
  3. Populate or update the file:
    yaml
    # [Issue Title]
    
    ## Problem Statement
    [Description from finding]
    
    ## Findings
    - [Key discoveries]
    - Location: [file_path:line_number]
    - [Scenario details]
    
    ## Proposed Solutions
    
    ### Option 1: [Primary solution]
    - **Pros**: [Benefits]
    - **Cons**: [Drawbacks if any]
    - **Effort**: [Small/Medium/Large]
    - **Risk**: [Low/Medium/High]
    
    ## Recommended Action
    [Filled during triage - specific action plan]
    
    ## Technical Details
    - **Affected Files**: [List files]
    - **Related Components**: [Components affected]
    - **Database Changes**: [Yes/No - describe if yes]
    
    ## Resources
    - Original finding: [Source of this issue]
    - Related issues: [If any]
    
    ## Acceptance Criteria
    - [ ] [Specific success criteria]
    - [ ] Tests pass
    - [ ] Code reviewed
    
    ## Work Log
    
    ### {date} - Approved for Work
    **By:** Claude Triage System
    **Actions:**
    - Issue approved during triage session
    - Status changed from pending → ready
    - Ready to be picked up and worked on
    
    **Learnings:**
    - [Context and insights]
    
    ## Notes
    Source: Triage session on {date}
  4. Confirm approval: "✅ Approved:
    {new_filename}
    (Issue #{issue_id}) - Status: ready → Ready to work on"
When user says "next":
  • Delete the todo file - Remove it from todos/ directory since it's not relevant
  • Skip to the next item
  • Track skipped items for summary
When user says "custom":
  • Ask what to modify (priority, description, details)
  • Update the information
  • Present revised version
  • Ask again: yes/next/custom
当用户说“yes”时:
  1. 更新现有待办文件(如果存在)或创建新文件:
    如果待办事项已存在(来自代码审查):
    • 将文件从
      {id}-pending-{priority}-{desc}.md
      重命名为
      {id}-ready-{priority}-{desc}.md
    • 更新YAML前置元数据:
      status: pending
      status: ready
    • 保持issue_id、优先级和描述不变
    如果创建新待办事项:
    {next_id}-ready-{priority}-{brief-description}.md
    优先级映射:
    • 🔴 P1(严重)→
      p1
    • 🟡 P2(重要)→
      p2
    • 🔵 P3(锦上添花)→
      p3
    示例:
    042-ready-p1-transaction-boundaries.md
  2. 更新YAML前置元数据:
    yaml
    ---
    status: ready # IMPORTANT: Change from "pending" to "ready"
    priority: p1 # or p2, p3 based on severity
    issue_id: "042"
    tags: [category, relevant-tags]
    dependencies: []
    ---
  3. 填充或更新文件内容:
    yaml
    # [Issue Title]
    
    ## 问题说明
    [Description from finding]
    
    ## 检查结果
    - [Key discoveries]
    - Location: [file_path:line_number]
    - [Scenario details]
    
    ## 建议解决方案
    
    ### Option 1: [Primary solution]
    - **Pros**: [Benefits]
    - **Cons**: [Drawbacks if any]
    - **工作量**: [Small/Medium/Large]
    - **风险**: [Low/Medium/High]
    
    ## 推荐行动
    [处理期间填写 - 具体行动计划]
    
    ## 技术细节
    - **受影响文件**: [文件列表]
    - **相关组件**: [受影响组件]
    - **数据库变更**: [Yes/No - 若是请说明]
    
    ## 参考资源
    - Original finding: [此问题的来源]
    - Related issues: [如有相关问题]
    
    ## 验收标准
    - [ ] [具体成功标准]
    - [ ] 测试通过
    - [ ] 代码已审查
    
    ## 工作日志
    
    ### {date} - 批准开展工作
    **By:** Claude Triage System
    **Actions:**
    - 处理会话期间批准此问题
    - 状态从pending → ready变更
    - 可开始处理
    
    **Learnings:**
    - [背景信息与见解]
    
    ## 备注
    Source: Triage session on {date}
  4. 确认批准: "✅ 已批准:
    {new_filename}
    (Issue #{issue_id}) - 状态: ready → 可开始处理"
当用户说“next”时:
  • 删除待办文件 - 从todos/目录中移除,因为该条目无关
  • 跳转到下一个条目
  • 记录已跳过的条目用于总结
当用户说“custom”时:
  • 询问需要修改的内容(优先级、描述、细节)
  • 更新信息
  • 展示修订后的版本
  • 再次询问:yes/next/custom

Step 3: Continue Until All Processed

步骤3:持续处理直至完成所有条目

  • Process all items one by one
  • Track using TodoWrite for visibility
  • Don't wait for approval between items - keep moving
  • 逐个处理所有条目
  • 使用TodoWrite追踪进度以确保可见性
  • 无需在条目之间等待批准 - 持续推进

Step 4: Final Summary

步骤4:最终总结

After all items processed:
markdown
undefined
处理完所有条目后:
markdown
undefined

Triage Complete

处理完成

Total Items: [X] Todos Approved (ready): [Y] Skipped: [Z]
总条目数: [X] 已批准待办事项(就绪): [Y] 已跳过: [Z]

Approved Todos (Ready for Work):

已批准待办事项(可开始处理):

  • 042-ready-p1-transaction-boundaries.md
    - Transaction boundary issue
  • 043-ready-p2-cache-optimization.md
    - Cache performance improvement ...
  • 042-ready-p1-transaction-boundaries.md
    - 事务边界问题
  • 043-ready-p2-cache-optimization.md
    - 缓存性能优化...

Skipped Items (Deleted):

已跳过条目(已删除):

  • Item #5: [reason] - Removed from todos/
  • Item #12: [reason] - Removed from todos/
  • Item #5: [原因] - 已从todos/移除
  • Item #12: [原因] - 已从todos/移除

Summary of Changes Made:

变更总结:

During triage, the following status updates occurred:
  • Pending → Ready: Filenames and frontmatter updated to reflect approved status
  • Deleted: Todo files for skipped findings removed from todos/ directory
  • Each approved file now has
    status: ready
    in YAML frontmatter
处理期间,发生了以下状态更新:
  • Pending → Ready: 文件名和前置元数据已更新以反映批准状态
  • 已删除: 已跳过检查结果的待办文件已从todos/目录移除
  • 每个已批准文件的YAML前置元数据中现在包含
    status: ready

Next Steps:

后续步骤:

  1. View approved todos ready for work:
    bash
    ls todos/*-ready-*.md

2. Start work on approved items:

   ```bash
   /resolve_todo_parallel  # Work on multiple approved items efficiently
   ```

3. Or pick individual items to work on

4. As you work, update todo status:
   - Ready → In Progress (in your local context as you work)
   - In Progress → Complete (rename file: ready → complete, update frontmatter)

```
  1. 查看已批准的待办事项:
    bash
    ls todos/*-ready-*.md

2. 开始处理已批准的条目:

   ```bash
   /resolve_todo_parallel  # 高效处理多个已批准条目
   ```

3. 或选择单个条目处理

4. 处理过程中更新待办事项状态:
   - Ready → In Progress(处理时在本地更新上下文)
   - In Progress → Complete(重命名文件: ready → complete,更新前置元数据)

```

Example Response Format

示例响应格式


---

Issue #5: Missing Transaction Boundaries for Multi-Step Operations

Severity: 🔴 P1 (CRITICAL)

Category: Data Integrity / Security

Description: The google_oauth2_connected callback in GoogleOauthCallbacks concern performs multiple database operations without transaction protection. If any step fails midway, the database is left in an inconsistent state.

Location: app/controllers/concerns/google_oauth_callbacks.rb:13-50

Problem Scenario:

1. User.update succeeds (email changed)
2. Account.save! fails (validation error)
3. Result: User has changed email but no associated Account
4. Next login attempt fails completely

Operations Without Transaction:

- User confirmation (line 13)
- Waitlist removal (line 14)
- User profile update (line 21-23)
- Account creation (line 28-37)
- Avatar attachment (line 39-45)
- Journey creation (line 47)

Proposed Solution: Wrap all operations in ApplicationRecord.transaction do ... end block

Estimated Effort: Small (30 minutes)

---

Do you want to add this to the todo list?

1. yes - create todo file
2. next - skip this item
3. custom - modify before creating

---

Issue #5: 多步骤操作缺少事务边界

Severity: 🔴 P1(严重)

Category: 数据完整性 / 安全

Description: GoogleOauthCallbacks concern中的google_oauth2_connected回调执行多个数据库操作但未受事务保护。如果任何步骤中途失败,数据库将处于不一致状态。

Location: app/controllers/concerns/google_oauth_callbacks.rb:13-50

Problem Scenario:

1. User.update成功(邮箱已更改)
2. Account.save!失败(验证错误)
3. 结果: 用户邮箱已更改但无关联的Account
4. 后续登录尝试完全失败

Operations Without Transaction:

- 用户确认(第13行)
- 移除等待列表(第14行)
- 用户资料更新(第21-23行)
- 账户创建(第28-37行)
- 头像附件(第39-45行)
- Journey创建(第47行)

Proposed Solution: 将所有操作包裹在ApplicationRecord.transaction do ... end块中

Estimated Effort: Small(30分钟)

---

是否要将此添加到待办事项列表?

1. yes - 创建待办文件
2. next - 跳过此条目
3. custom - 创建前修改内容

Important Implementation Details

重要实现细节

Status Transitions During Triage

处理期间的状态转换

When "yes" is selected:
  1. Rename file:
    {id}-pending-{priority}-{desc}.md
    {id}-ready-{priority}-{desc}.md
  2. Update YAML frontmatter:
    status: pending
    status: ready
  3. Update Work Log with triage approval entry
  4. Confirm: "✅ Approved:
    {filename}
    (Issue #{issue_id}) - Status: ready"
When "next" is selected:
  1. Delete the todo file from todos/ directory
  2. Skip to next item
  3. No file remains in the system
选择“yes”时:
  1. 重命名文件:
    {id}-pending-{priority}-{desc}.md
    {id}-ready-{priority}-{desc}.md
  2. 更新YAML前置元数据:
    status: pending
    status: ready
  3. 在工作日志中添加处理批准记录
  4. 确认: "✅ 已批准:
    {filename}
    (Issue #{issue_id}) - 状态: ready"
选择“next”时:
  1. 从todos/目录中删除待办文件
  2. 跳转到下一个条目
  3. 系统中不再保留该文件

Progress Tracking

进度追踪

Every time you present a todo as a header, include:
  • Progress: X/Y completed (e.g., "3/10 completed")
  • Estimated time remaining: Based on how quickly you're progressing
  • Pacing: Monitor time per finding and adjust estimate accordingly
Example:

Progress: 3/10 completed | Estimated time: ~2 minutes remaining
每次将待办事项作为标题展示时,需包含:
  • 进度: X/Y已完成(例如:"3/10已完成")
  • 预计剩余时间: 根据当前进度估算
  • 节奏: 监控每个检查结果的处理时间并相应调整估算
示例:

Progress: 3/10 completed | Estimated time: ~2 minutes remaining

Do Not Code During Triage

处理期间请勿编写代码

  • ✅ Present findings
  • ✅ Make yes/next/custom decisions
  • ✅ Update todo files (rename, frontmatter, work log)
  • ❌ Do NOT implement fixes or write code
  • ❌ Do NOT add detailed implementation details
  • ❌ That's for /resolve_todo_parallel phase

When done give these options

```markdown
What would you like to do next?

1. run /resolve_todo_parallel to resolve the todos
2. commit the todos
3. nothing, go chill
  • ✅ 展示检查结果
  • ✅ 做出yes/next/custom决策
  • ✅ 更新待办文件(重命名、前置元数据、工作日志)
  • ❌ 请勿实施修复或编写代码
  • ❌ 请勿添加详细实现细节
  • ❌ 这些属于/resolve_todo_parallel阶段

完成后提供以下选项

```markdown
接下来您想执行什么操作?

1. 运行/resolve_todo_parallel以处理待办事项
2. 提交待办事项
3. 什么都不做,休息一下