@ckelsoe/prompt-architect 3.0.2 → 3.1.1

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 +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +264 -264
  4. package/LICENSE +21 -21
  5. package/README.md +1064 -1184
  6. package/adapters/README.md +75 -267
  7. package/adapters/for-windsurf.md +136 -136
  8. package/adapters/system-prompt.md +243 -243
  9. package/package.json +139 -138
  10. package/scripts/build-skill.js +64 -0
  11. package/scripts/install.js +4 -54
  12. package/scripts/test.js +205 -213
  13. package/scripts/validate-skill.js +350 -350
  14. package/skills/prompt-architect/SKILL.md +331 -331
  15. package/skills/prompt-architect/assets/templates/ape_template.txt +5 -5
  16. package/skills/prompt-architect/assets/templates/bab_template.txt +15 -15
  17. package/skills/prompt-architect/assets/templates/broke_template.txt +15 -15
  18. package/skills/prompt-architect/assets/templates/cai-critique-revise_template.txt +18 -18
  19. package/skills/prompt-architect/assets/templates/care_template.txt +16 -16
  20. package/skills/prompt-architect/assets/templates/chain-of-density_template.txt +46 -46
  21. package/skills/prompt-architect/assets/templates/chain-of-thought_template.txt +49 -49
  22. package/skills/prompt-architect/assets/templates/co-star_template.txt +17 -17
  23. package/skills/prompt-architect/assets/templates/crispe_template.txt +14 -14
  24. package/skills/prompt-architect/assets/templates/ctf_template.txt +15 -15
  25. package/skills/prompt-architect/assets/templates/devils-advocate_template.txt +25 -25
  26. package/skills/prompt-architect/assets/templates/hybrid_template.txt +101 -101
  27. package/skills/prompt-architect/assets/templates/least-to-most_template.txt +16 -16
  28. package/skills/prompt-architect/assets/templates/plan-and-solve_template.txt +7 -7
  29. package/skills/prompt-architect/assets/templates/pre-mortem_template.txt +27 -27
  30. package/skills/prompt-architect/assets/templates/race_template.txt +19 -19
  31. package/skills/prompt-architect/assets/templates/rcot_template.txt +31 -31
  32. package/skills/prompt-architect/assets/templates/react_template.txt +27 -27
  33. package/skills/prompt-architect/assets/templates/reverse-role_template.txt +11 -11
  34. package/skills/prompt-architect/assets/templates/rise-ie_template.txt +23 -23
  35. package/skills/prompt-architect/assets/templates/rise-ix_template.txt +28 -28
  36. package/skills/prompt-architect/assets/templates/risen_template.txt +21 -21
  37. package/skills/prompt-architect/assets/templates/rpef_template.txt +26 -26
  38. package/skills/prompt-architect/assets/templates/rtf_template.txt +13 -13
  39. package/skills/prompt-architect/assets/templates/self-refine_template.txt +16 -16
  40. package/skills/prompt-architect/assets/templates/skeleton-of-thought_template.txt +15 -15
  41. package/skills/prompt-architect/assets/templates/step-back_template.txt +10 -10
  42. package/skills/prompt-architect/assets/templates/tidd-ec_template.txt +45 -45
  43. package/skills/prompt-architect/assets/templates/tree-of-thought_template.txt +30 -30
  44. package/skills/prompt-architect/references/frameworks/ape.md +200 -200
  45. package/skills/prompt-architect/references/frameworks/bab.md +242 -242
  46. package/skills/prompt-architect/references/frameworks/broke.md +242 -242
  47. package/skills/prompt-architect/references/frameworks/cai-critique-revise.md +230 -230
  48. package/skills/prompt-architect/references/frameworks/care.md +235 -235
  49. package/skills/prompt-architect/references/frameworks/chain-of-density.md +479 -479
  50. package/skills/prompt-architect/references/frameworks/chain-of-thought.md +424 -424
  51. package/skills/prompt-architect/references/frameworks/co-star.md +256 -256
  52. package/skills/prompt-architect/references/frameworks/crispe.md +253 -253
  53. package/skills/prompt-architect/references/frameworks/ctf.md +207 -207
  54. package/skills/prompt-architect/references/frameworks/devils-advocate.md +206 -206
  55. package/skills/prompt-architect/references/frameworks/least-to-most.md +226 -226
  56. package/skills/prompt-architect/references/frameworks/plan-and-solve.md +210 -210
  57. package/skills/prompt-architect/references/frameworks/pre-mortem.md +197 -197
  58. package/skills/prompt-architect/references/frameworks/race.md +243 -243
  59. package/skills/prompt-architect/references/frameworks/rcot.md +203 -203
  60. package/skills/prompt-architect/references/frameworks/react.md +304 -304
  61. package/skills/prompt-architect/references/frameworks/reverse-role.md +189 -189
  62. package/skills/prompt-architect/references/frameworks/rise.md +555 -555
  63. package/skills/prompt-architect/references/frameworks/risen.md +297 -297
  64. package/skills/prompt-architect/references/frameworks/rpef.md +195 -195
  65. package/skills/prompt-architect/references/frameworks/rtf.md +358 -358
  66. package/skills/prompt-architect/references/frameworks/self-refine.md +205 -205
  67. package/skills/prompt-architect/references/frameworks/skeleton-of-thought.md +186 -186
  68. package/skills/prompt-architect/references/frameworks/step-back.md +206 -206
  69. package/skills/prompt-architect/references/frameworks/tidd-ec.md +470 -470
  70. package/skills/prompt-architect/references/frameworks/tree-of-thought.md +260 -260
  71. package/skills/prompt-architect/scripts/framework_analyzer.py +807 -807
  72. package/skills/prompt-architect/scripts/prompt_evaluator.py +336 -336
  73. package/adapters/for-cursor.mdc +0 -138
  74. package/adapters/for-gemini-cli.md +0 -70
  75. package/adapters/for-github-copilot.md +0 -141
  76. package/adapters/for-openai-codex-cli.md +0 -158
@@ -1,205 +1,205 @@
1
- # Self-Refine Framework
2
-
3
- ## Overview
4
-
5
- Self-Refine is an iterative output improvement framework where a single model acts as its own generator, critic, and refiner — with no external training, no additional models, and no labeled data required. The core loop: generate an initial output → produce specific, actionable feedback → refine using that feedback → repeat until a stopping criterion is met.
6
-
7
- **Research basis:** "Self-Refine: Iterative Refinement with Self-Feedback" (Madaan et al., arXiv 2303.17651, NeurIPS 2023). Tested across 7 task types — improvement of 5-40% over single-pass generation from GPT-3.5 and GPT-4. Humans preferred Self-Refined outputs in blind evaluation. Project site: selfrefine.info.
8
-
9
- ## The Core Loop
10
-
11
- ```
12
- GENERATE → FEEDBACK → REFINE → [repeat] → STOP
13
- ```
14
-
15
- Each phase:
16
- 1. **Generate**: Produce an initial output (can be your first draft or AI-generated)
17
- 2. **Feedback**: Analyze the output for specific, actionable weaknesses across defined dimensions
18
- 3. **Refine**: Rewrite addressing every feedback point — with the feedback visible as context
19
- 4. **Stop**: When quality threshold met, max iterations reached, or feedback says "looks good"
20
-
21
- **Key insight:** Maintaining a history of previous outputs + feedback in context prevents regression and helps the model track progress across iterations.
22
-
23
- ## Components
24
-
25
- ### Initial Output
26
- **Purpose:** The starting point. Can be a first AI generation or something you've already written that needs improvement.
27
-
28
- ### Feedback Dimensions
29
- **Purpose:** The specific aspects to evaluate. Defining these explicitly produces much better critiques than asking for generic feedback.
30
-
31
- **Common dimensions by task type:**
32
- - **Code**: correctness, efficiency, readability, edge cases, error handling
33
- - **Writing**: clarity, structure, tone, specificity, conciseness, audience fit
34
- - **Reasoning**: logical validity, completeness, unsupported claims, missed considerations
35
- - **Plans/strategies**: feasibility, completeness, risks, measurability
36
-
37
- ### Refinement Instruction
38
- **Purpose:** Directs the model to rewrite addressing every feedback point, using the critique as a direct specification.
39
-
40
- ### Stop Condition
41
- **Purpose:** When to stop iterating. Options:
42
- - Fixed iterations (e.g., "run 2 refinement cycles")
43
- - Quality signal ("stop when feedback has no major issues")
44
- - Manual review (you decide when it's good enough)
45
-
46
- ## Template Structure
47
-
48
- ### Single Cycle (most common)
49
- ```
50
- INITIAL OUTPUT:
51
- [Paste the output to improve, or ask the AI to generate a first draft]
52
-
53
- FEEDBACK DIMENSIONS:
54
- Review the output above for:
55
- 1. [Dimension 1 — e.g., "Clarity: Is every sentence clear and unambiguous?"]
56
- 2. [Dimension 2 — e.g., "Completeness: What important points are missing?"]
57
- 3. [Dimension 3 — e.g., "Tone: Is the voice appropriate for the audience?"]
58
- 4. [Dimension 4 — add as needed]
59
-
60
- For each dimension: identify specific problems with quoted examples,
61
- explain why each is a problem, and suggest concrete improvements.
62
-
63
- REFINEMENT:
64
- Now rewrite the output addressing every point of your feedback.
65
- Show the refined version only (no commentary).
66
- ```
67
-
68
- ### Multi-Cycle with History
69
- ```
70
- ITERATION 1:
71
- [Generate initial output or paste existing]
72
-
73
- ITERATION 1 FEEDBACK:
74
- Analyze for [dimensions]. Be specific and actionable.
75
-
76
- ITERATION 2:
77
- Rewrite addressing all feedback above.
78
- [AI produces refined version]
79
-
80
- ITERATION 2 FEEDBACK:
81
- Analyze the refined version for any remaining issues.
82
-
83
- ITERATION 3 (if needed):
84
- Rewrite addressing remaining issues.
85
-
86
- STOP when feedback says "no major issues remaining."
87
- ```
88
-
89
- ### Self-Refine as a Single Compound Prompt
90
- ```
91
- TASK: [What you want to produce]
92
-
93
- GENERATE: Write an initial [output type] for the above.
94
-
95
- FEEDBACK: Review your output for: [dimension 1], [dimension 2], [dimension 3].
96
- List specific issues with quoted examples and concrete suggestions.
97
-
98
- REFINE: Rewrite addressing all feedback. Show only the final refined version.
99
- ```
100
-
101
- ## Complete Examples
102
-
103
- ### Example 1: Code Review and Improvement
104
-
105
- ```
106
- INITIAL OUTPUT:
107
- def get_user_data(user_id):
108
- db = connect_to_database()
109
- result = db.query(f"SELECT * FROM users WHERE id = {user_id}")
110
- return result
111
-
112
- FEEDBACK DIMENSIONS:
113
- Review for:
114
- 1. Security: Any injection vulnerabilities or unsafe patterns?
115
- 2. Error handling: What happens if the DB is unavailable or user doesn't exist?
116
- 3. Resource management: Are connections properly managed?
117
- 4. Code quality: Any Python best practices violations?
118
-
119
- REFINEMENT:
120
- Rewrite the function addressing all feedback points.
121
- ```
122
-
123
- ### Example 2: Writing Improvement
124
-
125
- ```
126
- INITIAL OUTPUT:
127
- [Paste a paragraph or email draft]
128
-
129
- FEEDBACK DIMENSIONS:
130
- Review for:
131
- 1. Clarity: Any sentences that are ambiguous or require re-reading?
132
- 2. Conciseness: What can be cut without losing meaning?
133
- 3. Opening: Does the first sentence earn the reader's attention?
134
- 4. Call to action: Is the desired reader action explicit and easy to take?
135
-
136
- REFINEMENT:
137
- Rewrite addressing every point. Match the original length or shorter.
138
- ```
139
-
140
- ### Example 3: Strategic Plan
141
-
142
- ```
143
- INITIAL OUTPUT:
144
- [Paste a strategy or plan]
145
-
146
- FEEDBACK DIMENSIONS:
147
- Review for:
148
- 1. Completeness: What important scenarios or stakeholders are not addressed?
149
- 2. Feasibility: Which actions assume resources or capabilities we may not have?
150
- 3. Measurability: Which outcomes have no defined success metric?
151
- 4. Risk: What's the biggest single point of failure?
152
-
153
- REFINEMENT:
154
- Revise the plan addressing all feedback. Add a risk mitigation note for the
155
- biggest single point of failure identified.
156
- ```
157
-
158
- ## Best Use Cases
159
-
160
- 1. **Any Output Quality Improvement**
161
- - Code, writing, plans, analysis, summaries
162
- - When the first draft is never the final draft
163
-
164
- 2. **Domain-Specific Quality Gates**
165
- - Code correctness + security
166
- - Medical/legal content accuracy
167
- - Brand voice compliance
168
-
169
- 3. **Iterative Document Refinement**
170
- - Proposals, reports, documentation
171
- - Any output where multiple review dimensions apply
172
-
173
- 4. **Self-QA Before Submitting**
174
- - Run Self-Refine before using any AI output in high-stakes contexts
175
-
176
- ## Selection Criteria
177
-
178
- **Choose Self-Refine when:**
179
- - ✅ You have an output that needs improvement
180
- - ✅ Multiple quality dimensions apply
181
- - ✅ The first pass is rarely final
182
- - ✅ You want systematic critique, not just vague "make it better"
183
-
184
- **Avoid when:**
185
- - ❌ You need a specific type of critique → use CAI Critique-Revise (principle-based) or Devil's Advocate (opposing argument)
186
- - ❌ Task is brand new (nothing to refine yet) → generate first, then Self-Refine
187
- - ❌ Simple task → direct prompt is faster
188
-
189
- ## Self-Refine vs. Similar Frameworks
190
-
191
- | | Self-Refine | CAI Critique-Revise | BAB | Chain of Density |
192
- |---|---|---|---|---|
193
- | Direction | Any output → improvement | Output vs. explicit principle | Before state → after state | Content → denser compression |
194
- | Critique type | Multi-dimensional quality | Principle-aligned alignment | Transformation rules | Density/information |
195
- | Iterations | Configurable loop | One cycle (or more) | Single transform | N passes |
196
- | Best for | General quality improvement | Alignment/compliance | Rewriting existing content | Summarization |
197
-
198
- ## Quick Reference
199
-
200
- | Phase | Purpose | Key Question |
201
- |-------|---------|--------------|
202
- | Generate | Initial output | "What's a first pass?" |
203
- | Feedback | Specific critique | "What's wrong and why?" |
204
- | Refine | Improved version | "Fix every problem found" |
205
- | Stop | Termination | "Is it good enough?" |
1
+ # Self-Refine Framework
2
+
3
+ ## Overview
4
+
5
+ Self-Refine is an iterative output improvement framework where a single model acts as its own generator, critic, and refiner — with no external training, no additional models, and no labeled data required. The core loop: generate an initial output → produce specific, actionable feedback → refine using that feedback → repeat until a stopping criterion is met.
6
+
7
+ **Research basis:** "Self-Refine: Iterative Refinement with Self-Feedback" (Madaan et al., arXiv 2303.17651, NeurIPS 2023). Tested across 7 task types — improvement of 5-40% over single-pass generation from GPT-3.5 and GPT-4. Humans preferred Self-Refined outputs in blind evaluation. Project site: selfrefine.info.
8
+
9
+ ## The Core Loop
10
+
11
+ ```
12
+ GENERATE → FEEDBACK → REFINE → [repeat] → STOP
13
+ ```
14
+
15
+ Each phase:
16
+ 1. **Generate**: Produce an initial output (can be your first draft or AI-generated)
17
+ 2. **Feedback**: Analyze the output for specific, actionable weaknesses across defined dimensions
18
+ 3. **Refine**: Rewrite addressing every feedback point — with the feedback visible as context
19
+ 4. **Stop**: When quality threshold met, max iterations reached, or feedback says "looks good"
20
+
21
+ **Key insight:** Maintaining a history of previous outputs + feedback in context prevents regression and helps the model track progress across iterations.
22
+
23
+ ## Components
24
+
25
+ ### Initial Output
26
+ **Purpose:** The starting point. Can be a first AI generation or something you've already written that needs improvement.
27
+
28
+ ### Feedback Dimensions
29
+ **Purpose:** The specific aspects to evaluate. Defining these explicitly produces much better critiques than asking for generic feedback.
30
+
31
+ **Common dimensions by task type:**
32
+ - **Code**: correctness, efficiency, readability, edge cases, error handling
33
+ - **Writing**: clarity, structure, tone, specificity, conciseness, audience fit
34
+ - **Reasoning**: logical validity, completeness, unsupported claims, missed considerations
35
+ - **Plans/strategies**: feasibility, completeness, risks, measurability
36
+
37
+ ### Refinement Instruction
38
+ **Purpose:** Directs the model to rewrite addressing every feedback point, using the critique as a direct specification.
39
+
40
+ ### Stop Condition
41
+ **Purpose:** When to stop iterating. Options:
42
+ - Fixed iterations (e.g., "run 2 refinement cycles")
43
+ - Quality signal ("stop when feedback has no major issues")
44
+ - Manual review (you decide when it's good enough)
45
+
46
+ ## Template Structure
47
+
48
+ ### Single Cycle (most common)
49
+ ```
50
+ INITIAL OUTPUT:
51
+ [Paste the output to improve, or ask the AI to generate a first draft]
52
+
53
+ FEEDBACK DIMENSIONS:
54
+ Review the output above for:
55
+ 1. [Dimension 1 — e.g., "Clarity: Is every sentence clear and unambiguous?"]
56
+ 2. [Dimension 2 — e.g., "Completeness: What important points are missing?"]
57
+ 3. [Dimension 3 — e.g., "Tone: Is the voice appropriate for the audience?"]
58
+ 4. [Dimension 4 — add as needed]
59
+
60
+ For each dimension: identify specific problems with quoted examples,
61
+ explain why each is a problem, and suggest concrete improvements.
62
+
63
+ REFINEMENT:
64
+ Now rewrite the output addressing every point of your feedback.
65
+ Show the refined version only (no commentary).
66
+ ```
67
+
68
+ ### Multi-Cycle with History
69
+ ```
70
+ ITERATION 1:
71
+ [Generate initial output or paste existing]
72
+
73
+ ITERATION 1 FEEDBACK:
74
+ Analyze for [dimensions]. Be specific and actionable.
75
+
76
+ ITERATION 2:
77
+ Rewrite addressing all feedback above.
78
+ [AI produces refined version]
79
+
80
+ ITERATION 2 FEEDBACK:
81
+ Analyze the refined version for any remaining issues.
82
+
83
+ ITERATION 3 (if needed):
84
+ Rewrite addressing remaining issues.
85
+
86
+ STOP when feedback says "no major issues remaining."
87
+ ```
88
+
89
+ ### Self-Refine as a Single Compound Prompt
90
+ ```
91
+ TASK: [What you want to produce]
92
+
93
+ GENERATE: Write an initial [output type] for the above.
94
+
95
+ FEEDBACK: Review your output for: [dimension 1], [dimension 2], [dimension 3].
96
+ List specific issues with quoted examples and concrete suggestions.
97
+
98
+ REFINE: Rewrite addressing all feedback. Show only the final refined version.
99
+ ```
100
+
101
+ ## Complete Examples
102
+
103
+ ### Example 1: Code Review and Improvement
104
+
105
+ ```
106
+ INITIAL OUTPUT:
107
+ def get_user_data(user_id):
108
+ db = connect_to_database()
109
+ result = db.query(f"SELECT * FROM users WHERE id = {user_id}")
110
+ return result
111
+
112
+ FEEDBACK DIMENSIONS:
113
+ Review for:
114
+ 1. Security: Any injection vulnerabilities or unsafe patterns?
115
+ 2. Error handling: What happens if the DB is unavailable or user doesn't exist?
116
+ 3. Resource management: Are connections properly managed?
117
+ 4. Code quality: Any Python best practices violations?
118
+
119
+ REFINEMENT:
120
+ Rewrite the function addressing all feedback points.
121
+ ```
122
+
123
+ ### Example 2: Writing Improvement
124
+
125
+ ```
126
+ INITIAL OUTPUT:
127
+ [Paste a paragraph or email draft]
128
+
129
+ FEEDBACK DIMENSIONS:
130
+ Review for:
131
+ 1. Clarity: Any sentences that are ambiguous or require re-reading?
132
+ 2. Conciseness: What can be cut without losing meaning?
133
+ 3. Opening: Does the first sentence earn the reader's attention?
134
+ 4. Call to action: Is the desired reader action explicit and easy to take?
135
+
136
+ REFINEMENT:
137
+ Rewrite addressing every point. Match the original length or shorter.
138
+ ```
139
+
140
+ ### Example 3: Strategic Plan
141
+
142
+ ```
143
+ INITIAL OUTPUT:
144
+ [Paste a strategy or plan]
145
+
146
+ FEEDBACK DIMENSIONS:
147
+ Review for:
148
+ 1. Completeness: What important scenarios or stakeholders are not addressed?
149
+ 2. Feasibility: Which actions assume resources or capabilities we may not have?
150
+ 3. Measurability: Which outcomes have no defined success metric?
151
+ 4. Risk: What's the biggest single point of failure?
152
+
153
+ REFINEMENT:
154
+ Revise the plan addressing all feedback. Add a risk mitigation note for the
155
+ biggest single point of failure identified.
156
+ ```
157
+
158
+ ## Best Use Cases
159
+
160
+ 1. **Any Output Quality Improvement**
161
+ - Code, writing, plans, analysis, summaries
162
+ - When the first draft is never the final draft
163
+
164
+ 2. **Domain-Specific Quality Gates**
165
+ - Code correctness + security
166
+ - Medical/legal content accuracy
167
+ - Brand voice compliance
168
+
169
+ 3. **Iterative Document Refinement**
170
+ - Proposals, reports, documentation
171
+ - Any output where multiple review dimensions apply
172
+
173
+ 4. **Self-QA Before Submitting**
174
+ - Run Self-Refine before using any AI output in high-stakes contexts
175
+
176
+ ## Selection Criteria
177
+
178
+ **Choose Self-Refine when:**
179
+ - ✅ You have an output that needs improvement
180
+ - ✅ Multiple quality dimensions apply
181
+ - ✅ The first pass is rarely final
182
+ - ✅ You want systematic critique, not just vague "make it better"
183
+
184
+ **Avoid when:**
185
+ - ❌ You need a specific type of critique → use CAI Critique-Revise (principle-based) or Devil's Advocate (opposing argument)
186
+ - ❌ Task is brand new (nothing to refine yet) → generate first, then Self-Refine
187
+ - ❌ Simple task → direct prompt is faster
188
+
189
+ ## Self-Refine vs. Similar Frameworks
190
+
191
+ | | Self-Refine | CAI Critique-Revise | BAB | Chain of Density |
192
+ |---|---|---|---|---|
193
+ | Direction | Any output → improvement | Output vs. explicit principle | Before state → after state | Content → denser compression |
194
+ | Critique type | Multi-dimensional quality | Principle-aligned alignment | Transformation rules | Density/information |
195
+ | Iterations | Configurable loop | One cycle (or more) | Single transform | N passes |
196
+ | Best for | General quality improvement | Alignment/compliance | Rewriting existing content | Summarization |
197
+
198
+ ## Quick Reference
199
+
200
+ | Phase | Purpose | Key Question |
201
+ |-------|---------|--------------|
202
+ | Generate | Initial output | "What's a first pass?" |
203
+ | Feedback | Specific critique | "What's wrong and why?" |
204
+ | Refine | Improved version | "Fix every problem found" |
205
+ | Stop | Termination | "Is it good enough?" |