Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计提醒

chain-of-thought思想链

Agent Skill

chain-of-thought 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

466

周安装

20

GitHub Stars

公开资料未说明

下载量

163
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:chain-of-thought(思想链)
来源仓库:https://github.com/wesley1600/claudecodeframework
仓库路径:skills/chain-of-thought
安装命令:
npx skills add https://github.com/wesley1600/claudecodeframework --skill chain-of-thought
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/wesley1600/claudecodeframework --skill chain-of-thought

简介

增强 AI 推理透明度与可靠性,支持逐步分析与错误调试。

  • 适用于复杂问题拆解、计划更新与自适应学习场景。chain-of-thought 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 通过 github 安装并使用 npx skills add 命令集成。
  • 需确认宿主平台兼容性,注意部分环境可能存在依赖冲突。
  • 建议结合来源仓库和 README 了解触发条件与输出格式规范。

SKILL.md

Chain of Thought Reasoning

Purpose

This skill enables structured, transparent reasoning by injecting chain of thought (CoT) blocks into prompts. It encourages the model to think step-by-step, explicitly show reasoning processes, and separate thinking from final outputs.

Chain of thought reasoning improves:

  • Problem-solving accuracy - Breaking down complex problems into manageable steps
  • Transparency - Making reasoning visible and auditable
  • Self-correction - Allowing the model to catch and fix errors during reasoning
  • Planning - Enabling reflection and iterative plan refinement
  • Debugging - Understanding how conclusions were reached

When to Use

Activate this skill for tasks that benefit from explicit reasoning:

  • Complex problem-solving - Multi-step mathematical, logical, or analytical problems
  • Code analysis - Understanding unfamiliar codebases, debugging, or architecture decisions
  • Planning and design - Breaking down features, designing systems, or creating implementation plans
  • Research tasks - Synthesizing information from multiple sources
  • Decision-making - Evaluating trade-offs between multiple approaches
  • Error diagnosis - Investigating bugs or unexpected behavior
  • Refactoring - Reasoning about code improvements and their implications
  • Any task where "showing your work" leads to better outcomes

How It Works

Chain of thought uses XML tags to demarcate reasoning and output sections:

Primary Structure

<thinking>
Step 1: [Analyze the problem]
- What are we trying to accomplish?
- What information do we have?
- What's missing?

Step 2: [Break down the approach]
- What are the main steps?
- What are potential challenges?

Step 3: [Evaluate options]
- Option A: pros and cons
- Option B: pros and cons
- Decision: [chosen approach and why]

Step 4: [Verify reasoning]
- Does this make sense?
- Are there edge cases?
- What could go wrong?
</thinking>

<answer>
[Clear, concise final output based on the reasoning above]
</answer>

Advanced Structure for Multi-Agent Systems

Inspired by the Manus AI multi-agent system, use nested thinking for complex workflows:

<thinking>
## Initial Analysis
[First pass understanding]

## Plan Formation
Current plan:
1. [Step 1]
2. [Step 2]
3. [Step 3]

## Reflection
Is this plan optimal?
- Consideration 1: [reflection]
- Consideration 2: [reflection]

## Plan Update
Revised plan:
1. [Updated step 1]
2. [Updated step 2]
3. [New step 3]

Rationale for changes: [explanation]

## Execution Strategy
How to implement step 1:
- [Details]
- [Considerations]
</thinking>

<answer>
[Final output incorporating refined thinking]
</answer>

Prompt Injection Patterns

Pattern 1: Problem-Solving Template

<thinking>
1. Problem understanding:
   - Given: [what we know]
   - Goal: [what we need to find/do]
   - Constraints: [limitations]

2. Approach:
   - Strategy: [chosen method]
   - Why: [rationale]

3. Step-by-step execution:
   - [Step 1 with reasoning]
   - [Step 2 with reasoning]
   - [Step 3 with reasoning]

4. Verification:
   - Does the solution meet requirements?
   - Are there edge cases?
</thinking>

<answer>
[Solution]
</answer>

Pattern 2: Code Analysis Template

<thinking>
1. Code structure overview:
   - Main components: [list]
   - Data flow: [description]

2. Key observations:
   - Pattern 1: [what and why]
   - Pattern 2: [what and why]

3. Analysis:
   - [Detailed reasoning about the code]

4. Conclusion:
   - [Synthesis of findings]
</thinking>

<answer>
[Clear explanation or recommendation]
</answer>

Pattern 3: Planning Template

<thinking>
1. Requirements analysis:
   - Must have: [core requirements]
   - Nice to have: [optional features]

2. Initial plan:
   [List of steps]

3. Risk assessment:
   - Risk 1: [description and mitigation]
   - Risk 2: [description and mitigation]

4. Plan refinement:
   [Updated plan based on risks]

5. Validation:
   - Does this plan address all requirements?
   - Is it feasible?
   - What assumptions are we making?
</thinking>

<answer>
[Final plan with clear action items]
</answer>

Guidelines

1. Structure Your Thinking

  • Start with understanding - State what you know and what you need to find out
  • Break down complex tasks - Divide into smaller, manageable pieces
  • Show your work - Write out intermediate steps, not just conclusions
  • Be explicit - State assumptions, trade-offs, and reasoning clearly

2. Use Reflection

  • Question your approach - "Is this the best way?"
  • Check your logic - "Does this reasoning hold up?"
  • Consider alternatives - "What other approaches exist?"
  • Update your plan - Don't be afraid to revise based on new insights

3. Separate Thinking from Output

  • Thinking block - For exploration, reasoning, and working through problems
  • Answer block - For the polished, final response
  • Keep thinking raw - Don't over-polish; show genuine reasoning
  • Keep answers concise - User sees the answer; thinking is internal

4. When to Use Each Block

Use <thinking> for:

  • Analyzing requirements
  • Breaking down problems
  • Evaluating options
  • Working through logic
  • Planning implementation
  • Reflecting on decisions
  • Catching errors
  • Exploring trade-offs

Use <answer> for:

  • Final recommendations
  • Implemented solutions
  • Clear explanations
  • Action items
  • Conclusions

5. Best Practices

  • Be honest in thinking - If uncertain, say so
  • Show error correction - If you notice a mistake, correct it in the thinking block
  • Use markdown - Format thinking blocks for readability
  • Number your steps - Makes reasoning easier to follow
  • Summarize in answer - Don't make users read all thinking to get the point

Examples

Example 1: Debugging a Problem

Prompt: "This function is returning incorrect results for negative numbers. Can you fix it?"

<thinking>
1. Understanding the problem:
   - Function works for positive numbers
   - Fails for negative numbers
   - Need to identify why negatives cause issues

2. Code analysis:
   - [Read through the function]
   - Line 15: Uses Math.abs() - converts negative to positive
   - Line 20: Returns result without sign restoration
   - Aha! The absolute value removes the sign, but we never restore it

3. Solution approach:
   - Option A: Track sign separately and reapply
   - Option B: Handle negative numbers differently
   - Choosing A: cleaner and preserves existing logic

4. Implementation plan:
   - Store original sign
   - Apply absolute value for calculation
   - Multiply result by original sign
</thinking>

<answer>
The bug is on lines 15-20. The function uses `Math.abs()` but never restores the original sign. Here's the fix:

const sign = num < 0 ? -1 : 1; const absNum = Math.abs(num); // ... existing calculation ... return result * sign;


### Example 2: Choosing Between Architectures

**Prompt:** "Should we use microservices or a monolith for this project?"

<thinking>

  1. Context gathering:

- Team size: small (3 developers) - Project scope: MVP with planned growth - Timeline: 3 months to launch - Infrastructure: cloud-based

  1. Microservices analysis:

Pros: - Scalability per service - Independent deployment - Technology flexibility

Cons: - Operational complexity (DevOps overhead) - Network latency - Distributed debugging challenges - Over-engineering for small team

  1. Monolith analysis:

Pros: - Simpler deployment - Easier debugging - Faster initial development - Single codebase

Cons: - Scaling requires scaling entire app - Potential coupling issues - May need to break apart later

  1. Decision reasoning:

- Small team → simpler is better - MVP timeline → need speed - Planned growth → can refactor later - Monolith-first approach is lower risk

  1. Recommendation:

Start with modular monolith, design for eventual extraction </thinking>

<answer> For your project, I recommend starting with a modular monolith:

Why:

  • Your small team will move faster without microservices overhead
  • 3-month MVP timeline needs simplicity
  • You can refactor to microservices later if needed

Key principle: Design modules with clear boundaries (separate folders, interfaces) so future extraction is easier.

Action items:

  1. Structure code in domain modules (auth, payments, users)
  2. Use dependency injection for loose coupling
  3. Plan data models to avoid cross-module dependencies

</answer>


### Example 3: Multi-Step Implementation Planning

**Prompt:** "Add user authentication with OAuth to our app"

<thinking>

Initial Analysis

Requirements:

  • OAuth integration (which providers? assuming Google/GitHub)
  • User session management
  • Protected routes
  • Existing app: appears to be Express.js based

Plan Formation v1

  1. Choose OAuth library
  2. Set up OAuth credentials
  3. Implement login/logout routes
  4. Add session middleware
  5. Protect existing routes

Reflection

Issues with v1:

  • Didn't consider token storage
  • No user database integration mentioned
  • Missing error handling strategy
  • Should address CSRF protection

Plan Formation v2

  1. Research codebase for existing auth patterns
  2. Choose OAuth library (passport.js likely best for Express)
  3. Set up database schema for users
  4. Configure OAuth providers (Google, GitHub)
  5. Implement authentication routes
  6. Add session management with secure tokens
  7. Create auth middleware for protected routes
  8. Add CSRF protection
  9. Implement logout and session cleanup
  10. Add error handling for auth failures

Execution Strategy for Step 1

Need to:

  • Check if passport.js already installed
  • Look for existing user models
  • Identify protected routes
  • Check current session handling

</thinking>

<answer> I'll implement OAuth authentication. Let me start by researching your current codebase to understand existing patterns, then proceed with the implementation plan:

  1. Audit current auth patterns
  2. Set up passport.js with OAuth strategies
  3. Create user database schema
  4. Implement login/logout flows
  5. Add session management
  6. Protect routes with auth middleware
  7. Add security measures (CSRF, secure tokens)

Starting with codebase research... </answer>


## Integration with Multi-Agent Systems

In multi-agent architectures like Manus AI, chain of thought enables:

- **Agent reflection** - Agents explicitly reason about their actions before executing
- **Plan updating** - Agents revise strategies based on intermediate results
- **Inter-agent communication** - Thinking blocks provide transparency for coordination
- **Error recovery** - Agents can detect issues during reasoning and adapt

Agents can maintain persistent thinking across multiple turns:

<thinking>

Turn 1 Reflection

Previous attempt: [what was tried] Result: [what happened] Learning: [what we discovered]

Updated Strategy

Based on the failure, trying new approach: [revised plan] </thinking>

<answer> [Action based on updated thinking] </answer>


## References

For detailed examples and advanced patterns, see:

- [REFERENCE.md](https://github.com/wesley1600/claudecodeframework/blob/HEAD/.claude/skills/chain-of-thought/references/REFERENCE.md) - Extended examples and patterns
- [XML Guide Conventions](https://github.com/wesley1600/claudecodeframework/blob/HEAD/.claude/skills/chain-of-thought/references/XML-GUIDE.md) - Proper XML tag usage

## Summary

Chain of thought reasoning makes AI behavior more:

- **Transparent** - You can see how conclusions were reached
- **Reliable** - Step-by-step reduces errors
- **Debuggable** - Easy to spot where reasoning went wrong
- **Adaptive** - Reflection enables plan updates

Use this skill whenever explicit reasoning improves outcomes.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.19%
按下载量换算61

Claude

30.98%
按下载量换算50

Cursor

16.47%
按下载量换算27

Gemini CLI

8.85%
按下载量换算14

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills