Reasoning Patterns
Systematic thinking for accurate problem solving.
Instructions
- Chain-of-Thought (CoT)
Break complex problems into explicit reasoning steps:
PROBLEM → ANALYZE → DECOMPOSE → SOLVE STEPS → VERIFY → SYNTHESIZE
Thinking Process
-
Understand: What is being asked?
-
Identify: What information do I have?
-
Plan: What steps will solve this?
-
Execute: Work through each step
-
Verify: Is the solution correct?
-
Self-Reflection Protocol
Before finalizing any output:
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?
- Problem Decomposition
// ❌ 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); }
- Verification Strategies
Strategy When to Use
Trace Through Algorithm logic
Edge Cases Input validation
Type Check TypeScript code
Unit Test Critical functions
Dry Run Complex flows
- Error Detection
Common Reasoning Errors
-
Assumption Error: Assuming facts not stated
-
Logic Gap: Missing intermediate steps
-
Scope Creep: Solving wrong problem
-
Premature Optimization: Overcomplicating
-
Confirmation Bias: Ignoring alternatives
-
Reasoning Template
Use this template for complex tasks:
Task: [Description]
Understanding
- Goal: [What we need to achieve]
- Constraints: [Limitations]
- Inputs: [Available data]
Approach
- Step 1: [Description]
- Step 2: [Description]
- Step 3: [Description]
Execution
[Work through each step]
Verification
- Goal achieved
- Constraints satisfied
- No side effects
Reflection
- What worked: [...]
- What could improve: [...]
References
-
Chain-of-Thought Prompting
-
Self-Consistency Improves CoT