reasoning

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Reasoning Patterns

推理模式

Systematic thinking for accurate problem solving.
用于精准解决问题的系统性思维方式。

Instructions

操作指南

1. Chain-of-Thought (CoT)

1. 思维链(Chain-of-Thought, CoT)

Break complex problems into explicit reasoning steps:
PROBLEM → ANALYZE → DECOMPOSE → SOLVE STEPS → VERIFY → SYNTHESIZE
markdown
undefined
将复杂问题拆解为明确的推理步骤:
PROBLEM → ANALYZE → DECOMPOSE → SOLVE STEPS → VERIFY → SYNTHESIZE
markdown
undefined

Thinking Process

思考流程

  1. Understand: What is being asked?
  2. Identify: What information do I have?
  3. Plan: What steps will solve this?
  4. Execute: Work through each step
  5. Verify: Is the solution correct?
undefined
  1. 理解:问题的核心需求是什么?
  2. 识别:我掌握了哪些信息?
  3. 规划:通过哪些步骤可以解决问题?
  4. 执行:逐步完成每个步骤
  5. 验证:解决方案是否正确?
undefined

2. Self-Reflection Protocol

2. 自我反思协议

Before finalizing any output:
markdown
undefined
在最终确定输出内容前:
markdown
undefined

Reflection Checklist

反思检查清单

  • Does this answer the actual question?
  • Are there any logical errors?
  • Did I miss edge cases?
  • Is this the simplest solution?
  • Would a senior developer approve this?
undefined
  • 该内容是否真正回答了问题?
  • 是否存在逻辑错误?
  • 我是否遗漏了边缘情况?
  • 这是不是最简单的解决方案?
  • 资深开发者是否会认可这个方案?
undefined

3. Problem Decomposition

3. 问题拆解

typescript
// ❌ Bad: Trying to solve everything at once
function solveComplexProblem() {
  // 500 lines of tangled logic
}

// ✅ Good: Decomposed into clear steps
function solveComplexProblem() {
  const parsed = parseInput();
  const validated = validateData(parsed);
  const processed = processData(validated);
  return formatOutput(processed);
}
typescript
// ❌ 错误示例:试图一次性解决所有问题
function solveComplexProblem() {
  // 500行混乱的逻辑代码
}

// ✅ 正确示例:拆解为清晰的步骤
function solveComplexProblem() {
  const parsed = parseInput();
  const validated = validateData(parsed);
  const processed = processData(validated);
  return formatOutput(processed);
}

4. Verification Strategies

4. 验证策略

StrategyWhen to Use
Trace ThroughAlgorithm logic
Edge CasesInput validation
Type CheckTypeScript code
Unit TestCritical functions
Dry RunComplex flows
策略使用场景
追踪排查算法逻辑
边缘情况测试输入验证
类型检查TypeScript代码
单元测试关键函数
试运行复杂流程

5. Error Detection

5. 错误检测

markdown
undefined
markdown
undefined

Common Reasoning Errors

常见推理错误

  1. Assumption Error: Assuming facts not stated
  2. Logic Gap: Missing intermediate steps
  3. Scope Creep: Solving wrong problem
  4. Premature Optimization: Overcomplicating
  5. Confirmation Bias: Ignoring alternatives
undefined
  1. 假设错误:假设未明确说明的事实
  2. 逻辑断层:缺少中间推理步骤
  3. 范围偏离:解决了错误的问题
  4. 过早优化:过度复杂化解决方案
  5. 确认偏差:忽略其他备选方案
undefined

6. Reasoning Template

6. 推理模板

Use this template for complex tasks:
markdown
undefined
在处理复杂任务时使用以下模板:
markdown
undefined

Task: [Description]

任务:[任务描述]

Understanding

理解阶段

  • Goal: [What we need to achieve]
  • Constraints: [Limitations]
  • Inputs: [Available data]
  • 目标:[我们需要达成的结果]
  • 约束条件:[限制因素]
  • 输入数据:[可用的数据]

Approach

实施步骤

  1. Step 1: [Description]
  2. Step 2: [Description]
  3. Step 3: [Description]
  1. 步骤1:[步骤描述]
  2. 步骤2:[步骤描述]
  3. 步骤3:[步骤描述]

Execution

执行过程

[Work through each step]
[逐步完成每个步骤]

Verification

验证环节

  • Goal achieved
  • Constraints satisfied
  • No side effects
  • 达成目标
  • 满足约束条件
  • 无副作用

Reflection

反思总结

  • What worked: [...]
  • What could improve: [...]
undefined
  • 有效之处:[...]
  • 可改进点:[...]
undefined

References

参考资料