@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.
Files changed (76) hide show
  1. package/.claude-plugin/marketplace.json +20 -0
  2. package/.claude-plugin/plugin.json +18 -0
  3. package/CHANGELOG.md +264 -0
  4. package/LICENSE +21 -0
  5. package/MIGRATION.md +66 -0
  6. package/README.md +1184 -0
  7. package/adapters/README.md +267 -0
  8. package/adapters/for-cursor.mdc +138 -0
  9. package/adapters/for-gemini-cli.md +70 -0
  10. package/adapters/for-github-copilot.md +141 -0
  11. package/adapters/for-openai-codex-cli.md +158 -0
  12. package/adapters/for-windsurf.md +136 -0
  13. package/adapters/system-prompt.md +243 -0
  14. package/package.json +135 -0
  15. package/scripts/install.js +490 -0
  16. package/scripts/test.js +213 -0
  17. package/scripts/validate-skill.js +350 -0
  18. package/skills/prompt-architect/SKILL.md +331 -0
  19. package/skills/prompt-architect/assets/templates/ape_template.txt +5 -0
  20. package/skills/prompt-architect/assets/templates/bab_template.txt +15 -0
  21. package/skills/prompt-architect/assets/templates/broke_template.txt +15 -0
  22. package/skills/prompt-architect/assets/templates/cai-critique-revise_template.txt +18 -0
  23. package/skills/prompt-architect/assets/templates/care_template.txt +16 -0
  24. package/skills/prompt-architect/assets/templates/chain-of-density_template.txt +46 -0
  25. package/skills/prompt-architect/assets/templates/chain-of-thought_template.txt +49 -0
  26. package/skills/prompt-architect/assets/templates/co-star_template.txt +17 -0
  27. package/skills/prompt-architect/assets/templates/crispe_template.txt +14 -0
  28. package/skills/prompt-architect/assets/templates/ctf_template.txt +15 -0
  29. package/skills/prompt-architect/assets/templates/devils-advocate_template.txt +25 -0
  30. package/skills/prompt-architect/assets/templates/hybrid_template.txt +101 -0
  31. package/skills/prompt-architect/assets/templates/least-to-most_template.txt +16 -0
  32. package/skills/prompt-architect/assets/templates/plan-and-solve_template.txt +7 -0
  33. package/skills/prompt-architect/assets/templates/pre-mortem_template.txt +27 -0
  34. package/skills/prompt-architect/assets/templates/race_template.txt +19 -0
  35. package/skills/prompt-architect/assets/templates/rcot_template.txt +31 -0
  36. package/skills/prompt-architect/assets/templates/react_template.txt +27 -0
  37. package/skills/prompt-architect/assets/templates/reverse-role_template.txt +11 -0
  38. package/skills/prompt-architect/assets/templates/rise-ie_template.txt +23 -0
  39. package/skills/prompt-architect/assets/templates/rise-ix_template.txt +28 -0
  40. package/skills/prompt-architect/assets/templates/risen_template.txt +21 -0
  41. package/skills/prompt-architect/assets/templates/rpef_template.txt +26 -0
  42. package/skills/prompt-architect/assets/templates/rtf_template.txt +13 -0
  43. package/skills/prompt-architect/assets/templates/self-refine_template.txt +16 -0
  44. package/skills/prompt-architect/assets/templates/skeleton-of-thought_template.txt +15 -0
  45. package/skills/prompt-architect/assets/templates/step-back_template.txt +10 -0
  46. package/skills/prompt-architect/assets/templates/tidd-ec_template.txt +45 -0
  47. package/skills/prompt-architect/assets/templates/tree-of-thought_template.txt +30 -0
  48. package/skills/prompt-architect/references/frameworks/ape.md +200 -0
  49. package/skills/prompt-architect/references/frameworks/bab.md +242 -0
  50. package/skills/prompt-architect/references/frameworks/broke.md +242 -0
  51. package/skills/prompt-architect/references/frameworks/cai-critique-revise.md +230 -0
  52. package/skills/prompt-architect/references/frameworks/care.md +235 -0
  53. package/skills/prompt-architect/references/frameworks/chain-of-density.md +479 -0
  54. package/skills/prompt-architect/references/frameworks/chain-of-thought.md +424 -0
  55. package/skills/prompt-architect/references/frameworks/co-star.md +256 -0
  56. package/skills/prompt-architect/references/frameworks/crispe.md +253 -0
  57. package/skills/prompt-architect/references/frameworks/ctf.md +207 -0
  58. package/skills/prompt-architect/references/frameworks/devils-advocate.md +206 -0
  59. package/skills/prompt-architect/references/frameworks/least-to-most.md +226 -0
  60. package/skills/prompt-architect/references/frameworks/plan-and-solve.md +210 -0
  61. package/skills/prompt-architect/references/frameworks/pre-mortem.md +197 -0
  62. package/skills/prompt-architect/references/frameworks/race.md +243 -0
  63. package/skills/prompt-architect/references/frameworks/rcot.md +203 -0
  64. package/skills/prompt-architect/references/frameworks/react.md +304 -0
  65. package/skills/prompt-architect/references/frameworks/reverse-role.md +189 -0
  66. package/skills/prompt-architect/references/frameworks/rise.md +555 -0
  67. package/skills/prompt-architect/references/frameworks/risen.md +297 -0
  68. package/skills/prompt-architect/references/frameworks/rpef.md +195 -0
  69. package/skills/prompt-architect/references/frameworks/rtf.md +358 -0
  70. package/skills/prompt-architect/references/frameworks/self-refine.md +205 -0
  71. package/skills/prompt-architect/references/frameworks/skeleton-of-thought.md +186 -0
  72. package/skills/prompt-architect/references/frameworks/step-back.md +206 -0
  73. package/skills/prompt-architect/references/frameworks/tidd-ec.md +470 -0
  74. package/skills/prompt-architect/references/frameworks/tree-of-thought.md +260 -0
  75. package/skills/prompt-architect/scripts/framework_analyzer.py +807 -0
  76. package/skills/prompt-architect/scripts/prompt_evaluator.py +336 -0
@@ -0,0 +1,186 @@
1
+ # Skeleton of Thought (SoT) Framework
2
+
3
+ ## Overview
4
+
5
+ Skeleton of Thought (SoT) is a two-phase framework that first generates a concise structural outline ("skeleton") of the answer, then expands each skeleton point — either sequentially or in parallel — into full content. It improves both output quality (by forcing upfront structure) and can dramatically reduce latency when expansion is done in parallel API calls.
6
+
7
+ **Research basis:** "Skeleton-of-Thought: Prompting LLMs for Efficient Parallel Generation" (Ning et al., Microsoft Research, arXiv:2307.15337, ICLR 2024). Demonstrated 2x+ speedup on 8 of 12 tested models with maintained or improved quality.
8
+
9
+ ## Components
10
+
11
+ ### Phase 1: Skeleton Generation
12
+ **Purpose:** Generate a concise, ordered list of the key points, sections, or sub-answers that will form the complete response. No expansion yet — just the bare bones.
13
+
14
+ **Trigger prompt:**
15
+ ```
16
+ You're an organizer of responses. Please provide me with a one-line point outline
17
+ of [topic/question] without any explanation. Your outline must be:
18
+ X. [brief point name] | [one-line description]
19
+ ```
20
+
21
+ ### Phase 2: Point Expansion
22
+ **Purpose:** Expand each skeleton point into full content. Each point is independent and can be expanded in isolation (enabling parallelism).
23
+
24
+ **Trigger prompt per point:**
25
+ ```
26
+ Please expand on the following point in 3-5 sentences:
27
+ Point X: [point name] — [one-line description]
28
+ ```
29
+
30
+ ### SoT-R Variant (Router)
31
+ **Purpose:** Adds a routing step before Phase 1. If the question is NOT suitable for SoT (e.g., requires continuous prose, math derivation, or linear reasoning), the router falls back to standard generation.
32
+
33
+ **Not suitable for SoT:** Mathematical proofs, code that must flow sequentially, narrative story, continuous logical arguments where each step depends on the last.
34
+
35
+ ## Template Structure
36
+
37
+ ```
38
+ PHASE 1 — SKELETON:
39
+ Generate a skeleton outline for the following question. List only key points,
40
+ one per line, in the format: [number]. [Point name] | [One-sentence description].
41
+ Do not expand yet.
42
+
43
+ QUESTION/TOPIC:
44
+ [Your question or topic]
45
+
46
+ PHASE 2 — EXPAND:
47
+ Now expand each point into [2-4 sentences / a paragraph / detailed explanation].
48
+ Each point should be self-contained and complete.
49
+
50
+ [Optional: expand points in parallel by sending each as a separate request]
51
+ ```
52
+
53
+ ### Minimal Single-Pass SoT
54
+ For use in a single prompt when parallel API calls aren't available:
55
+ ```
56
+ First, create a brief skeleton outline of [topic] (one line per point).
57
+ Then, expand each skeleton point into [length/detail level].
58
+ Present as: Skeleton → then Full Expansion.
59
+ ```
60
+
61
+ ## Complete Examples
62
+
63
+ ### Example 1: Technical Explanation
64
+
65
+ **Before SoT:**
66
+ "Explain microservices architecture."
67
+
68
+ **After SoT:**
69
+ ```
70
+ PHASE 1 — SKELETON:
71
+ Create a skeleton outline for explaining microservices architecture to a
72
+ senior engineer evaluating whether to migrate from a monolith. List 5-7 key
73
+ points in format: N. [name] | [one-sentence description]. Do not expand.
74
+
75
+ PHASE 2 — EXPAND:
76
+ Expand each skeleton point into 2-3 paragraphs. Each section should be
77
+ self-contained. Include specific trade-offs relevant to a migration decision.
78
+ ```
79
+
80
+ **Skeleton output (Phase 1):**
81
+ ```
82
+ 1. Core concept | Each service owns one business capability and runs independently
83
+ 2. Service boundaries | How to decompose a monolith into services without creating distributed spaghetti
84
+ 3. Communication patterns | Sync (REST/gRPC) vs async (events) and when each applies
85
+ 4. Data ownership | Each service owns its database; consequences for queries and consistency
86
+ 5. Operational complexity | What microservices add: service mesh, CI per service, distributed tracing
87
+ 6. Migration strategy | Strangler fig vs. big-bang; risk profile of each
88
+ 7. When NOT to use | Scale thresholds below which microservices create more problems than they solve
89
+ ```
90
+
91
+ **Expansion (Phase 2, point 6):**
92
+ ```
93
+ Migration Strategy: The strangler fig pattern incrementally wraps the monolith
94
+ by routing new traffic to microservices while the legacy system handles the rest.
95
+ This allows parallel operation and rollback if needed, making it the lower-risk
96
+ option for most teams. The big-bang rewrite is faster in theory but carries high
97
+ risk of scope creep, integration failures, and a multi-month feature freeze...
98
+ ```
99
+
100
+ ### Example 2: Structured Report
101
+
102
+ **Before SoT:**
103
+ "Write a competitive analysis of our product vs. competitors."
104
+
105
+ **After SoT:**
106
+ ```
107
+ PHASE 1 — SKELETON:
108
+ Create a skeleton for a competitive analysis covering our product vs. [Competitor A]
109
+ and [Competitor B]. List 6-8 comparison dimensions in format:
110
+ N. [dimension] | [what to compare]. Do not write the analysis yet.
111
+
112
+ PHASE 2 — EXPAND:
113
+ For each dimension, write 1 paragraph analyzing how our product compares on that
114
+ dimension. Include specific, concrete observations. Flag any dimension where we
115
+ have a clear advantage or significant gap.
116
+ ```
117
+
118
+ ### Example 3: Learning Content
119
+
120
+ **Before SoT:**
121
+ "Explain how React hooks work."
122
+
123
+ **After SoT (single-pass):**
124
+ ```
125
+ First, create a 5-7 point skeleton outline of the key concepts needed to
126
+ understand React hooks (for a developer who knows JavaScript but is new to React).
127
+ Format: N. [concept] | [one sentence]
128
+
129
+ Then expand each skeleton point into 1-2 paragraphs with a code example where relevant.
130
+ Show: skeleton first, then full expansion.
131
+ ```
132
+
133
+ ## Best Use Cases
134
+
135
+ 1. **Structured Explanations**
136
+ - Technical docs
137
+ - Tutorial content
138
+ - Concept breakdowns
139
+
140
+ 2. **Long-Form Content Where Structure Matters**
141
+ - Reports and analyses
142
+ - Documentation sections
143
+ - Comparative content
144
+
145
+ 3. **When Parallel Generation is Available**
146
+ - API workflows where each skeleton point can be expanded concurrently
147
+ - Systems requiring minimum latency
148
+ - Batch content generation
149
+
150
+ 4. **Improving Output Organization**
151
+ - When prose responses tend to meander
152
+ - When you need consistent structure across multiple outputs
153
+ - When you want to review/approve structure before full generation
154
+
155
+ ## Selection Criteria
156
+
157
+ **Choose SoT when:**
158
+ - ✅ Output has multiple semi-independent sections
159
+ - ✅ You want to validate structure before full generation
160
+ - ✅ Parallel expansion would reduce latency
161
+ - ✅ Content organization is a primary concern
162
+ - ✅ Multiple similar documents need consistent structure
163
+
164
+ **Avoid SoT when:**
165
+ - ❌ Answer requires continuous linear reasoning → use Chain of Thought
166
+ - ❌ Mathematical proof or derivation → use Plan-and-Solve or CoT
167
+ - ❌ Narrative that flows as a whole → use CO-STAR
168
+ - ❌ Simple, short answer → use APE or RTF
169
+ - ❌ Each section depends on the previous → use Least-to-Most
170
+
171
+ ## SoT vs. Other Frameworks
172
+
173
+ | | SoT | Chain of Thought | RISEN | CO-STAR |
174
+ |---|---|---|---|---|
175
+ | Structure | Skeleton → expansion | Linear steps | Methodology-driven | Audience/context-driven |
176
+ | Parallelizable | Yes | No | No | No |
177
+ | Best for | Structured multi-section content | Reasoning | Complex procedures | Writing |
178
+ | Shows work | Structure only | Reasoning steps | Process | N/A |
179
+
180
+ ## Quick Reference
181
+
182
+ | Phase | Purpose | Key Question |
183
+ |-------|---------|--------------|
184
+ | Skeleton | Structure first | "What are the key points?" |
185
+ | Expansion | Fill each point | "What does each point contain?" |
186
+ | Router (SoT-R) | Appropriateness check | "Is this suitable for SoT?" |
@@ -0,0 +1,206 @@
1
+ # Step-Back Prompting
2
+
3
+ ## Overview
4
+
5
+ Step-Back Prompting is a two-step reasoning technique where the model first answers a higher-level "step-back" question that retrieves the underlying principles, concepts, or facts relevant to the original problem — then uses those retrieved principles as context to answer the original question. By abstracting first, the model grounds its reasoning in first principles rather than diving directly into a potentially error-prone specific answer.
6
+
7
+ **Research basis:** "Take a Step Back: Evoking Reasoning via Abstraction in Large Language Models" (Zheng et al., Google DeepMind, arXiv:2310.06117, ICLR 2024). Demonstrated +7-27% accuracy on MMLU Physics and Chemistry, +27% on TimeQA, +25% on MuSiQue vs. direct prompting.
8
+
9
+ ## Components
10
+
11
+ ### Step 1: The Step-Back Question
12
+ **Purpose:** Reformulate the original question into a higher-level, more abstract question that retrieves the underlying principles or concepts needed.
13
+
14
+ **Pattern:** Strip away specifics → ask for the general principle/rule/concept.
15
+
16
+ **Examples:**
17
+ - Original: "What happens to water pressure at 100m depth in salt water?" → Step-back: "What are the physics principles governing fluid pressure?"
18
+ - Original: "How should I structure a React component that fetches user data?" → Step-back: "What are the principles of separation of concerns in React component design?"
19
+ - Original: "Was the Battle of Stalingrad a turning point?" → Step-back: "What factors define a military turning point in a campaign?"
20
+
21
+ ### Step 2: Principle Retrieval
22
+ **Purpose:** Answer the step-back question to retrieve the relevant principles/concepts/facts. This becomes the reasoning context.
23
+
24
+ ### Step 3: Final Answer
25
+ **Purpose:** Use the retrieved principles as context to answer the original specific question.
26
+
27
+ **Trigger:** "Based on these principles, now answer the original question: [original question]"
28
+
29
+ ## Template Structure
30
+
31
+ ```
32
+ ORIGINAL QUESTION:
33
+ [The specific question you want answered]
34
+
35
+ STEP-BACK:
36
+ Before answering directly, first answer this higher-level question:
37
+ [Step-back question — the abstract principle/concept behind the original]
38
+
39
+ PRINCIPLE APPLICATION:
40
+ Using the principles/concepts you just described, now answer the original question:
41
+ [Restate original question]
42
+ ```
43
+
44
+ ### Auto Step-Back (Model generates its own step-back question):
45
+ ```
46
+ Before answering the following question, first identify the underlying
47
+ principles or concepts that govern it. State those principles clearly.
48
+ Then use them as a foundation to answer the specific question.
49
+
50
+ Question: [your question]
51
+ ```
52
+
53
+ ## Complete Examples
54
+
55
+ ### Example 1: Technical Decision
56
+
57
+ **Before Step-Back:**
58
+ "Should I use PostgreSQL or MongoDB for a social feed application?"
59
+
60
+ **After Step-Back:**
61
+ ```
62
+ ORIGINAL QUESTION:
63
+ Should I use PostgreSQL or MongoDB for a social feed application?
64
+
65
+ STEP-BACK:
66
+ Before answering, first answer: What are the core principles that govern
67
+ database selection for applications requiring feed-style queries, social graphs,
68
+ and high read throughput? Consider data model fit, query patterns, and
69
+ consistency requirements.
70
+
71
+ PRINCIPLE APPLICATION:
72
+ Using those principles, now evaluate: should I use PostgreSQL or MongoDB
73
+ for a social feed application where users follow other users, see a ranked
74
+ feed of posts, and can like/comment?
75
+ ```
76
+
77
+ ### Example 2: Debugging
78
+
79
+ **Before Step-Back:**
80
+ "Why does my async function return undefined when I call it?"
81
+
82
+ **After Step-Back:**
83
+ ```
84
+ ORIGINAL QUESTION:
85
+ Why does my async function return undefined when I call it?
86
+
87
+ STEP-BACK:
88
+ First explain: What are the core principles of how JavaScript async/await
89
+ works, specifically regarding what an async function returns and how callers
90
+ must handle it?
91
+
92
+ PRINCIPLE APPLICATION:
93
+ Using those principles, diagnose this specific issue: [paste code].
94
+ Why does this return undefined, and what is the fix?
95
+ ```
96
+
97
+ ### Example 3: Architecture Review
98
+
99
+ **Before Step-Back:**
100
+ "Is our current authentication flow secure?"
101
+
102
+ **After Step-Back:**
103
+ ```
104
+ ORIGINAL QUESTION:
105
+ Is our current authentication flow secure?
106
+
107
+ STEP-BACK:
108
+ Before reviewing our specific implementation, first outline: What are the
109
+ fundamental security principles and threat models that a well-designed
110
+ authentication flow must address? Include: credential handling, session
111
+ management, token security, and common attack vectors.
112
+
113
+ PRINCIPLE APPLICATION:
114
+ Using those security principles as a checklist, review our authentication
115
+ flow below and identify any gaps or vulnerabilities.
116
+ [Paste authentication flow]
117
+ ```
118
+
119
+ ### Example 4: Content/Writing
120
+
121
+ **Before Step-Back:**
122
+ "Write an introduction for my article about climate change and agriculture."
123
+
124
+ **After Step-Back:**
125
+ ```
126
+ ORIGINAL QUESTION:
127
+ Write an introduction for my article about climate change and agriculture.
128
+
129
+ STEP-BACK:
130
+ First answer: What are the rhetorical principles of an effective article
131
+ introduction? What should it accomplish, and what structural elements
132
+ make introductions work?
133
+
134
+ PRINCIPLE APPLICATION:
135
+ Using those principles, write an introduction for an article about how
136
+ climate change is disrupting agricultural yield patterns globally.
137
+ Target audience: policy-informed general readers. Goal: create urgency
138
+ without alarmism.
139
+ ```
140
+
141
+ ## Best Use Cases
142
+
143
+ 1. **STEM Reasoning**
144
+ - Physics, chemistry, math problems
145
+ - Engineering trade-offs
146
+ - Scientific analysis
147
+
148
+ 2. **Technical Decision-Making**
149
+ - Architecture and design choices
150
+ - Technology selection
151
+ - Security analysis
152
+
153
+ 3. **Historical and Causal Analysis**
154
+ - Evaluating decisions and their consequences
155
+ - Understanding complex events
156
+ - Root cause analysis
157
+
158
+ 4. **Complex Debugging**
159
+ - When the specific error needs first-principles understanding
160
+ - Novel or unclear failure modes
161
+
162
+ 5. **Any Task Where Principles Matter More Than Pattern-Matching**
163
+
164
+ ## Selection Criteria
165
+
166
+ **Choose Step-Back when:**
167
+ - ✅ Task requires principled reasoning, not just recall
168
+ - ✅ Direct answers tend to be shallow or incorrect
169
+ - ✅ Underlying principles are known and applicable
170
+ - ✅ The question is specific but has a generalizable foundation
171
+ - ✅ Errors in past attempts suggest lack of principled grounding
172
+
173
+ **Avoid Step-Back when:**
174
+ - ❌ Task is straightforward and factual — overhead not worth it → use APE or RTF
175
+ - ❌ Content creation (no abstract principle needed) → use CO-STAR or BAB
176
+ - ❌ Already reasoning step-by-step → CoT may suffice
177
+ - ❌ The principle is unknowable or irrelevant
178
+
179
+ ## Step-Back vs. Chain of Thought
180
+
181
+ | | Step-Back | Chain of Thought |
182
+ |---|---|---|
183
+ | Direction | Abstract → Specific | Step 1 → Step 2 → ... → Answer |
184
+ | Starting point | Higher-level principle | The problem itself |
185
+ | Best for | Principle-grounded reasoning | Known procedure, sequential steps |
186
+ | Failure mode | Step-back question too vague | Errors compound through chain |
187
+
188
+ **Rule of thumb:** If the question has a known procedure → CoT. If the question requires first-principles reasoning → Step-Back.
189
+
190
+ ## Generating Good Step-Back Questions
191
+
192
+ **Pattern:** Remove specifics → ask for the governing rule/principle
193
+
194
+ | Original (Specific) | Step-Back (Abstract) |
195
+ |---|---|
196
+ | "What happens when thread A and thread B access shared memory?" | "What are the principles of memory consistency in concurrent programming?" |
197
+ | "How should I price my SaaS product?" | "What are the principles of value-based pricing for B2B software?" |
198
+ | "Was this code change the cause of our performance regression?" | "What are the principles for diagnosing performance regressions in production systems?" |
199
+
200
+ ## Quick Reference
201
+
202
+ | Step | Purpose | Key Question |
203
+ |------|---------|--------------|
204
+ | Step-Back Question | Abstract the problem | "What principle governs this?" |
205
+ | Principle Retrieval | Get the foundation | "What are the rules?" |
206
+ | Final Answer | Apply principles to specifics | "Given these principles, what's the answer?" |