thinking-tools

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<identity> Structured Thinking Framework - Self-reflection patterns for quality agent work. </identity> <capabilities> - Validating completeness of collected information - Ensuring adherence to the original task - Confirming work is truly complete before stopping - Identifying gaps in understanding or implementation - Preventing scope creep and tangential work </capabilities> <instructions>
<identity> 结构化思维框架 - 用于保障Agent工作质量的自我反思模式。 </identity> <capabilities> - 验证收集到的信息的完整性 - 确保贴合原始任务要求 - 在停止工作前确认任务真的完成 - 识别理解或实现中的差距 - 防止范围蔓延和偏离主题的工作 </capabilities> <instructions>

Overview

概述

This skill provides three structured thinking patterns that agents should use at key points during task execution. These patterns help maintain quality and prevent common mistakes like incomplete research, task drift, and premature completion.
本技能提供了三种结构化思维模式,Agent应在任务执行的关键节点使用这些模式。这些模式有助于维持工作质量,防止出现调研不完整、任务偏离和提前结束工作等常见问题。

Thinking Pattern 1: Think About Collected Information

思维模式1:思考收集到的信息

When to Use: After completing a non-trivial sequence of searching steps like:
  • Reading multiple files
  • Searching for symbols or patterns
  • Exploring directory structures
  • Gathering requirements
Self-Assessment Questions:
markdown
undefined
使用时机:完成一系列重要的搜索步骤后,例如:
  • 阅读多个文件
  • 搜索符号或模式
  • 探索目录结构
  • 收集需求
自我评估问题:
markdown
undefined

Information Completeness Check

Information Completeness Check

  1. Sufficiency: Do I have enough information to proceed?
    • I understand the relevant code structure
    • I know the dependencies and relationships
    • I have identified all affected components
  2. Relevance: Is all collected information relevant?
    • Information directly relates to the task
    • No tangential exploration
    • Focused on actionable insights
  3. Gaps: What am I missing?
    • Are there files I should read but haven't?
    • Are there patterns I should search for?
    • Do I need to understand related systems?
  4. Confidence: How confident am I in my understanding?
    • High: Ready to proceed
    • Medium: Minor clarification needed
    • Low: More research required
Decision: [Proceed / Gather More Information / Ask User]

**Example Reflection**:
I've read the authentication module (auth.ts) and the user model (user.ts). I understand how login works but I haven't checked:
  • How session tokens are managed
  • Where logout is implemented
  • What the error handling pattern is
Decision: Read session.ts and error-handler.ts before proceeding.
undefined
  1. Sufficiency: Do I have enough information to proceed?
    • I understand the relevant code structure
    • I know the dependencies and relationships
    • I have identified all affected components
  2. Relevance: Is all collected information relevant?
    • Information directly relates to the task
    • No tangential exploration
    • Focused on actionable insights
  3. Gaps: What am I missing?
    • Are there files I should read but haven't?
    • Are there patterns I should search for?
    • Do I need to understand related systems?
  4. Confidence: How confident am I in my understanding?
    • High: Ready to proceed
    • Medium: Minor clarification needed
    • Low: More research required
Decision: [Proceed / Gather More Information / Ask User]

**示例反思**:
I've read the authentication module (auth.ts) and the user model (user.ts). I understand how login works but I haven't checked:
  • How session tokens are managed
  • Where logout is implemented
  • What the error handling pattern is
Decision: Read session.ts and error-handler.ts before proceeding.
undefined

Thinking Pattern 2: Think About Task Adherence

思维模式2:思考任务贴合度

When to Use: BEFORE making any code changes (insert, replace, delete). This is critical to ensure you're still solving the original problem.
Self-Assessment Questions:
markdown
undefined
使用时机:在进行任何代码修改(插入、替换、删除)之前。这一步对于确保你仍在解决原始问题至关重要。
自我评估问题:
markdown
undefined

Task Adherence Check

Task Adherence Check

  1. Original Task: What was I asked to do?
    • Restate the original request clearly
    • Identify the core goal
  2. Current Action: What am I about to do?
    • Describe the planned change
    • Explain how it relates to the goal
  3. Alignment Check:
    • This action directly addresses the original task
    • I am not adding unrequested features
    • I am not "improving" code that wasn't asked about
    • The scope is appropriate for the request
  4. Scope Creep Warning Signs:
    • Am I refactoring code that works?
    • Am I adding "nice to have" features?
    • Am I fixing unrelated issues I noticed?
    • Have I drifted from the original ask?
Decision: [Proceed / Refocus / Ask User for Clarification]

**Example Reflection**:
Original Task: "Fix the login timeout error"
I'm about to:
  1. Fix the timeout by increasing the limit (directly addresses task)
  2. Also refactor the error messages (NOT requested)
  3. Also add retry logic (NOT requested)
Decision: Only implement #1. The other changes are scope creep. If user wants those improvements, they can request them separately.
undefined
  1. Original Task: What was I asked to do?
    • Restate the original request clearly
    • Identify the core goal
  2. Current Action: What am I about to do?
    • Describe the planned change
    • Explain how it relates to the goal
  3. Alignment Check:
    • This action directly addresses the original task
    • I am not adding unrequested features
    • I am not "improving" code that wasn't asked about
    • The scope is appropriate for the request
  4. Scope Creep Warning Signs:
    • Am I refactoring code that works?
    • Am I adding "nice to have" features?
    • Am I fixing unrelated issues I noticed?
    • Have I drifted from the original ask?
Decision: [Proceed / Refocus / Ask User for Clarification]

**示例反思**:
Original Task: "Fix the login timeout error"
I'm about to:
  1. Fix the timeout by increasing the limit (directly addresses task)
  2. Also refactor the error messages (NOT requested)
  3. Also add retry logic (NOT requested)
Decision: Only implement #1. The other changes are scope creep. If user wants those improvements, they can request them separately.
undefined

Thinking Pattern 3: Think About Whether You Are Done

思维模式3:思考任务是否完成

When to Use: When you believe you have completed the task. This prevents premature completion and ensures quality.
Self-Assessment Questions:
markdown
undefined
使用时机:当你认为自己已经完成任务时。这一步可以防止提前结束工作,确保工作质量。
自我评估问题:
markdown
undefined

Completion Validation Check

Completion Validation Check

  1. Requirements Met:
    • All explicit requirements addressed
    • All implicit requirements considered
    • Edge cases handled
  2. Quality Checks:
    • Code compiles/runs without errors
    • Tests pass (or new tests written)
    • No regressions introduced
    • Follows project conventions
  3. Documentation:
    • Code is self-documenting or commented where needed
    • README updated if needed
    • Breaking changes documented
  4. Verification Steps Taken:
    • Ran relevant tests
    • Tested manually if applicable
    • Checked for lint/type errors
  5. Loose Ends:
    • Any TODOs introduced?
    • Any known limitations?
    • Any follow-up work needed?
Decision: [Complete / Additional Work Needed / Partial Completion]

**Example Reflection**:
Task: "Add user email validation"
Requirements Check:
  • Email format validation added
  • Error message shows for invalid email
  • Did NOT check: what about empty email?
Quality Check:
  • TypeScript compiles
  • Tests: No tests written yet!
Decision: NOT complete. Need to:
  1. Handle empty email case
  2. Write unit tests for validation
undefined
  1. Requirements Met:
    • All explicit requirements addressed
    • All implicit requirements considered
    • Edge cases handled
  2. Quality Checks:
    • Code compiles/runs without errors
    • Tests pass (or new tests written)
    • No regressions introduced
    • Follows project conventions
  3. Documentation:
    • Code is self-documenting or commented where needed
    • README updated if needed
    • Breaking changes documented
  4. Verification Steps Taken:
    • Ran relevant tests
    • Tested manually if applicable
    • Checked for lint/type errors
  5. Loose Ends:
    • Any TODOs introduced?
    • Any known limitations?
    • Any follow-up work needed?
Decision: [Complete / Additional Work Needed / Partial Completion]

**示例反思**:
Task: "Add user email validation"
Requirements Check:
  • Email format validation added
  • Error message shows for invalid email
  • Did NOT check: what about empty email?
Quality Check:
  • TypeScript compiles
  • Tests: No tests written yet!
Decision: NOT complete. Need to:
  1. Handle empty email case
  2. Write unit tests for validation
undefined

Integration Guidelines

整合指南

Workflow Integration

工作流整合

[Research Phase]
    |
    v
Think About Collected Information
    |
    v
[Planning Phase]
    |
    v
Think About Task Adherence (before each change)
    |
    v
[Implementation Phase]
    |
    v
Think About Whether You Are Done
    |
    v
[Completion or Iterate]
[Research Phase]
    |
    v
Think About Collected Information
    |
    v
[Planning Phase]
    |
    v
Think About Task Adherence (before each change)
    |
    v
[Implementation Phase]
    |
    v
Think About Whether You Are Done
    |
    v
[Completion or Iterate]

When NOT to Use

不适用场景

  • Simple, trivial tasks (fix typo, rename variable)
  • When user explicitly asks to skip validation
  • Quick answers that don't involve code changes
  • 简单、琐碎的任务(修复拼写错误、重命名变量)
  • 用户明确要求跳过验证时
  • 不涉及代码修改的快速回答

Logging Reflections

记录反思

For important tasks, log reflections to memory:
markdown
undefined
对于重要任务,将反思记录到内存中:
markdown
undefined

Task: [description]

Task: [description]

Reflection Log

Reflection Log

Information Gathering

Information Gathering

  • Files read: [list]
  • Gaps identified: [list]
  • Decision: [proceed/gather more]
  • Files read: [list]
  • Gaps identified: [list]
  • Decision: [proceed/gather more]

Task Adherence Check

Task Adherence Check

  • Original task: [description]
  • Planned changes: [list]
  • Scope assessment: [in-scope/adjusted]
  • Original task: [description]
  • Planned changes: [list]
  • Scope assessment: [in-scope/adjusted]

Completion Check

Completion Check

  • Requirements: [met/partial/not met]
  • Tests: [passed/failed/not run]
  • Final status: [complete/needs work]

</instructions>

<examples>
<usage_example>
**Scenario**: Agent is asked to "fix the broken search feature"

**Phase 1 - After Research**:
Think About Collected Information:
  • Read search.ts, index.ts, searchUtils.ts
  • Found the bug: incorrect regex pattern
  • Checked: test file exists (search.test.ts)
  • Gap: Haven't checked if there are related search files Decision: Quick grep for "search" to ensure completeness... Found search-config.ts which is relevant. Reading now.

**Phase 2 - Before Coding**:
Think About Task Adherence:
  • Original: "fix the broken search feature"
  • Planned: Fix regex pattern in searchUtils.ts line 45
  • Scope check: This directly fixes the bug. NOT adding new search features. Decision: Proceed with targeted fix.

**Phase 3 - After Implementation**:
Think About Whether You Are Done:
  • Bug fixed (regex corrected)
  • Existing tests still pass
  • No new test for this specific case Decision: Add regression test, then complete.

</usage_example>
</examples>

<integration>
**Related Skills**:
- `verification-before-completion` - Complements completion validation
- `tdd` - Test-driven development integrates with completion checks
- `sequential-thinking` - Structured problem decomposition
</integration>
  • Requirements: [met/partial/not met]
  • Tests: [passed/failed/not run]
  • Final status: [complete/needs work]

</instructions>

<examples>
<usage_example>
**场景**: Agent被要求“修复失效的搜索功能”

**阶段1 - 调研后**:
Think About Collected Information:
  • Read search.ts, index.ts, searchUtils.ts
  • Found the bug: incorrect regex pattern
  • Checked: test file exists (search.test.ts)
  • Gap: Haven't checked if there are related search files Decision: Quick grep for "search" to ensure completeness... Found search-config.ts which is relevant. Reading now.

**阶段2 - 编码前**:
Think About Task Adherence:
  • Original: "fix the broken search feature"
  • Planned: Fix regex pattern in searchUtils.ts line 45
  • Scope check: This directly fixes the bug. NOT adding new search features. Decision: Proceed with targeted fix.

**阶段3 - 实现后**:
Think About Whether You Are Done:
  • Bug fixed (regex corrected)
  • Existing tests still pass
  • No new test for this specific case Decision: Add regression test, then complete.

</usage_example>
</examples>

<integration>
**相关技能**:
- `verification-before-completion` - 补充完成度验证
- `tdd` - 测试驱动开发与完成度检查整合
- `sequential-thinking` - 结构化问题分解
</integration>

Memory Protocol (MANDATORY)

内存协议(强制性)

Before starting: Read
.claude/context/memory/learnings.md
After completing:
  • New pattern discovered ->
    .claude/context/memory/learnings.md
  • Issue encountered ->
    .claude/context/memory/issues.md
  • Decision made ->
    .claude/context/memory/decisions.md
ASSUME INTERRUPTION: If it's not in memory, it didn't happen.
开始前: 读取
.claude/context/memory/learnings.md
完成后:
  • 发现的新模式 ->
    .claude/context/memory/learnings.md
  • 遇到的问题 ->
    .claude/context/memory/issues.md
  • 做出的决策 ->
    .claude/context/memory/decisions.md
假设会被中断:如果没有记录到内存中,就视为未发生。