@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,243 @@
|
|
|
1
|
+
# RACE Framework
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
RACE (Role, Action, Context, Expectation) is a medium-complexity framework that sits between RTF's simplicity and CO-STAR's richness. It adds two critical improvements over RTF: situational context (missing from RTF) and an explicit expectation of success (missing from both RTF and CTF). RACE is ideal when you need all four pillars — expertise framing, task clarity, background, and a defined success bar — without the full overhead of CO-STAR or RISEN.
|
|
6
|
+
|
|
7
|
+
## Components
|
|
8
|
+
|
|
9
|
+
### R - Role
|
|
10
|
+
**Purpose:** Define the expertise or persona needed for the task.
|
|
11
|
+
|
|
12
|
+
**Questions to Ask:**
|
|
13
|
+
- What expertise is required?
|
|
14
|
+
- What viewpoint should the AI take?
|
|
15
|
+
- What level of knowledge is assumed?
|
|
16
|
+
|
|
17
|
+
**Examples:**
|
|
18
|
+
- "You are a senior backend engineer..."
|
|
19
|
+
- "Act as an experienced UX designer..."
|
|
20
|
+
- "You are a plain-language technical writer..."
|
|
21
|
+
|
|
22
|
+
### A - Action
|
|
23
|
+
**Purpose:** State what needs to be done — the task.
|
|
24
|
+
|
|
25
|
+
**Questions to Ask:**
|
|
26
|
+
- What exactly needs to happen?
|
|
27
|
+
- What is the deliverable?
|
|
28
|
+
- What's the scope?
|
|
29
|
+
|
|
30
|
+
**Examples:**
|
|
31
|
+
- "Review this API design for consistency..."
|
|
32
|
+
- "Write user onboarding copy for..."
|
|
33
|
+
- "Identify the top 3 risks in..."
|
|
34
|
+
|
|
35
|
+
### C - Context
|
|
36
|
+
**Purpose:** Provide the situational background needed to calibrate the output.
|
|
37
|
+
|
|
38
|
+
**Questions to Ask:**
|
|
39
|
+
- What's the situation?
|
|
40
|
+
- What's already happened?
|
|
41
|
+
- What constraints apply?
|
|
42
|
+
- What does the audience/recipient need?
|
|
43
|
+
|
|
44
|
+
**Examples:**
|
|
45
|
+
- "This is a public API used by third-party developers who expect stable contracts..."
|
|
46
|
+
- "The users are first-time app users who may be unfamiliar with our terminology..."
|
|
47
|
+
- "This is for a Series A startup with a 3-person engineering team..."
|
|
48
|
+
|
|
49
|
+
### E - Expectation
|
|
50
|
+
**Purpose:** Define what a successful output looks like — the quality bar.
|
|
51
|
+
|
|
52
|
+
**Questions to Ask:**
|
|
53
|
+
- What does success look like?
|
|
54
|
+
- What format should the output take?
|
|
55
|
+
- What should be true of a good result?
|
|
56
|
+
- Any specific requirements for the output?
|
|
57
|
+
|
|
58
|
+
**Examples:**
|
|
59
|
+
- "Should prioritize breaking changes and security risks over style issues"
|
|
60
|
+
- "Should be conversational, not instructional — guide rather than command"
|
|
61
|
+
- "Should fit in a single Confluence page, scannable with headers"
|
|
62
|
+
|
|
63
|
+
## Template Structure
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
ROLE: [Expertise or persona]
|
|
67
|
+
|
|
68
|
+
ACTION: [What needs to be done]
|
|
69
|
+
|
|
70
|
+
CONTEXT: [Background, situation, constraints]
|
|
71
|
+
|
|
72
|
+
EXPECTATION: [What a good result looks like]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Complete Examples
|
|
76
|
+
|
|
77
|
+
### Example 1: API Review
|
|
78
|
+
|
|
79
|
+
**Before RACE:**
|
|
80
|
+
"Review my API design."
|
|
81
|
+
|
|
82
|
+
**After RACE:**
|
|
83
|
+
```
|
|
84
|
+
ROLE: You are a senior backend engineer with API design experience, familiar with
|
|
85
|
+
REST conventions and developer experience best practices.
|
|
86
|
+
|
|
87
|
+
ACTION: Review this REST API design for consistency, usability, and potential issues.
|
|
88
|
+
|
|
89
|
+
CONTEXT: This is a public API that will be used by third-party developers. We are
|
|
90
|
+
about to publish v1 and changes after launch will be breaking. The team is small
|
|
91
|
+
(3 engineers) and we have not done a formal API review before.
|
|
92
|
+
|
|
93
|
+
EXPECTATION: Prioritize issues by severity (breaking vs. cosmetic). Flag anything
|
|
94
|
+
that would frustrate external developers or cause versioning headaches. Format as
|
|
95
|
+
a prioritized list with issue, reason, and suggested fix for each.
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Example 2: Onboarding Copy
|
|
99
|
+
|
|
100
|
+
**Before RACE:**
|
|
101
|
+
"Write onboarding text for our app."
|
|
102
|
+
|
|
103
|
+
**After RACE:**
|
|
104
|
+
```
|
|
105
|
+
ROLE: You are a UX writer who specializes in onboarding flows for consumer apps.
|
|
106
|
+
|
|
107
|
+
ACTION: Write the copy for a 3-screen onboarding flow for our task management app.
|
|
108
|
+
|
|
109
|
+
CONTEXT: Users are downloading the app after seeing a social ad. Many are switching
|
|
110
|
+
from pen/paper or spreadsheets. They are not tech-savvy. They've already created
|
|
111
|
+
an account before seeing this onboarding. The screens are: (1) value prop, (2)
|
|
112
|
+
import/create first task, (3) invite team.
|
|
113
|
+
|
|
114
|
+
EXPECTATION: Each screen needs a headline (5 words max), one-sentence subhead, and
|
|
115
|
+
CTA button label. Tone: encouraging, simple, no jargon. The copy should build
|
|
116
|
+
momentum toward the first meaningful action.
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Example 3: Risk Assessment
|
|
120
|
+
|
|
121
|
+
**Before RACE:**
|
|
122
|
+
"What are the risks of this approach?"
|
|
123
|
+
|
|
124
|
+
**After RACE:**
|
|
125
|
+
```
|
|
126
|
+
ROLE: You are a software architect with experience in distributed systems and
|
|
127
|
+
enterprise migrations.
|
|
128
|
+
|
|
129
|
+
ACTION: Identify the top risks in the proposed database migration plan described below.
|
|
130
|
+
|
|
131
|
+
CONTEXT: We are migrating from a monolithic PostgreSQL database to a microservices
|
|
132
|
+
architecture with separate databases per service. Timeline is 6 months. Team has
|
|
133
|
+
strong SQL skills but limited microservices experience. The system handles financial
|
|
134
|
+
transactions and has a 99.9% uptime SLA.
|
|
135
|
+
|
|
136
|
+
EXPECTATION: List the top 5 risks ranked by likelihood × impact. For each: name,
|
|
137
|
+
description (2 sentences), and one mitigation approach. Flag any risks that could
|
|
138
|
+
violate the SLA or create data integrity issues as critical.
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Example 4: Code Documentation
|
|
142
|
+
|
|
143
|
+
**Before RACE:**
|
|
144
|
+
"Document this module."
|
|
145
|
+
|
|
146
|
+
**After RACE:**
|
|
147
|
+
```
|
|
148
|
+
ROLE: You are a technical writer who writes developer documentation for open-source
|
|
149
|
+
libraries.
|
|
150
|
+
|
|
151
|
+
ACTION: Write documentation for the authentication module described below.
|
|
152
|
+
|
|
153
|
+
CONTEXT: This is an open-source library used by developers integrating our platform.
|
|
154
|
+
Readers are competent developers but unfamiliar with our specific auth flow. The
|
|
155
|
+
docs will live on our developer portal alongside API reference docs.
|
|
156
|
+
|
|
157
|
+
EXPECTATION: Include: overview paragraph, when-to-use section, installation snippet,
|
|
158
|
+
quickstart code example, and a table of configuration options. Should be completable
|
|
159
|
+
in one reading session (under 500 words). Use clear headings and real code examples.
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Best Use Cases
|
|
163
|
+
|
|
164
|
+
1. **Technical Reviews**
|
|
165
|
+
- Code reviews with context
|
|
166
|
+
- Architecture assessments
|
|
167
|
+
- Design critiques
|
|
168
|
+
|
|
169
|
+
2. **Content with Expertise**
|
|
170
|
+
- Technical documentation
|
|
171
|
+
- UX/product copy
|
|
172
|
+
- Expert analysis
|
|
173
|
+
|
|
174
|
+
3. **Contextual Analysis**
|
|
175
|
+
- Risk assessments
|
|
176
|
+
- Recommendations with constraints
|
|
177
|
+
- Prioritization tasks
|
|
178
|
+
|
|
179
|
+
4. **When RTF Isn't Enough**
|
|
180
|
+
- Role alone doesn't capture enough
|
|
181
|
+
- Background materially changes the output
|
|
182
|
+
- "What does good look like?" is unclear
|
|
183
|
+
|
|
184
|
+
## Selection Criteria
|
|
185
|
+
|
|
186
|
+
**Choose RACE when:**
|
|
187
|
+
- ✅ Role/expertise matters
|
|
188
|
+
- ✅ Background context is needed
|
|
189
|
+
- ✅ Success criteria need to be explicit
|
|
190
|
+
- ✅ RTF feels too thin but CO-STAR feels too heavy
|
|
191
|
+
- ✅ Task has both "who" and "why" dimensions
|
|
192
|
+
|
|
193
|
+
**Avoid RACE when:**
|
|
194
|
+
- ❌ No role/expertise needed → use CTF or APE
|
|
195
|
+
- ❌ Audience, tone, style are critical → use CO-STAR
|
|
196
|
+
- ❌ Complex methodology required → use RISEN
|
|
197
|
+
- ❌ Transforming existing content → use BAB
|
|
198
|
+
- ❌ Ultra-simple task → use APE or RTF
|
|
199
|
+
|
|
200
|
+
## RACE vs. RTF vs. CO-STAR
|
|
201
|
+
|
|
202
|
+
| | APE | RTF | RACE | CO-STAR |
|
|
203
|
+
|---|---|---|---|---|
|
|
204
|
+
| Role | No | Yes | Yes | Implicit |
|
|
205
|
+
| Context | Minimal | No | Yes | Yes (rich) |
|
|
206
|
+
| Expectation | Yes | Partial (Format) | Yes (explicit) | Yes (Response) |
|
|
207
|
+
| Audience/Tone | No | No | No | Yes |
|
|
208
|
+
| Complexity | Minimal | Low | Medium | High |
|
|
209
|
+
| Best for | One-liners | Format-driven | Expert + context | Full content |
|
|
210
|
+
|
|
211
|
+
**Rule of thumb:**
|
|
212
|
+
- No role needed, quick → APE
|
|
213
|
+
- Role matters, no context → RTF
|
|
214
|
+
- Role + context + explicit outcome → RACE
|
|
215
|
+
- Full content with audience/tone → CO-STAR
|
|
216
|
+
|
|
217
|
+
## Common Mistakes
|
|
218
|
+
|
|
219
|
+
1. **Weak Expectation**
|
|
220
|
+
- "Good quality" is not an expectation
|
|
221
|
+
- Define format, length, priority, tone, or success criteria specifically
|
|
222
|
+
|
|
223
|
+
2. **Context Overload**
|
|
224
|
+
- Context should be background, not instructions
|
|
225
|
+
- Instructions belong in Action
|
|
226
|
+
- If Context is longer than Role + Action combined, consider CO-STAR
|
|
227
|
+
|
|
228
|
+
3. **Skipping Role**
|
|
229
|
+
- Even when obvious, Role calibrates expertise level and perspective
|
|
230
|
+
- Don't skip it
|
|
231
|
+
|
|
232
|
+
4. **Confusing Action and Expectation**
|
|
233
|
+
- Action = what to do
|
|
234
|
+
- Expectation = what a good result looks like after it's done
|
|
235
|
+
|
|
236
|
+
## Quick Reference
|
|
237
|
+
|
|
238
|
+
| Component | Focus | Key Question |
|
|
239
|
+
|-----------|-------|--------------|
|
|
240
|
+
| Role | Expertise | "Who should do this?" |
|
|
241
|
+
| Action | Task | "What needs to be done?" |
|
|
242
|
+
| Context | Background | "What's the situation?" |
|
|
243
|
+
| Expectation | Success bar | "What does good look like?" |
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# RCoT (Reverse Chain-of-Thought)
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Reverse Chain-of-Thought (RCoT) is a verification framework that catches reasoning errors by working backwards. After generating an initial answer using standard reasoning, the model is instructed to reconstruct what the original question must have been — given only its answer. The reconstructed question is then compared condition-by-condition against the actual question to identify overlooked conditions, misinterpreted constraints, and logical gaps. Discrepancies found in this cross-check feed back into a corrected response.
|
|
6
|
+
|
|
7
|
+
**Research basis:** Documented on LearnPrompting.org and Mirascope; grounded in academic backward reasoning literature (RCoT paper; FOBAR: forward-backward reasoning). Related work: "Reversal of Thought" (ACL 2025, arXiv 2410.12323); "Reverse Thinking Makes LLMs Stronger Reasoners" (NAACL 2025).
|
|
8
|
+
|
|
9
|
+
## Why RCoT Works
|
|
10
|
+
|
|
11
|
+
Forward reasoning errors typically come from:
|
|
12
|
+
- Overlooking a condition in the question
|
|
13
|
+
- Misinterpreting a constraint
|
|
14
|
+
- Assuming something that wasn't stated
|
|
15
|
+
|
|
16
|
+
When the model reconstructs "what question would produce my answer?", it must articulate what conditions its reasoning implicitly assumed. Comparing these implicit assumptions against the actual question reveals the gaps.
|
|
17
|
+
|
|
18
|
+
**Limitation:** RCoT catches overlooking and misinterpretation errors well, but is less effective at catching hallucinated facts (fabricated information that is internally consistent) or pure arithmetic errors.
|
|
19
|
+
|
|
20
|
+
## Components
|
|
21
|
+
|
|
22
|
+
### Initial Generation
|
|
23
|
+
**Purpose:** Standard reasoning pass — generate an initial answer using Chain-of-Thought or direct reasoning. This is the answer to verify.
|
|
24
|
+
|
|
25
|
+
### Question Reconstruction
|
|
26
|
+
**Purpose:** Given only the answer (not the original question), reconstruct what the question must have been. The model must articulate the implicit conditions its reasoning assumed.
|
|
27
|
+
|
|
28
|
+
**Trigger:** *"Looking only at the answer below, reconstruct the question that would produce this answer. List every condition, constraint, and piece of information the question must have contained."*
|
|
29
|
+
|
|
30
|
+
### Condition Cross-Check
|
|
31
|
+
**Purpose:** Compare the reconstructed question's conditions against the actual question's conditions. List any conditions that: appear in the actual question but not the reconstruction (overlooked), appear in the reconstruction but not the actual question (assumed/hallucinated), or are present in both but interpreted differently.
|
|
32
|
+
|
|
33
|
+
### Correction
|
|
34
|
+
**Purpose:** Feed the identified discrepancies back to the model to generate a corrected answer that addresses what was missed.
|
|
35
|
+
|
|
36
|
+
## Template Structure
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
STEP 1 — INITIAL ANSWER:
|
|
40
|
+
Answer the following question using step-by-step reasoning.
|
|
41
|
+
Show your work.
|
|
42
|
+
|
|
43
|
+
QUESTION: [Your question]
|
|
44
|
+
|
|
45
|
+
STEP 2 — QUESTION RECONSTRUCTION:
|
|
46
|
+
Looking only at the answer above (ignore the original question),
|
|
47
|
+
reconstruct the question that would produce this answer.
|
|
48
|
+
List every condition, constraint, and piece of information
|
|
49
|
+
the question must have contained.
|
|
50
|
+
|
|
51
|
+
RECONSTRUCTED QUESTION: [AI generates this]
|
|
52
|
+
|
|
53
|
+
STEP 3 — CROSS-CHECK:
|
|
54
|
+
Now compare the reconstructed question to the original question.
|
|
55
|
+
Identify:
|
|
56
|
+
- Conditions in the ORIGINAL question but MISSING from your reconstruction
|
|
57
|
+
(these are conditions you overlooked in your reasoning)
|
|
58
|
+
- Conditions in your RECONSTRUCTION but NOT in the original question
|
|
59
|
+
(these are assumptions you made that weren't stated)
|
|
60
|
+
- Conditions present in both but interpreted differently
|
|
61
|
+
|
|
62
|
+
STEP 4 — CORRECTION:
|
|
63
|
+
If discrepancies were found, generate a corrected answer that addresses
|
|
64
|
+
every condition in the original question. If no discrepancies, confirm
|
|
65
|
+
the original answer is correct.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Complete Examples
|
|
69
|
+
|
|
70
|
+
### Example 1: Multi-Condition Logic Problem
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
STEP 1 — INITIAL ANSWER:
|
|
74
|
+
A company has 3 departments: Engineering, Marketing, and Sales.
|
|
75
|
+
Engineering has 2x as many employees as Marketing.
|
|
76
|
+
Sales has 5 fewer employees than Engineering.
|
|
77
|
+
Marketing has 10 employees.
|
|
78
|
+
How many total employees does the company have?
|
|
79
|
+
|
|
80
|
+
Show your reasoning step by step.
|
|
81
|
+
|
|
82
|
+
STEP 2 — QUESTION RECONSTRUCTION:
|
|
83
|
+
Given only this answer: "45 employees total"
|
|
84
|
+
What conditions must the question have contained?
|
|
85
|
+
List every constraint implied by this answer.
|
|
86
|
+
|
|
87
|
+
STEP 3 — CROSS-CHECK:
|
|
88
|
+
Compare your reconstructed conditions to the actual question.
|
|
89
|
+
What did you overlook? What did you assume that wasn't stated?
|
|
90
|
+
|
|
91
|
+
STEP 4 — CORRECTION:
|
|
92
|
+
If your cross-check found discrepancies, recalculate with all
|
|
93
|
+
conditions properly applied.
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Example 2: Complex Requirement Analysis
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
STEP 1:
|
|
100
|
+
Given these requirements: [paste requirements]
|
|
101
|
+
Which of the following implementation approaches satisfies all of them?
|
|
102
|
+
[List options]
|
|
103
|
+
|
|
104
|
+
[AI generates initial recommendation]
|
|
105
|
+
|
|
106
|
+
STEP 2 — RECONSTRUCTION:
|
|
107
|
+
Looking only at the recommendation above, reconstruct the requirements
|
|
108
|
+
that must have been in the original question.
|
|
109
|
+
|
|
110
|
+
STEP 3 — CROSS-CHECK:
|
|
111
|
+
Compare your reconstructed requirements to the actual requirements above.
|
|
112
|
+
Which requirements did you not account for in your recommendation?
|
|
113
|
+
|
|
114
|
+
STEP 4 — CORRECTION:
|
|
115
|
+
Update the recommendation to satisfy the overlooked requirements.
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Example 3: Multi-Step Technical Analysis
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
STEP 1:
|
|
122
|
+
[Complex technical question with multiple constraints]
|
|
123
|
+
Analyze and recommend an approach.
|
|
124
|
+
|
|
125
|
+
[AI generates initial analysis]
|
|
126
|
+
|
|
127
|
+
STEP 2 — RECONSTRUCTION:
|
|
128
|
+
From the analysis above only, list every constraint and requirement
|
|
129
|
+
the original question must have specified.
|
|
130
|
+
|
|
131
|
+
STEP 3 — CROSS-CHECK:
|
|
132
|
+
Compare against the actual question. What was overlooked?
|
|
133
|
+
What was assumed without basis?
|
|
134
|
+
|
|
135
|
+
STEP 4 — CORRECTION:
|
|
136
|
+
Revise the analysis to address everything found in Step 3.
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Abbreviated Version (Single Prompt)
|
|
140
|
+
|
|
141
|
+
For simpler use cases, collapse all steps into one compound prompt:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
Answer the following question step by step: [QUESTION]
|
|
145
|
+
|
|
146
|
+
Then, working only from your answer (not re-reading the question),
|
|
147
|
+
reconstruct what the question must have contained.
|
|
148
|
+
|
|
149
|
+
Compare your reconstruction to the actual question. Identify any
|
|
150
|
+
conditions you overlooked or misinterpreted.
|
|
151
|
+
|
|
152
|
+
If discrepancies exist, provide a corrected answer.
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Best Use Cases
|
|
156
|
+
|
|
157
|
+
1. **Multi-Condition Logic Problems**
|
|
158
|
+
- Questions with several constraints that must all be satisfied
|
|
159
|
+
- Eligibility determination, scheduling, constraint satisfaction
|
|
160
|
+
|
|
161
|
+
2. **Complex Technical Requirements**
|
|
162
|
+
- Architecture decisions with multiple requirements
|
|
163
|
+
- Code that must satisfy several constraints simultaneously
|
|
164
|
+
|
|
165
|
+
3. **Legal/Financial/Medical Analysis**
|
|
166
|
+
- Multi-clause documents where missing one condition is costly
|
|
167
|
+
- Any domain where overlooked conditions cause errors
|
|
168
|
+
|
|
169
|
+
4. **Verification Layer in Pipelines**
|
|
170
|
+
- Add RCoT as a verification step after any complex reasoning
|
|
171
|
+
- Especially useful before high-stakes decisions
|
|
172
|
+
|
|
173
|
+
## Selection Criteria
|
|
174
|
+
|
|
175
|
+
**Choose RCoT when:**
|
|
176
|
+
- ✅ The question has multiple conditions/constraints that could be overlooked
|
|
177
|
+
- ✅ You want to verify that reasoning addressed everything
|
|
178
|
+
- ✅ Previous answers to similar questions have missed conditions
|
|
179
|
+
- ✅ Domain is high-stakes and overlooked conditions are costly
|
|
180
|
+
|
|
181
|
+
**Avoid when:**
|
|
182
|
+
- ❌ Simple question with one condition → overhead not worth it
|
|
183
|
+
- ❌ Verification needs involve factual accuracy → CRITIC (tool-grounded) is better
|
|
184
|
+
- ❌ Arithmetic verification → PS+ or explicit calculation check is faster
|
|
185
|
+
- ❌ Creative or generative task → no "conditions to miss"
|
|
186
|
+
|
|
187
|
+
## RCoT vs. Other Reasoning Frameworks
|
|
188
|
+
|
|
189
|
+
| | RCoT | Chain of Thought | Plan-and-Solve | Step-Back |
|
|
190
|
+
|---|---|---|---|---|
|
|
191
|
+
| Direction | Forward then backward (verification) | Forward only | Forward with planning | Abstract then forward |
|
|
192
|
+
| Best for | Catching overlooked conditions | Linear reasoning | Numerical calculation | Principle-grounded reasoning |
|
|
193
|
+
| Adds | Verification pass | None | Planning + variable extraction | Abstraction step |
|
|
194
|
+
| Failure mode | Doesn't catch hallucinations | Errors compound | Still needs correct variables | Step-back too vague |
|
|
195
|
+
|
|
196
|
+
## Quick Reference
|
|
197
|
+
|
|
198
|
+
| Step | Purpose |
|
|
199
|
+
|------|---------|
|
|
200
|
+
| Initial Answer | Generate reasoning (forward) |
|
|
201
|
+
| Reconstruction | "What question produced this?" (backward) |
|
|
202
|
+
| Cross-Check | Compare conditions: original vs. reconstructed |
|
|
203
|
+
| Correction | Fix what was overlooked or misinterpreted |
|