@ckelsoe/prompt-architect 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +20 -0
- package/.claude-plugin/plugin.json +18 -0
- package/CHANGELOG.md +264 -0
- package/LICENSE +21 -0
- package/MIGRATION.md +66 -0
- package/README.md +1184 -0
- package/adapters/README.md +267 -0
- package/adapters/for-cursor.mdc +138 -0
- package/adapters/for-gemini-cli.md +70 -0
- package/adapters/for-github-copilot.md +141 -0
- package/adapters/for-openai-codex-cli.md +158 -0
- package/adapters/for-windsurf.md +136 -0
- package/adapters/system-prompt.md +243 -0
- package/package.json +135 -0
- package/scripts/install.js +490 -0
- package/scripts/test.js +213 -0
- package/scripts/validate-skill.js +350 -0
- package/skills/prompt-architect/SKILL.md +331 -0
- package/skills/prompt-architect/assets/templates/ape_template.txt +5 -0
- package/skills/prompt-architect/assets/templates/bab_template.txt +15 -0
- package/skills/prompt-architect/assets/templates/broke_template.txt +15 -0
- package/skills/prompt-architect/assets/templates/cai-critique-revise_template.txt +18 -0
- package/skills/prompt-architect/assets/templates/care_template.txt +16 -0
- package/skills/prompt-architect/assets/templates/chain-of-density_template.txt +46 -0
- package/skills/prompt-architect/assets/templates/chain-of-thought_template.txt +49 -0
- package/skills/prompt-architect/assets/templates/co-star_template.txt +17 -0
- package/skills/prompt-architect/assets/templates/crispe_template.txt +14 -0
- package/skills/prompt-architect/assets/templates/ctf_template.txt +15 -0
- package/skills/prompt-architect/assets/templates/devils-advocate_template.txt +25 -0
- package/skills/prompt-architect/assets/templates/hybrid_template.txt +101 -0
- package/skills/prompt-architect/assets/templates/least-to-most_template.txt +16 -0
- package/skills/prompt-architect/assets/templates/plan-and-solve_template.txt +7 -0
- package/skills/prompt-architect/assets/templates/pre-mortem_template.txt +27 -0
- package/skills/prompt-architect/assets/templates/race_template.txt +19 -0
- package/skills/prompt-architect/assets/templates/rcot_template.txt +31 -0
- package/skills/prompt-architect/assets/templates/react_template.txt +27 -0
- package/skills/prompt-architect/assets/templates/reverse-role_template.txt +11 -0
- package/skills/prompt-architect/assets/templates/rise-ie_template.txt +23 -0
- package/skills/prompt-architect/assets/templates/rise-ix_template.txt +28 -0
- package/skills/prompt-architect/assets/templates/risen_template.txt +21 -0
- package/skills/prompt-architect/assets/templates/rpef_template.txt +26 -0
- package/skills/prompt-architect/assets/templates/rtf_template.txt +13 -0
- package/skills/prompt-architect/assets/templates/self-refine_template.txt +16 -0
- package/skills/prompt-architect/assets/templates/skeleton-of-thought_template.txt +15 -0
- package/skills/prompt-architect/assets/templates/step-back_template.txt +10 -0
- package/skills/prompt-architect/assets/templates/tidd-ec_template.txt +45 -0
- package/skills/prompt-architect/assets/templates/tree-of-thought_template.txt +30 -0
- package/skills/prompt-architect/references/frameworks/ape.md +200 -0
- package/skills/prompt-architect/references/frameworks/bab.md +242 -0
- package/skills/prompt-architect/references/frameworks/broke.md +242 -0
- package/skills/prompt-architect/references/frameworks/cai-critique-revise.md +230 -0
- package/skills/prompt-architect/references/frameworks/care.md +235 -0
- package/skills/prompt-architect/references/frameworks/chain-of-density.md +479 -0
- package/skills/prompt-architect/references/frameworks/chain-of-thought.md +424 -0
- package/skills/prompt-architect/references/frameworks/co-star.md +256 -0
- package/skills/prompt-architect/references/frameworks/crispe.md +253 -0
- package/skills/prompt-architect/references/frameworks/ctf.md +207 -0
- package/skills/prompt-architect/references/frameworks/devils-advocate.md +206 -0
- package/skills/prompt-architect/references/frameworks/least-to-most.md +226 -0
- package/skills/prompt-architect/references/frameworks/plan-and-solve.md +210 -0
- package/skills/prompt-architect/references/frameworks/pre-mortem.md +197 -0
- package/skills/prompt-architect/references/frameworks/race.md +243 -0
- package/skills/prompt-architect/references/frameworks/rcot.md +203 -0
- package/skills/prompt-architect/references/frameworks/react.md +304 -0
- package/skills/prompt-architect/references/frameworks/reverse-role.md +189 -0
- package/skills/prompt-architect/references/frameworks/rise.md +555 -0
- package/skills/prompt-architect/references/frameworks/risen.md +297 -0
- package/skills/prompt-architect/references/frameworks/rpef.md +195 -0
- package/skills/prompt-architect/references/frameworks/rtf.md +358 -0
- package/skills/prompt-architect/references/frameworks/self-refine.md +205 -0
- package/skills/prompt-architect/references/frameworks/skeleton-of-thought.md +186 -0
- package/skills/prompt-architect/references/frameworks/step-back.md +206 -0
- package/skills/prompt-architect/references/frameworks/tidd-ec.md +470 -0
- package/skills/prompt-architect/references/frameworks/tree-of-thought.md +260 -0
- package/skills/prompt-architect/scripts/framework_analyzer.py +807 -0
- package/skills/prompt-architect/scripts/prompt_evaluator.py +336 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# Tree of Thought Framework
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Tree of Thought (ToT) extends Chain of Thought by enabling branching exploration rather than linear reasoning. Where Chain of Thought follows one reasoning path step-by-step, Tree of Thought explicitly explores multiple solution branches, evaluates each, and selects the best path forward. It is ideal for problems where the right approach is unknown upfront and multiple strategies need to be considered simultaneously.
|
|
6
|
+
|
|
7
|
+
**Research basis:** Introduced in "Tree of Thoughts: Deliberate Problem Solving with Large Language Models" (Yao et al., 2023).
|
|
8
|
+
|
|
9
|
+
## Components
|
|
10
|
+
|
|
11
|
+
### Problem
|
|
12
|
+
**Purpose:** Define the problem to be solved and what a solution should achieve.
|
|
13
|
+
|
|
14
|
+
**Questions to Ask:**
|
|
15
|
+
- What exactly needs to be solved?
|
|
16
|
+
- What constraints exist?
|
|
17
|
+
- What does a good solution look like?
|
|
18
|
+
|
|
19
|
+
### Branches
|
|
20
|
+
**Purpose:** Define the distinct approaches or solution paths to explore. Each branch is an independent line of reasoning.
|
|
21
|
+
|
|
22
|
+
**Questions to Ask:**
|
|
23
|
+
- What are the meaningfully different approaches?
|
|
24
|
+
- What dimensions of variation exist?
|
|
25
|
+
- How many branches are appropriate? (2-5 is typical)
|
|
26
|
+
|
|
27
|
+
### Evaluation Criteria
|
|
28
|
+
**Purpose:** Define how branches will be compared and which will be selected.
|
|
29
|
+
|
|
30
|
+
**Questions to Ask:**
|
|
31
|
+
- What makes one approach better than another?
|
|
32
|
+
- What trade-offs matter?
|
|
33
|
+
- Is there a single best answer or context-dependent?
|
|
34
|
+
|
|
35
|
+
### Conclusion
|
|
36
|
+
**Purpose:** Synthesize the branch analysis into a recommendation or decision.
|
|
37
|
+
|
|
38
|
+
## Template Structure
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
PROBLEM:
|
|
42
|
+
[What needs to be solved, constraints, success criteria]
|
|
43
|
+
|
|
44
|
+
EXPLORE THESE BRANCHES:
|
|
45
|
+
Branch 1: [Approach/strategy name]
|
|
46
|
+
Branch 2: [Approach/strategy name]
|
|
47
|
+
Branch 3: [Approach/strategy name]
|
|
48
|
+
[Add branches as needed]
|
|
49
|
+
|
|
50
|
+
For each branch:
|
|
51
|
+
- Describe the approach
|
|
52
|
+
- Work through the reasoning
|
|
53
|
+
- Identify strengths and weaknesses
|
|
54
|
+
- Note risks or edge cases
|
|
55
|
+
|
|
56
|
+
EVALUATION CRITERIA:
|
|
57
|
+
[How to compare branches — what matters most]
|
|
58
|
+
|
|
59
|
+
CONCLUSION:
|
|
60
|
+
[Select best branch with reasoning, or explain trade-offs if context-dependent]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Complete Examples
|
|
64
|
+
|
|
65
|
+
### Example 1: Architecture Decision
|
|
66
|
+
|
|
67
|
+
**Before Tree of Thought:**
|
|
68
|
+
"What's the best database for our app?"
|
|
69
|
+
|
|
70
|
+
**After Tree of Thought:**
|
|
71
|
+
```
|
|
72
|
+
PROBLEM:
|
|
73
|
+
We are building a real-time collaborative document editor (like Google Docs).
|
|
74
|
+
Need to choose a primary database. Constraints: 10-person team, most have SQL
|
|
75
|
+
experience, 6-month timeline, expected 100k users at launch. Must support
|
|
76
|
+
real-time sync, offline mode, and conflict resolution.
|
|
77
|
+
|
|
78
|
+
EXPLORE THESE BRANCHES:
|
|
79
|
+
|
|
80
|
+
Branch 1: PostgreSQL with operational transforms
|
|
81
|
+
Branch 2: CRDTs with a document store (e.g., Firestore)
|
|
82
|
+
Branch 3: Event sourcing with an append-only log (e.g., EventStoreDB)
|
|
83
|
+
|
|
84
|
+
For each branch, analyze:
|
|
85
|
+
- How well it handles real-time sync and conflicts
|
|
86
|
+
- Team learning curve
|
|
87
|
+
- Operational complexity
|
|
88
|
+
- Scalability ceiling
|
|
89
|
+
- Known production use cases
|
|
90
|
+
|
|
91
|
+
EVALUATION CRITERIA:
|
|
92
|
+
Primary: correctness of conflict resolution
|
|
93
|
+
Secondary: team familiarity, time to production
|
|
94
|
+
Tertiary: long-term scalability
|
|
95
|
+
|
|
96
|
+
CONCLUSION:
|
|
97
|
+
Recommend one approach with clear reasoning. If it depends on a factor
|
|
98
|
+
we haven't decided (e.g., team preference), state what information would
|
|
99
|
+
change the recommendation.
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Example 2: Debugging with Multiple Hypotheses
|
|
103
|
+
|
|
104
|
+
**Before Tree of Thought:**
|
|
105
|
+
"Why is this failing?"
|
|
106
|
+
|
|
107
|
+
**After Tree of Thought:**
|
|
108
|
+
```
|
|
109
|
+
PROBLEM:
|
|
110
|
+
Our API endpoint is intermittently returning 500 errors — roughly 2% of requests.
|
|
111
|
+
Only occurs under load (>100 req/s). Errors started after deploying a new caching
|
|
112
|
+
layer last Tuesday. No obvious pattern in logs except "connection pool exhausted."
|
|
113
|
+
|
|
114
|
+
EXPLORE THESE BRANCHES:
|
|
115
|
+
|
|
116
|
+
Branch 1: Connection pool misconfiguration
|
|
117
|
+
Branch 2: Cache stampede causing downstream overload
|
|
118
|
+
Branch 3: Memory leak in the new caching layer code
|
|
119
|
+
Branch 4: Race condition in concurrent cache writes
|
|
120
|
+
|
|
121
|
+
For each branch:
|
|
122
|
+
- Describe the failure mechanism
|
|
123
|
+
- What evidence would confirm or rule it out
|
|
124
|
+
- What diagnostic steps to take first
|
|
125
|
+
- What the fix would look like
|
|
126
|
+
|
|
127
|
+
EVALUATION CRITERIA:
|
|
128
|
+
Likelihood given available evidence (especially "connection pool exhausted" message
|
|
129
|
+
and load threshold). Prioritize branches that can be confirmed quickly.
|
|
130
|
+
|
|
131
|
+
CONCLUSION:
|
|
132
|
+
Rank branches by likelihood. Recommend first diagnostic step. Identify any branch
|
|
133
|
+
that, if true, requires immediate action before others are investigated.
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Example 3: Product Strategy
|
|
137
|
+
|
|
138
|
+
**Before Tree of Thought:**
|
|
139
|
+
"Should we build this feature?"
|
|
140
|
+
|
|
141
|
+
**After Tree of Thought:**
|
|
142
|
+
```
|
|
143
|
+
PROBLEM:
|
|
144
|
+
We are deciding whether to build a native mobile app (iOS/Android) or improve our
|
|
145
|
+
responsive web app. We have 4 engineers, 6 months of runway, and 80% of current
|
|
146
|
+
users are on desktop. However, our top 20% of users (by revenue) use mobile.
|
|
147
|
+
|
|
148
|
+
EXPLORE THESE BRANCHES:
|
|
149
|
+
|
|
150
|
+
Branch 1: Build native mobile apps
|
|
151
|
+
Branch 2: Invest in progressive web app (PWA)
|
|
152
|
+
Branch 3: Do nothing mobile-specific; focus on desktop conversion
|
|
153
|
+
|
|
154
|
+
For each branch:
|
|
155
|
+
- Development cost and timeline estimate
|
|
156
|
+
- Impact on top-20% users
|
|
157
|
+
- Impact on new user acquisition
|
|
158
|
+
- Risk if we're wrong about our assumptions
|
|
159
|
+
|
|
160
|
+
EVALUATION CRITERIA:
|
|
161
|
+
Revenue impact on existing top users weighted 3x vs. new user acquisition.
|
|
162
|
+
Time to deliver weighted heavily given runway constraints.
|
|
163
|
+
|
|
164
|
+
CONCLUSION:
|
|
165
|
+
Recommend a path. State the single biggest assumption that could invalidate
|
|
166
|
+
the recommendation.
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Best Use Cases
|
|
170
|
+
|
|
171
|
+
1. **Architecture and Design Decisions**
|
|
172
|
+
- Technology selection
|
|
173
|
+
- System design trade-offs
|
|
174
|
+
- API design choices
|
|
175
|
+
|
|
176
|
+
2. **Debugging with Unclear Root Cause**
|
|
177
|
+
- Multiple plausible failure modes
|
|
178
|
+
- Intermittent issues
|
|
179
|
+
- After a recent change with unclear impact
|
|
180
|
+
|
|
181
|
+
3. **Strategic Decisions**
|
|
182
|
+
- Build vs. buy vs. integrate
|
|
183
|
+
- Feature prioritization
|
|
184
|
+
- Market entry strategies
|
|
185
|
+
|
|
186
|
+
4. **Algorithm/Approach Selection**
|
|
187
|
+
- When multiple algorithms could solve the problem
|
|
188
|
+
- Optimization with multiple valid approaches
|
|
189
|
+
- Design patterns selection
|
|
190
|
+
|
|
191
|
+
5. **Risk Analysis**
|
|
192
|
+
- Scenario planning
|
|
193
|
+
- "What could go wrong?" analysis across multiple failure modes
|
|
194
|
+
|
|
195
|
+
## Selection Criteria
|
|
196
|
+
|
|
197
|
+
**Choose Tree of Thought when:**
|
|
198
|
+
- ✅ Multiple meaningfully different approaches exist
|
|
199
|
+
- ✅ The right answer is not obvious upfront
|
|
200
|
+
- ✅ You want systematic comparison, not just one solution
|
|
201
|
+
- ✅ Trade-offs need to be explicit
|
|
202
|
+
- ✅ A decision needs to be defensible
|
|
203
|
+
|
|
204
|
+
**Avoid Tree of Thought when:**
|
|
205
|
+
- ❌ One clearly correct approach exists → use Chain of Thought
|
|
206
|
+
- ❌ Task is about creating content → use CO-STAR
|
|
207
|
+
- ❌ Linear step-by-step is sufficient → use Chain of Thought or RISEN
|
|
208
|
+
- ❌ Simple, well-defined task → use RTF, CTF, or APE
|
|
209
|
+
|
|
210
|
+
## Tree of Thought vs. Chain of Thought
|
|
211
|
+
|
|
212
|
+
| | Chain of Thought | Tree of Thought |
|
|
213
|
+
|---|---|---|
|
|
214
|
+
| Structure | Linear steps | Branching exploration |
|
|
215
|
+
| Best for | Known approach, complex execution | Unknown best approach |
|
|
216
|
+
| Output | Step-by-step reasoning to one answer | Comparison of multiple paths + recommendation |
|
|
217
|
+
| Use when | "How do I solve this?" | "Which approach should I take?" |
|
|
218
|
+
|
|
219
|
+
**Rule of thumb:** If you know what approach to use and need to work through it carefully → Chain of Thought. If you're unsure which approach is best → Tree of Thought.
|
|
220
|
+
|
|
221
|
+
## Branch Design Tips
|
|
222
|
+
|
|
223
|
+
1. **Branches should be meaningfully different**
|
|
224
|
+
- Not just variations of the same approach
|
|
225
|
+
- Each branch should lead to genuinely different outcomes
|
|
226
|
+
|
|
227
|
+
2. **2-5 branches is optimal**
|
|
228
|
+
- Fewer than 2 = just Chain of Thought
|
|
229
|
+
- More than 5 = too much to evaluate clearly
|
|
230
|
+
|
|
231
|
+
3. **Name branches clearly**
|
|
232
|
+
- "Option A" is not a branch name
|
|
233
|
+
- Name the approach: "PostgreSQL with row-level locking"
|
|
234
|
+
|
|
235
|
+
4. **Each branch gets equal treatment**
|
|
236
|
+
- Don't telegraph your preferred answer in the problem statement
|
|
237
|
+
- Give each branch a fair analysis
|
|
238
|
+
|
|
239
|
+
## Common Mistakes
|
|
240
|
+
|
|
241
|
+
1. **Branches That Aren't Really Different**
|
|
242
|
+
- "Use Redis" and "Use Memcached" might be the same branch at the right level of abstraction
|
|
243
|
+
|
|
244
|
+
2. **Missing Evaluation Criteria**
|
|
245
|
+
- Without criteria, the "conclusion" is just a preference, not a reasoned decision
|
|
246
|
+
|
|
247
|
+
3. **Using ToT for Linear Problems**
|
|
248
|
+
- If the problem has one right answer, Chain of Thought is more efficient
|
|
249
|
+
|
|
250
|
+
4. **Too Many Branches**
|
|
251
|
+
- 6+ branches leads to shallow analysis; reduce or group branches
|
|
252
|
+
|
|
253
|
+
## Quick Reference
|
|
254
|
+
|
|
255
|
+
| Component | Focus | Key Question |
|
|
256
|
+
|-----------|-------|--------------|
|
|
257
|
+
| Problem | What to solve | "What decision needs to be made?" |
|
|
258
|
+
| Branches | Solution paths | "What are the distinct approaches?" |
|
|
259
|
+
| Evaluation | Comparison criteria | "What makes one better than another?" |
|
|
260
|
+
| Conclusion | Decision | "Which path forward and why?" |
|