@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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +264 -264
- package/LICENSE +21 -21
- package/README.md +1064 -1184
- package/adapters/README.md +75 -267
- package/adapters/for-windsurf.md +136 -136
- package/adapters/system-prompt.md +243 -243
- package/package.json +139 -138
- package/scripts/build-skill.js +64 -0
- package/scripts/install.js +4 -54
- package/scripts/test.js +205 -213
- package/scripts/validate-skill.js +350 -350
- package/skills/prompt-architect/SKILL.md +331 -331
- package/skills/prompt-architect/assets/templates/ape_template.txt +5 -5
- package/skills/prompt-architect/assets/templates/bab_template.txt +15 -15
- package/skills/prompt-architect/assets/templates/broke_template.txt +15 -15
- package/skills/prompt-architect/assets/templates/cai-critique-revise_template.txt +18 -18
- package/skills/prompt-architect/assets/templates/care_template.txt +16 -16
- package/skills/prompt-architect/assets/templates/chain-of-density_template.txt +46 -46
- package/skills/prompt-architect/assets/templates/chain-of-thought_template.txt +49 -49
- package/skills/prompt-architect/assets/templates/co-star_template.txt +17 -17
- package/skills/prompt-architect/assets/templates/crispe_template.txt +14 -14
- package/skills/prompt-architect/assets/templates/ctf_template.txt +15 -15
- package/skills/prompt-architect/assets/templates/devils-advocate_template.txt +25 -25
- package/skills/prompt-architect/assets/templates/hybrid_template.txt +101 -101
- package/skills/prompt-architect/assets/templates/least-to-most_template.txt +16 -16
- package/skills/prompt-architect/assets/templates/plan-and-solve_template.txt +7 -7
- package/skills/prompt-architect/assets/templates/pre-mortem_template.txt +27 -27
- package/skills/prompt-architect/assets/templates/race_template.txt +19 -19
- package/skills/prompt-architect/assets/templates/rcot_template.txt +31 -31
- package/skills/prompt-architect/assets/templates/react_template.txt +27 -27
- package/skills/prompt-architect/assets/templates/reverse-role_template.txt +11 -11
- package/skills/prompt-architect/assets/templates/rise-ie_template.txt +23 -23
- package/skills/prompt-architect/assets/templates/rise-ix_template.txt +28 -28
- package/skills/prompt-architect/assets/templates/risen_template.txt +21 -21
- package/skills/prompt-architect/assets/templates/rpef_template.txt +26 -26
- package/skills/prompt-architect/assets/templates/rtf_template.txt +13 -13
- package/skills/prompt-architect/assets/templates/self-refine_template.txt +16 -16
- package/skills/prompt-architect/assets/templates/skeleton-of-thought_template.txt +15 -15
- package/skills/prompt-architect/assets/templates/step-back_template.txt +10 -10
- package/skills/prompt-architect/assets/templates/tidd-ec_template.txt +45 -45
- package/skills/prompt-architect/assets/templates/tree-of-thought_template.txt +30 -30
- package/skills/prompt-architect/references/frameworks/ape.md +200 -200
- package/skills/prompt-architect/references/frameworks/bab.md +242 -242
- package/skills/prompt-architect/references/frameworks/broke.md +242 -242
- package/skills/prompt-architect/references/frameworks/cai-critique-revise.md +230 -230
- package/skills/prompt-architect/references/frameworks/care.md +235 -235
- package/skills/prompt-architect/references/frameworks/chain-of-density.md +479 -479
- package/skills/prompt-architect/references/frameworks/chain-of-thought.md +424 -424
- package/skills/prompt-architect/references/frameworks/co-star.md +256 -256
- package/skills/prompt-architect/references/frameworks/crispe.md +253 -253
- package/skills/prompt-architect/references/frameworks/ctf.md +207 -207
- package/skills/prompt-architect/references/frameworks/devils-advocate.md +206 -206
- package/skills/prompt-architect/references/frameworks/least-to-most.md +226 -226
- package/skills/prompt-architect/references/frameworks/plan-and-solve.md +210 -210
- package/skills/prompt-architect/references/frameworks/pre-mortem.md +197 -197
- package/skills/prompt-architect/references/frameworks/race.md +243 -243
- package/skills/prompt-architect/references/frameworks/rcot.md +203 -203
- package/skills/prompt-architect/references/frameworks/react.md +304 -304
- package/skills/prompt-architect/references/frameworks/reverse-role.md +189 -189
- package/skills/prompt-architect/references/frameworks/rise.md +555 -555
- package/skills/prompt-architect/references/frameworks/risen.md +297 -297
- package/skills/prompt-architect/references/frameworks/rpef.md +195 -195
- package/skills/prompt-architect/references/frameworks/rtf.md +358 -358
- package/skills/prompt-architect/references/frameworks/self-refine.md +205 -205
- package/skills/prompt-architect/references/frameworks/skeleton-of-thought.md +186 -186
- package/skills/prompt-architect/references/frameworks/step-back.md +206 -206
- package/skills/prompt-architect/references/frameworks/tidd-ec.md +470 -470
- package/skills/prompt-architect/references/frameworks/tree-of-thought.md +260 -260
- package/skills/prompt-architect/scripts/framework_analyzer.py +807 -807
- package/skills/prompt-architect/scripts/prompt_evaluator.py +336 -336
- package/adapters/for-cursor.mdc +0 -138
- package/adapters/for-gemini-cli.md +0 -70
- package/adapters/for-github-copilot.md +0 -141
- package/adapters/for-openai-codex-cli.md +0 -158
|
@@ -1,807 +1,807 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Framework Analyzer - Recommends appropriate prompting frameworks
|
|
3
|
-
Uses intent-based selection matching the 7-category system in SKILL.md
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
# ─────────────────────────────────────────────────────────────
|
|
7
|
-
# INTENT CATEGORIES (maps to SKILL.md A-G)
|
|
8
|
-
# ─────────────────────────────────────────────────────────────
|
|
9
|
-
|
|
10
|
-
INTENT_SIGNALS = {
|
|
11
|
-
'recover': {
|
|
12
|
-
'description': 'Reconstruct a prompt from an existing output',
|
|
13
|
-
'keywords': ['reverse engineer', 'recover prompt', 'what prompt', 'lost prompt',
|
|
14
|
-
'reconstruct prompt', 'template from output', 'prompt that produced'],
|
|
15
|
-
'frameworks': ['rpef']
|
|
16
|
-
},
|
|
17
|
-
'clarify': {
|
|
18
|
-
'description': 'Requirements are unclear; need to gather information first',
|
|
19
|
-
'keywords': ['not sure what i need', 'help me figure out', 'interview me',
|
|
20
|
-
'ask me questions', 'what do i need', 'unclear requirements',
|
|
21
|
-
'not sure how to start'],
|
|
22
|
-
'frameworks': ['reverse_role']
|
|
23
|
-
},
|
|
24
|
-
'create': {
|
|
25
|
-
'description': 'Generating new content from scratch',
|
|
26
|
-
'keywords': ['write', 'create', 'draft', 'generate', 'compose', 'build', 'make',
|
|
27
|
-
'produce', 'develop', 'design'],
|
|
28
|
-
'frameworks': ['co-star', 'risen', 'rise-ie', 'rise-ix', 'tidd-ec',
|
|
29
|
-
'rtf', 'ctf', 'ape', 'race', 'crispe', 'broke', 'care']
|
|
30
|
-
},
|
|
31
|
-
'transform': {
|
|
32
|
-
'description': 'Improving or converting existing content',
|
|
33
|
-
'keywords': ['rewrite', 'refactor', 'convert', 'improve', 'edit', 'revise',
|
|
34
|
-
'transform', 'update', 'change', 'fix', 'clean up', 'restructure',
|
|
35
|
-
'rephrase', 'summarize', 'compress', 'densify', 'expand'],
|
|
36
|
-
'frameworks': ['bab', 'self_refine', 'chain_of_density', 'skeleton_of_thought']
|
|
37
|
-
},
|
|
38
|
-
'reason': {
|
|
39
|
-
'description': 'Solving a reasoning or calculation problem',
|
|
40
|
-
'keywords': ['calculate', 'solve', 'figure out', 'reason', 'analyze', 'evaluate',
|
|
41
|
-
'determine', 'compute', 'derive', 'proof', 'logic', 'math',
|
|
42
|
-
'should i', 'which is better', 'compare options'],
|
|
43
|
-
'frameworks': ['plan_and_solve', 'chain_of_thought', 'least_to_most',
|
|
44
|
-
'step_back', 'tree_of_thought', 'rcot']
|
|
45
|
-
},
|
|
46
|
-
'critique': {
|
|
47
|
-
'description': 'Stress-testing, attacking, or verifying output',
|
|
48
|
-
'keywords': ['review', 'critique', 'evaluate', 'stress test', 'find flaws',
|
|
49
|
-
'what could go wrong', 'attack', 'challenge', 'verify', 'check',
|
|
50
|
-
'validate', 'risks', 'failure modes', 'problems with', 'weaknesses'],
|
|
51
|
-
'frameworks': ['self_refine', 'cai_critique_revise', 'devils_advocate',
|
|
52
|
-
'pre_mortem', 'rcot']
|
|
53
|
-
},
|
|
54
|
-
'agentic': {
|
|
55
|
-
'description': 'Tool-use with iterative reasoning cycles',
|
|
56
|
-
'keywords': ['use tools', 'search and', 'run code', 'execute', 'fetch',
|
|
57
|
-
'query database', 'look up', 'agent', 'automate', 'multi-step with tools'],
|
|
58
|
-
'frameworks': ['react']
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
# ─────────────────────────────────────────────────────────────
|
|
63
|
-
# FRAMEWORK DEFINITIONS (all 27)
|
|
64
|
-
# ─────────────────────────────────────────────────────────────
|
|
65
|
-
|
|
66
|
-
FRAMEWORKS = {
|
|
67
|
-
# ── CREATE family ────────────────────────────────────────
|
|
68
|
-
'ape': {
|
|
69
|
-
'name': 'APE',
|
|
70
|
-
'full_name': 'Action, Purpose, Expectation',
|
|
71
|
-
'intent': 'create',
|
|
72
|
-
'complexity': 'minimal',
|
|
73
|
-
'best_for': ['ultra_simple', 'one_off', 'quick_task', 'no_role_needed'],
|
|
74
|
-
'discriminators': ['short prompt', 'one-off', 'simple action'],
|
|
75
|
-
'indicators': {
|
|
76
|
-
'keywords': ['quickly', 'brief', 'simple', 'just'],
|
|
77
|
-
'signals': ['short_prompt', 'no_role', 'no_context_needed']
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
'rtf': {
|
|
81
|
-
'name': 'RTF',
|
|
82
|
-
'full_name': 'Role, Task, Format',
|
|
83
|
-
'intent': 'create',
|
|
84
|
-
'complexity': 'low',
|
|
85
|
-
'best_for': ['simple_tasks', 'expertise_driven', 'format_focused'],
|
|
86
|
-
'discriminators': ['expertise framing matters', 'simple task'],
|
|
87
|
-
'indicators': {
|
|
88
|
-
'keywords': ['format', 'structure', 'template', 'simple', 'quick', 'as a'],
|
|
89
|
-
'signals': ['short_prompt', 'format_primary']
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
'ctf': {
|
|
93
|
-
'name': 'CTF',
|
|
94
|
-
'full_name': 'Context, Task, Format',
|
|
95
|
-
'intent': 'create',
|
|
96
|
-
'complexity': 'low',
|
|
97
|
-
'best_for': ['context_driven', 'simple_tasks', 'situation_matters'],
|
|
98
|
-
'discriminators': ['situation/background more important than expertise'],
|
|
99
|
-
'indicators': {
|
|
100
|
-
'keywords': ['given that', 'because of', 'in this situation', 'mid-project',
|
|
101
|
-
'currently', 'background'],
|
|
102
|
-
'signals': ['context_heavy', 'no_role_needed']
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
'race': {
|
|
106
|
-
'name': 'RACE',
|
|
107
|
-
'full_name': 'Role, Action, Context, Expectation',
|
|
108
|
-
'intent': 'create',
|
|
109
|
-
'complexity': 'medium',
|
|
110
|
-
'best_for': ['expert_task_with_context', 'outcome_clarity_needed'],
|
|
111
|
-
'discriminators': ['role + context + explicit outcome all needed'],
|
|
112
|
-
'indicators': {
|
|
113
|
-
'keywords': ['review', 'assess', 'recommend', 'evaluate with context'],
|
|
114
|
-
'signals': ['role_needed', 'context_needed', 'outcome_explicit']
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
'crispe': {
|
|
118
|
-
'name': 'CRISPE',
|
|
119
|
-
'full_name': 'Capacity+Role, Insight, Instructions, Personality, Experiment',
|
|
120
|
-
'intent': 'create',
|
|
121
|
-
'complexity': 'medium',
|
|
122
|
-
'best_for': ['multiple_variants_needed', 'tone_critical', 'comprehensive'],
|
|
123
|
-
'discriminators': ['multiple output variants needed', 'A/B options'],
|
|
124
|
-
'indicators': {
|
|
125
|
-
'keywords': ['options', 'versions', 'variants', 'different approaches', 'alternatives'],
|
|
126
|
-
'signals': ['multiple_outputs', 'style_critical']
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
'broke': {
|
|
130
|
-
'name': 'BROKE',
|
|
131
|
-
'full_name': 'Background, Role, Objective, Key Results, Evolve',
|
|
132
|
-
'intent': 'create',
|
|
133
|
-
'complexity': 'medium',
|
|
134
|
-
'best_for': ['business_deliverable', 'measurable_outcomes', 'okr_aligned'],
|
|
135
|
-
'discriminators': ['business KPIs exist', 'self-critique loop desired'],
|
|
136
|
-
'indicators': {
|
|
137
|
-
'keywords': ['metric', 'kpi', 'goal', 'objective', 'measure', 'target',
|
|
138
|
-
'revenue', 'conversion', 'reduce', 'increase by'],
|
|
139
|
-
'signals': ['business_kpis', 'iteration_expected']
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
'care': {
|
|
143
|
-
'name': 'CARE',
|
|
144
|
-
'full_name': 'Context, Ask, Rules, Examples',
|
|
145
|
-
'intent': 'create',
|
|
146
|
-
'complexity': 'medium',
|
|
147
|
-
'best_for': ['compliance_required', 'rules_heavy', 'examples_help'],
|
|
148
|
-
'discriminators': ['explicit rules + examples (combined), not separate do/don\'t lists'],
|
|
149
|
-
'indicators': {
|
|
150
|
-
'keywords': ['must not', 'required', 'compliance', 'plain language', 'rule',
|
|
151
|
-
'standard', 'guideline', 'accessibility', 'grade level'],
|
|
152
|
-
'signals': ['rules_important', 'examples_provided', 'compliance']
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
'co-star': {
|
|
156
|
-
'name': 'CO-STAR',
|
|
157
|
-
'full_name': 'Context, Objective, Style, Tone, Audience, Response',
|
|
158
|
-
'intent': 'create',
|
|
159
|
-
'complexity': 'high',
|
|
160
|
-
'best_for': ['content_creation', 'audience_matters', 'tone_critical', 'writing'],
|
|
161
|
-
'discriminators': ['audience/tone/style are critical factors'],
|
|
162
|
-
'indicators': {
|
|
163
|
-
'keywords': ['write', 'create', 'article', 'blog', 'post', 'content', 'email',
|
|
164
|
-
'message', 'audience', 'tone', 'style', 'voice'],
|
|
165
|
-
'signals': ['audience_specified', 'tone_matters', 'writing_task']
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
'risen': {
|
|
169
|
-
'name': 'RISEN',
|
|
170
|
-
'full_name': 'Role, Instructions, Steps, End goal, Narrowing',
|
|
171
|
-
'intent': 'create',
|
|
172
|
-
'complexity': 'high',
|
|
173
|
-
'best_for': ['multi_step_process', 'methodology_matters', 'constraints_important'],
|
|
174
|
-
'discriminators': ['multi-step with constraints and methodology'],
|
|
175
|
-
'indicators': {
|
|
176
|
-
'keywords': ['process', 'procedure', 'workflow', 'steps', 'guide',
|
|
177
|
-
'methodology', 'systematic', 'checklist'],
|
|
178
|
-
'signals': ['sequential_steps', 'methodology_needed']
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
'tidd-ec': {
|
|
182
|
-
'name': 'TIDD-EC',
|
|
183
|
-
'full_name': 'Task type, Instructions, Do, Don\'t, Examples, Context',
|
|
184
|
-
'intent': 'create',
|
|
185
|
-
'complexity': 'high',
|
|
186
|
-
'best_for': ['explicit_dos_donts', 'high_precision', 'compliance_tasks'],
|
|
187
|
-
'discriminators': ['explicit separate DO and DON\'T lists needed'],
|
|
188
|
-
'indicators': {
|
|
189
|
-
'keywords': ['must', 'avoid', "don't", "shouldn't", 'do not', 'never',
|
|
190
|
-
'always', 'requirement', 'boundary', 'compliance', 'support'],
|
|
191
|
-
'signals': ['explicit_dos_donts', 'precision_required']
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
'rise-ie': {
|
|
195
|
-
'name': 'RISE-IE',
|
|
196
|
-
'full_name': 'Role, Input, Steps, Expectation (Input-Expectation)',
|
|
197
|
-
'intent': 'create',
|
|
198
|
-
'complexity': 'medium',
|
|
199
|
-
'best_for': ['data_transformation', 'input_output_defined', 'analytical'],
|
|
200
|
-
'discriminators': ['clear input → output transformation'],
|
|
201
|
-
'indicators': {
|
|
202
|
-
'keywords': ['analyze', 'process', 'transform', 'data', 'input', 'csv',
|
|
203
|
-
'json', 'file', 'extract', 'parse', 'convert'],
|
|
204
|
-
'signals': ['input_defined', 'output_defined', 'transformation']
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
'rise-ix': {
|
|
208
|
-
'name': 'RISE-IX',
|
|
209
|
-
'full_name': 'Role, Instructions, Steps, Examples (Instructions-Examples)',
|
|
210
|
-
'intent': 'create',
|
|
211
|
-
'complexity': 'medium',
|
|
212
|
-
'best_for': ['content_with_examples', 'style_matching', 'creative'],
|
|
213
|
-
'discriminators': ['content creation with reference examples'],
|
|
214
|
-
'indicators': {
|
|
215
|
-
'keywords': ['like this', 'similar to', 'example', 'style', 'format like',
|
|
216
|
-
'match this', 'replicate'],
|
|
217
|
-
'signals': ['examples_provided', 'style_reference']
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
# ── TRANSFORM family ─────────────────────────────────────
|
|
221
|
-
'bab': {
|
|
222
|
-
'name': 'BAB',
|
|
223
|
-
'full_name': 'Before, After, Bridge',
|
|
224
|
-
'intent': 'transform',
|
|
225
|
-
'complexity': 'low',
|
|
226
|
-
'best_for': ['rewrite', 'refactor', 'convert', 'transformation'],
|
|
227
|
-
'discriminators': ['existing content → new form'],
|
|
228
|
-
'indicators': {
|
|
229
|
-
'keywords': ['rewrite', 'refactor', 'convert', 'change this to', 'transform',
|
|
230
|
-
'turn into', 'migrate', 'update to'],
|
|
231
|
-
'signals': ['existing_content', 'desired_state_different']
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
'self_refine': {
|
|
235
|
-
'name': 'Self-Refine',
|
|
236
|
-
'full_name': 'Generate → Feedback → Refine',
|
|
237
|
-
'intent': 'transform',
|
|
238
|
-
'complexity': 'medium',
|
|
239
|
-
'best_for': ['quality_improvement', 'iterative_feedback', 'any_output'],
|
|
240
|
-
'discriminators': ['iterative quality improvement of any output'],
|
|
241
|
-
'indicators': {
|
|
242
|
-
'keywords': ['improve', 'make better', 'enhance', 'refine', 'review and fix',
|
|
243
|
-
'quality check', 'iterate'],
|
|
244
|
-
'signals': ['existing_output', 'quality_improvement']
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
'chain_of_density': {
|
|
248
|
-
'name': 'Chain of Density',
|
|
249
|
-
'full_name': 'Iterative compression and densification',
|
|
250
|
-
'intent': 'transform',
|
|
251
|
-
'complexity': 'medium',
|
|
252
|
-
'best_for': ['summarization', 'compression', 'densification'],
|
|
253
|
-
'discriminators': ['compress/densify content into tighter form'],
|
|
254
|
-
'indicators': {
|
|
255
|
-
'keywords': ['summarize', 'compress', 'condense', 'shorten', 'densify', 'tighten'],
|
|
256
|
-
'signals': ['compression_goal', 'existing_content']
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
'skeleton_of_thought': {
|
|
260
|
-
'name': 'Skeleton of Thought',
|
|
261
|
-
'full_name': 'Skeleton-first then expand (parallel)',
|
|
262
|
-
'intent': 'transform',
|
|
263
|
-
'complexity': 'medium',
|
|
264
|
-
'best_for': ['structured_long_form', 'outline_first', 'multi_section'],
|
|
265
|
-
'discriminators': ['outline-first then expand each section'],
|
|
266
|
-
'indicators': {
|
|
267
|
-
'keywords': ['outline', 'structure', 'organized', 'sections', 'comprehensive',
|
|
268
|
-
'document', 'report'],
|
|
269
|
-
'signals': ['multi_section', 'structure_important']
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
# ── REASON family ─────────────────────────────────────────
|
|
273
|
-
'plan_and_solve': {
|
|
274
|
-
'name': 'Plan-and-Solve (PS+)',
|
|
275
|
-
'full_name': 'Plan first, extract variables, calculate step by step',
|
|
276
|
-
'intent': 'reason',
|
|
277
|
-
'complexity': 'low',
|
|
278
|
-
'best_for': ['numerical_calculation', 'zero_shot_math', 'variable_extraction'],
|
|
279
|
-
'discriminators': ['numerical/calculation, zero-shot'],
|
|
280
|
-
'indicators': {
|
|
281
|
-
'keywords': ['calculate', 'compute', 'math', 'formula', '%', '$', 'total',
|
|
282
|
-
'how many', 'how much', 'rate', 'percentage', 'sum'],
|
|
283
|
-
'signals': ['numbers_present', 'calculation_needed']
|
|
284
|
-
}
|
|
285
|
-
},
|
|
286
|
-
'least_to_most': {
|
|
287
|
-
'name': 'Least-to-Most',
|
|
288
|
-
'full_name': 'Decompose into ordered subproblems, solve sequentially',
|
|
289
|
-
'intent': 'reason',
|
|
290
|
-
'complexity': 'medium',
|
|
291
|
-
'best_for': ['compositional_reasoning', 'multi_hop', 'dependency_order'],
|
|
292
|
-
'discriminators': ['multi-hop with ordered dependencies (A needed before B)'],
|
|
293
|
-
'indicators': {
|
|
294
|
-
'keywords': ['depends on', 'first need to know', 'requires knowing',
|
|
295
|
-
'multi-step', 'building on', 'chain of'],
|
|
296
|
-
'signals': ['dependency_chain', 'multi_hop']
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
'step_back': {
|
|
300
|
-
'name': 'Step-Back',
|
|
301
|
-
'full_name': 'Abstract to underlying principles, then answer',
|
|
302
|
-
'intent': 'reason',
|
|
303
|
-
'complexity': 'medium',
|
|
304
|
-
'best_for': ['principle_grounded', 'first_principles', 'stem_reasoning'],
|
|
305
|
-
'discriminators': ['needs first-principles reasoning before answering'],
|
|
306
|
-
'indicators': {
|
|
307
|
-
'keywords': ['why does', 'what principle', 'what rule', 'physics', 'chemistry',
|
|
308
|
-
'first principles', 'underlying', 'fundamentally'],
|
|
309
|
-
'signals': ['principle_needed', 'abstract_first']
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
'tree_of_thought': {
|
|
313
|
-
'name': 'Tree of Thought',
|
|
314
|
-
'full_name': 'Branching exploration of multiple solution paths',
|
|
315
|
-
'intent': 'reason',
|
|
316
|
-
'complexity': 'medium',
|
|
317
|
-
'best_for': ['multiple_approaches', 'decision_making', 'trade_off_analysis'],
|
|
318
|
-
'discriminators': ['multiple distinct approaches to compare'],
|
|
319
|
-
'indicators': {
|
|
320
|
-
'keywords': ['which approach', 'options', 'alternatives', 'trade-offs',
|
|
321
|
-
'should we use', 'pros and cons', 'compare', 'choose between'],
|
|
322
|
-
'signals': ['multiple_options', 'decision_needed']
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
'chain_of_thought': {
|
|
326
|
-
'name': 'Chain of Thought',
|
|
327
|
-
'full_name': 'Step-by-step linear reasoning',
|
|
328
|
-
'intent': 'reason',
|
|
329
|
-
'complexity': 'medium',
|
|
330
|
-
'best_for': ['linear_reasoning', 'debugging', 'logical_analysis'],
|
|
331
|
-
'discriminators': ['linear step-by-step reasoning'],
|
|
332
|
-
'indicators': {
|
|
333
|
-
'keywords': ['solve', 'reason', 'think through', 'debug', 'logic',
|
|
334
|
-
'why', 'how does', 'step by step'],
|
|
335
|
-
'signals': ['reasoning_needed', 'linear_path']
|
|
336
|
-
}
|
|
337
|
-
},
|
|
338
|
-
'rcot': {
|
|
339
|
-
'name': 'RCoT',
|
|
340
|
-
'full_name': 'Reverse Chain-of-Thought (verify by reconstruction)',
|
|
341
|
-
'intent': 'reason',
|
|
342
|
-
'complexity': 'medium',
|
|
343
|
-
'best_for': ['verification', 'multi_condition', 'overlooked_conditions'],
|
|
344
|
-
'discriminators': ['verify reasoning didn\'t overlook conditions'],
|
|
345
|
-
'indicators': {
|
|
346
|
-
'keywords': ['verify', 'check reasoning', 'missed anything', 'conditions',
|
|
347
|
-
'multi-constraint', 'overlook'],
|
|
348
|
-
'signals': ['verification_needed', 'multi_condition']
|
|
349
|
-
}
|
|
350
|
-
},
|
|
351
|
-
# ── CRITIQUE family ───────────────────────────────────────
|
|
352
|
-
'cai_critique_revise': {
|
|
353
|
-
'name': 'CAI Critique-Revise',
|
|
354
|
-
'full_name': 'Principle-based critique and revision',
|
|
355
|
-
'intent': 'critique',
|
|
356
|
-
'complexity': 'medium',
|
|
357
|
-
'best_for': ['principle_compliance', 'standard_alignment', 'quality_gate'],
|
|
358
|
-
'discriminators': ['align output to explicit stated principle/standard'],
|
|
359
|
-
'indicators': {
|
|
360
|
-
'keywords': ['principle', 'standard', 'policy', 'comply', 'against',
|
|
361
|
-
'violates', 'enforce', 'align to', 'plain language'],
|
|
362
|
-
'signals': ['explicit_principle', 'compliance_check']
|
|
363
|
-
}
|
|
364
|
-
},
|
|
365
|
-
'devils_advocate': {
|
|
366
|
-
'name': "Devil's Advocate",
|
|
367
|
-
'full_name': 'Strongest opposing argument generation',
|
|
368
|
-
'intent': 'critique',
|
|
369
|
-
'complexity': 'low',
|
|
370
|
-
'best_for': ['decision_testing', 'debiasing', 'find_weaknesses'],
|
|
371
|
-
'discriminators': ['find strongest opposing argument against a position'],
|
|
372
|
-
'indicators': {
|
|
373
|
-
'keywords': ['argue against', 'find flaws', 'challenge', 'opposition',
|
|
374
|
-
'devil\'s advocate', 'steelman', 'counterargument', 'push back'],
|
|
375
|
-
'signals': ['position_to_attack', 'opposing_view']
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
'pre_mortem': {
|
|
379
|
-
'name': 'Pre-Mortem',
|
|
380
|
-
'full_name': 'Assume failure, work backwards to causes',
|
|
381
|
-
'intent': 'critique',
|
|
382
|
-
'complexity': 'low',
|
|
383
|
-
'best_for': ['risk_identification', 'failure_analysis', 'pre_launch'],
|
|
384
|
-
'discriminators': ['identify failure modes before they happen'],
|
|
385
|
-
'indicators': {
|
|
386
|
-
'keywords': ['risks', 'failure', 'what could go wrong', 'pre-mortem',
|
|
387
|
-
'before launch', 'potential problems', 'failure modes'],
|
|
388
|
-
'signals': ['risk_analysis', 'forward_looking']
|
|
389
|
-
}
|
|
390
|
-
},
|
|
391
|
-
# ── META/REVERSE family ───────────────────────────────────
|
|
392
|
-
'rpef': {
|
|
393
|
-
'name': 'RPEF',
|
|
394
|
-
'full_name': 'Reverse Prompt Engineering Framework',
|
|
395
|
-
'intent': 'recover',
|
|
396
|
-
'complexity': 'low',
|
|
397
|
-
'best_for': ['recover_prompt', 'template_from_output', 'reverse_engineer'],
|
|
398
|
-
'discriminators': ['reconstruct a prompt from an existing output'],
|
|
399
|
-
'indicators': {
|
|
400
|
-
'keywords': ['reverse engineer', 'recover prompt', 'what prompt created',
|
|
401
|
-
'prompt template from', 'reconstruct'],
|
|
402
|
-
'signals': ['output_provided', 'prompt_recovery']
|
|
403
|
-
}
|
|
404
|
-
},
|
|
405
|
-
'reverse_role': {
|
|
406
|
-
'name': 'Reverse Role Prompting',
|
|
407
|
-
'full_name': 'AI-Led Interview (FATA)',
|
|
408
|
-
'intent': 'clarify',
|
|
409
|
-
'complexity': 'low',
|
|
410
|
-
'best_for': ['unclear_requirements', 'non_expert_user', 'discovery'],
|
|
411
|
-
'discriminators': ['gather information before executing'],
|
|
412
|
-
'indicators': {
|
|
413
|
-
'keywords': ['not sure', 'help me figure out', 'ask me', 'interview',
|
|
414
|
-
'what do i need', 'unclear', 'don\'t know how to start'],
|
|
415
|
-
'signals': ['requirements_unclear', 'needs_clarification']
|
|
416
|
-
}
|
|
417
|
-
},
|
|
418
|
-
# ── AGENTIC family ────────────────────────────────────────
|
|
419
|
-
'react': {
|
|
420
|
-
'name': 'ReAct',
|
|
421
|
-
'full_name': 'Reasoning + Acting (Thought-Action-Observation)',
|
|
422
|
-
'intent': 'agentic',
|
|
423
|
-
'complexity': 'medium',
|
|
424
|
-
'best_for': ['tool_use', 'agentic_workflow', 'iterative_tool_reasoning'],
|
|
425
|
-
'discriminators': ['task requires tools; each result informs next step'],
|
|
426
|
-
'indicators': {
|
|
427
|
-
'keywords': ['search', 'run code', 'query', 'fetch', 'execute', 'agent',
|
|
428
|
-
'use tools', 'look up', 'database', 'api call'],
|
|
429
|
-
'signals': ['tools_available', 'iterative_tool_use']
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
# ─────────────────────────────────────────────────────────────
|
|
436
|
-
# INTENT DETECTION
|
|
437
|
-
# ─────────────────────────────────────────────────────────────
|
|
438
|
-
|
|
439
|
-
def detect_intent(prompt_text):
|
|
440
|
-
"""
|
|
441
|
-
Detect the primary intent category from a prompt.
|
|
442
|
-
Returns intent category and confidence.
|
|
443
|
-
"""
|
|
444
|
-
prompt_lower = prompt_text.lower()
|
|
445
|
-
intent_scores = {}
|
|
446
|
-
|
|
447
|
-
for intent, config in INTENT_SIGNALS.items():
|
|
448
|
-
score = 0
|
|
449
|
-
for keyword in config['keywords']:
|
|
450
|
-
if keyword in prompt_lower:
|
|
451
|
-
score += 3
|
|
452
|
-
intent_scores[intent] = score
|
|
453
|
-
|
|
454
|
-
# Sort by score
|
|
455
|
-
sorted_intents = sorted(intent_scores.items(), key=lambda x: x[1], reverse=True)
|
|
456
|
-
top_intent = sorted_intents[0]
|
|
457
|
-
|
|
458
|
-
# If no strong intent signal, default to 'create' (most common)
|
|
459
|
-
if top_intent[1] == 0:
|
|
460
|
-
return 'create', 0
|
|
461
|
-
return top_intent[0], top_intent[1]
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
# ─────────────────────────────────────────────────────────────
|
|
465
|
-
# FRAMEWORK RECOMMENDATION
|
|
466
|
-
# ─────────────────────────────────────────────────────────────
|
|
467
|
-
|
|
468
|
-
def analyze_use_case(prompt_text):
|
|
469
|
-
"""
|
|
470
|
-
Analyze a prompt and recommend appropriate frameworks.
|
|
471
|
-
Uses intent-based selection matching SKILL.md's 7-category system.
|
|
472
|
-
|
|
473
|
-
Args:
|
|
474
|
-
prompt_text (str): The user's original prompt
|
|
475
|
-
|
|
476
|
-
Returns:
|
|
477
|
-
list: Recommended frameworks with reasoning
|
|
478
|
-
"""
|
|
479
|
-
prompt_lower = prompt_text.lower()
|
|
480
|
-
word_count = len(prompt_text.split())
|
|
481
|
-
|
|
482
|
-
# Step 1: Detect primary intent
|
|
483
|
-
intent, intent_confidence = detect_intent(prompt_text)
|
|
484
|
-
|
|
485
|
-
# Step 2: Get candidate frameworks for this intent
|
|
486
|
-
candidate_ids = INTENT_SIGNALS.get(intent, {}).get('frameworks', [])
|
|
487
|
-
|
|
488
|
-
# Step 3: Score candidates using discriminators
|
|
489
|
-
scores = {}
|
|
490
|
-
for fw_id in candidate_ids:
|
|
491
|
-
if fw_id not in FRAMEWORKS:
|
|
492
|
-
continue
|
|
493
|
-
fw = FRAMEWORKS[fw_id]
|
|
494
|
-
score = intent_confidence # Base score from intent match
|
|
495
|
-
matches = [f"intent: {intent}"]
|
|
496
|
-
|
|
497
|
-
for keyword in fw['indicators'].get('keywords', []):
|
|
498
|
-
if keyword in prompt_lower:
|
|
499
|
-
score += 2
|
|
500
|
-
matches.append(f"keyword: '{keyword}'")
|
|
501
|
-
|
|
502
|
-
# Apply framework-specific heuristics
|
|
503
|
-
if fw_id == 'ape' and word_count < 10:
|
|
504
|
-
score += 3
|
|
505
|
-
matches.append("very short prompt → ultra-minimal framework")
|
|
506
|
-
|
|
507
|
-
if fw_id == 'rtf' and word_count < 20:
|
|
508
|
-
score += 2
|
|
509
|
-
matches.append("short, focused prompt → RTF")
|
|
510
|
-
|
|
511
|
-
if fw_id == 'co-star' and any(w in prompt_lower for w in ['audience', 'tone', 'style', 'readers']):
|
|
512
|
-
score += 4
|
|
513
|
-
matches.append("audience/tone/style signals → CO-STAR")
|
|
514
|
-
|
|
515
|
-
if fw_id == 'tidd-ec' and any(w in prompt_lower for w in ["don't", "avoid", "must not", "never"]):
|
|
516
|
-
score += 4
|
|
517
|
-
matches.append("explicit don'ts → TIDD-EC over CARE")
|
|
518
|
-
|
|
519
|
-
if fw_id == 'care' and 'example' in prompt_lower and 'rule' in prompt_lower:
|
|
520
|
-
score += 3
|
|
521
|
-
matches.append("rules + examples → CARE")
|
|
522
|
-
|
|
523
|
-
if fw_id == 'broke':
|
|
524
|
-
if any(w in prompt_lower for w in ['metric', 'kpi', 'target', 'revenue', 'conversion']):
|
|
525
|
-
score += 4
|
|
526
|
-
matches.append("business KPI signals → BROKE")
|
|
527
|
-
|
|
528
|
-
if fw_id == 'risen' and any(w in prompt_lower for w in ['step', 'process', 'procedure', 'workflow']):
|
|
529
|
-
score += 3
|
|
530
|
-
matches.append("process signals → RISEN")
|
|
531
|
-
|
|
532
|
-
if fw_id == 'rise-ie' and any(w in prompt_lower for w in ['csv', 'json', 'data', 'file', 'input']):
|
|
533
|
-
score += 4
|
|
534
|
-
matches.append("data transformation signals → RISE-IE")
|
|
535
|
-
|
|
536
|
-
if fw_id == 'rise-ix' and any(w in prompt_lower for w in ['example', 'like', 'similar', 'style']):
|
|
537
|
-
score += 4
|
|
538
|
-
matches.append("style/example signals → RISE-IX")
|
|
539
|
-
|
|
540
|
-
if fw_id == 'bab' and any(w in prompt_lower for w in ['rewrite', 'refactor', 'convert', 'transform']):
|
|
541
|
-
score += 4
|
|
542
|
-
matches.append("transformation signals → BAB")
|
|
543
|
-
|
|
544
|
-
if fw_id == 'plan_and_solve' and any(c.isdigit() for c in prompt_text):
|
|
545
|
-
score += 3
|
|
546
|
-
matches.append("numbers present → Plan-and-Solve")
|
|
547
|
-
|
|
548
|
-
if fw_id == 'pre_mortem' and any(w in prompt_lower for w in ['risk', 'failure', 'wrong', 'fail']):
|
|
549
|
-
score += 4
|
|
550
|
-
matches.append("failure/risk signals → Pre-Mortem")
|
|
551
|
-
|
|
552
|
-
if fw_id == 'devils_advocate' and any(w in prompt_lower for w in ['challenge', 'argue', 'flaw', 'wrong']):
|
|
553
|
-
score += 4
|
|
554
|
-
matches.append("challenge/flaw signals → Devil's Advocate")
|
|
555
|
-
|
|
556
|
-
scores[fw_id] = {'score': score, 'matches': matches, 'framework': FRAMEWORKS[fw_id]}
|
|
557
|
-
|
|
558
|
-
# Sort by score, return top 2
|
|
559
|
-
sorted_frameworks = sorted(scores.items(), key=lambda x: x[1]['score'], reverse=True)
|
|
560
|
-
|
|
561
|
-
recommendations = []
|
|
562
|
-
for fw_id, data in sorted_frameworks[:2]:
|
|
563
|
-
if data['score'] > 0:
|
|
564
|
-
fw = data['framework']
|
|
565
|
-
recommendations.append({
|
|
566
|
-
'id': fw_id,
|
|
567
|
-
'name': fw['name'],
|
|
568
|
-
'full_name': fw['full_name'],
|
|
569
|
-
'intent': intent,
|
|
570
|
-
'score': data['score'],
|
|
571
|
-
'matches': data['matches'],
|
|
572
|
-
'complexity': fw['complexity'],
|
|
573
|
-
'best_for': fw['best_for'],
|
|
574
|
-
'discriminators': fw.get('discriminators', [])
|
|
575
|
-
})
|
|
576
|
-
|
|
577
|
-
# Fallback: if no candidates scored, suggest based on intent alone
|
|
578
|
-
if not recommendations:
|
|
579
|
-
fallback_map = {
|
|
580
|
-
'create': 'rtf', 'transform': 'bab', 'reason': 'chain_of_thought',
|
|
581
|
-
'critique': 'self_refine', 'recover': 'rpef',
|
|
582
|
-
'clarify': 'reverse_role', 'agentic': 'react'
|
|
583
|
-
}
|
|
584
|
-
fw_id = fallback_map.get(intent, 'rtf')
|
|
585
|
-
fw = FRAMEWORKS[fw_id]
|
|
586
|
-
recommendations.append({
|
|
587
|
-
'id': fw_id,
|
|
588
|
-
'name': fw['name'],
|
|
589
|
-
'full_name': fw['full_name'],
|
|
590
|
-
'intent': intent,
|
|
591
|
-
'score': 1,
|
|
592
|
-
'matches': [f"fallback for intent: {intent}"],
|
|
593
|
-
'complexity': fw['complexity'],
|
|
594
|
-
'best_for': fw['best_for'],
|
|
595
|
-
'discriminators': fw.get('discriminators', [])
|
|
596
|
-
})
|
|
597
|
-
|
|
598
|
-
return recommendations
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
# ─────────────────────────────────────────────────────────────
|
|
602
|
-
# CLARIFICATION QUESTIONS
|
|
603
|
-
# ─────────────────────────────────────────────────────────────
|
|
604
|
-
|
|
605
|
-
def get_framework_questions(framework_id):
|
|
606
|
-
"""
|
|
607
|
-
Get clarifying questions for a specific framework.
|
|
608
|
-
|
|
609
|
-
Args:
|
|
610
|
-
framework_id (str): Framework identifier
|
|
611
|
-
|
|
612
|
-
Returns:
|
|
613
|
-
list: Questions to ask user
|
|
614
|
-
"""
|
|
615
|
-
questions = {
|
|
616
|
-
'co-star': [
|
|
617
|
-
"What's the background context or situation?",
|
|
618
|
-
"Who is your target audience? (expertise level, role, characteristics)",
|
|
619
|
-
"What specific objective do you want to achieve?",
|
|
620
|
-
"What tone is appropriate? (professional, casual, urgent, friendly)",
|
|
621
|
-
"What style or format should the output follow?",
|
|
622
|
-
"How should the response be structured? (length, sections, format)"
|
|
623
|
-
],
|
|
624
|
-
'risen': [
|
|
625
|
-
"What role or expertise level should be demonstrated?",
|
|
626
|
-
"What principles or guidelines should guide the approach?",
|
|
627
|
-
"What are the specific steps or sequence of actions needed?",
|
|
628
|
-
"What defines success? What are the acceptance criteria?",
|
|
629
|
-
"What should be avoided? What constraints or boundaries exist?"
|
|
630
|
-
],
|
|
631
|
-
'rise-ie': [
|
|
632
|
-
"What role or perspective is needed for this analytical task?",
|
|
633
|
-
"What input are you providing? (format: CSV, JSON, text, etc.)",
|
|
634
|
-
"What are the characteristics of the input data?",
|
|
635
|
-
"What processing or transformation steps are needed?",
|
|
636
|
-
"What should the output look like? (format, structure, required elements)"
|
|
637
|
-
],
|
|
638
|
-
'rise-ix': [
|
|
639
|
-
"What role or persona is most appropriate?",
|
|
640
|
-
"What are the main instructions or task requirements?",
|
|
641
|
-
"What workflow or steps should be followed?",
|
|
642
|
-
"Can you provide 2-3 examples of desired output or style?",
|
|
643
|
-
"What format or style should be replicated?"
|
|
644
|
-
],
|
|
645
|
-
'tidd-ec': [
|
|
646
|
-
"What type of task is this?",
|
|
647
|
-
"What are the exact instructions to follow?",
|
|
648
|
-
"What MUST be included in the output? (explicit dos)",
|
|
649
|
-
"What must be AVOIDED? (explicit don'ts)",
|
|
650
|
-
"Can you provide examples of good output?",
|
|
651
|
-
"What context or background information is relevant?"
|
|
652
|
-
],
|
|
653
|
-
'rtf': [
|
|
654
|
-
"What expertise or perspective is needed?",
|
|
655
|
-
"What exactly needs to be done? (be specific)",
|
|
656
|
-
"How should the output be formatted? (structure, length, style)"
|
|
657
|
-
],
|
|
658
|
-
'ctf': [
|
|
659
|
-
"What is the current situation or background context?",
|
|
660
|
-
"What exactly needs to be done?",
|
|
661
|
-
"How should the output be formatted?"
|
|
662
|
-
],
|
|
663
|
-
'ape': [
|
|
664
|
-
"What is the core action to take? (one clear verb-driven instruction)",
|
|
665
|
-
"Why is this needed? (one sentence on how it will be used)",
|
|
666
|
-
"What does a good result look like? (format, length, quality bar)"
|
|
667
|
-
],
|
|
668
|
-
'race': [
|
|
669
|
-
"What role or expertise should the AI embody?",
|
|
670
|
-
"What exactly needs to be done?",
|
|
671
|
-
"What is the situational background and constraints?",
|
|
672
|
-
"What does a successful output look like?"
|
|
673
|
-
],
|
|
674
|
-
'crispe': [
|
|
675
|
-
"What expertise level and role should be embodied?",
|
|
676
|
-
"What background context and insight is needed?",
|
|
677
|
-
"What are the specific instructions?",
|
|
678
|
-
"What tone and personality should the output have?",
|
|
679
|
-
"How many variants would you like to compare? What dimension of variation?"
|
|
680
|
-
],
|
|
681
|
-
'broke': [
|
|
682
|
-
"What is the current situation and background?",
|
|
683
|
-
"What role should the AI take?",
|
|
684
|
-
"What is the specific objective/deliverable?",
|
|
685
|
-
"What measurable business outcomes should this drive? (Key Results)",
|
|
686
|
-
"Should the AI suggest 3 improvements after responding? (Evolve)"
|
|
687
|
-
],
|
|
688
|
-
'care': [
|
|
689
|
-
"What is the situation and background context?",
|
|
690
|
-
"What is the specific request?",
|
|
691
|
-
"What rules or constraints govern the output? (what must/must not happen)",
|
|
692
|
-
"Can you provide 1-3 examples showing the desired quality or style?"
|
|
693
|
-
],
|
|
694
|
-
'bab': [
|
|
695
|
-
"What is the current state? (what exists now, what's wrong with it)",
|
|
696
|
-
"What should it become? (desired end state and qualities)",
|
|
697
|
-
"What rules govern the transformation? (what to preserve, what to change)"
|
|
698
|
-
],
|
|
699
|
-
'chain_of_density': [
|
|
700
|
-
"What content needs to be compressed or densified?",
|
|
701
|
-
"How many iterations of refinement?",
|
|
702
|
-
"What should each iteration optimize for? (clarity, brevity, information density)",
|
|
703
|
-
"What constraints apply? (length limits, key information to preserve)"
|
|
704
|
-
],
|
|
705
|
-
'skeleton_of_thought': [
|
|
706
|
-
"What is the topic or question to structure?",
|
|
707
|
-
"How many skeleton points? (typically 5-8)",
|
|
708
|
-
"How deeply should each point be expanded?"
|
|
709
|
-
],
|
|
710
|
-
'plan_and_solve': [
|
|
711
|
-
"What is the full problem, including all relevant numbers and variables?",
|
|
712
|
-
"Are there intermediate calculation steps to show?"
|
|
713
|
-
],
|
|
714
|
-
'least_to_most': [
|
|
715
|
-
"What is the full complex problem?",
|
|
716
|
-
"What are the simpler prerequisite subproblems (in dependency order)?",
|
|
717
|
-
"Which subproblem must be solved first?"
|
|
718
|
-
],
|
|
719
|
-
'step_back': [
|
|
720
|
-
"What is the original specific question?",
|
|
721
|
-
"What higher-level principle or concept governs this question?"
|
|
722
|
-
],
|
|
723
|
-
'tree_of_thought': [
|
|
724
|
-
"What decision or problem needs to be solved?",
|
|
725
|
-
"What are the 2-5 distinct approaches or strategies to explore?",
|
|
726
|
-
"What criteria should be used to evaluate each branch?"
|
|
727
|
-
],
|
|
728
|
-
'chain_of_thought': [
|
|
729
|
-
"What problem needs to be reasoned through?",
|
|
730
|
-
"Should intermediate reasoning steps be shown?",
|
|
731
|
-
"What verification or validation is needed?"
|
|
732
|
-
],
|
|
733
|
-
'rcot': [
|
|
734
|
-
"What is the question with all its conditions?",
|
|
735
|
-
"Do you have an initial answer to verify, or should one be generated first?"
|
|
736
|
-
],
|
|
737
|
-
'self_refine': [
|
|
738
|
-
"What output needs to be improved?",
|
|
739
|
-
"What dimensions to evaluate? (e.g., clarity, completeness, tone, security)",
|
|
740
|
-
"How many refinement cycles? What's the stop condition?"
|
|
741
|
-
],
|
|
742
|
-
'cai_critique_revise': [
|
|
743
|
-
"What is the specific principle or standard to enforce?",
|
|
744
|
-
"What output should be critiqued against this principle?"
|
|
745
|
-
],
|
|
746
|
-
'devils_advocate': [
|
|
747
|
-
"What position, plan, or decision should be attacked?",
|
|
748
|
-
"What dimensions to attack? (assumptions, logic, execution risks, alternatives)",
|
|
749
|
-
"Should the 3 most fatal flaws be ranked at the end?"
|
|
750
|
-
],
|
|
751
|
-
'pre_mortem': [
|
|
752
|
-
"What project or decision is being analyzed?",
|
|
753
|
-
"What time horizon? (e.g., 6 months, 12 months from now)",
|
|
754
|
-
"What domains to cover? (technical, people, market, financial, external)"
|
|
755
|
-
],
|
|
756
|
-
'rpef': [
|
|
757
|
-
"What output do you want to reverse-engineer into a prompt?",
|
|
758
|
-
"Do you have the input data that produced this output? (optional)",
|
|
759
|
-
"Should the recovered prompt be specific or a generalized template?"
|
|
760
|
-
],
|
|
761
|
-
'reverse_role': [
|
|
762
|
-
"What is your goal in 1-2 sentences?",
|
|
763
|
-
"What domain or expertise should the AI bring to the interview?",
|
|
764
|
-
"Batch questions (all at once) or conversational (one at a time)?"
|
|
765
|
-
],
|
|
766
|
-
'react': [
|
|
767
|
-
"What is the goal to achieve?",
|
|
768
|
-
"What tools are available? (search, code execution, database, API, etc.)",
|
|
769
|
-
"What constraints apply? (max iterations, stop conditions)"
|
|
770
|
-
]
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
return questions.get(framework_id, [
|
|
774
|
-
"What is the specific task or goal?",
|
|
775
|
-
"What context or background is relevant?",
|
|
776
|
-
"What does a good output look like?"
|
|
777
|
-
])
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
# ─────────────────────────────────────────────────────────────
|
|
781
|
-
# MAIN (example usage)
|
|
782
|
-
# ─────────────────────────────────────────────────────────────
|
|
783
|
-
|
|
784
|
-
if __name__ == "__main__":
|
|
785
|
-
test_prompts = [
|
|
786
|
-
"Write a blog post about machine learning",
|
|
787
|
-
"Analyze this CSV file and find trends",
|
|
788
|
-
"Create a procedure for onboarding new employees",
|
|
789
|
-
"Rewrite this email to sound more professional",
|
|
790
|
-
"What are the risks of our Q4 product launch?",
|
|
791
|
-
"Calculate the payback period: CAC $1200, MRR $150, 70% margin",
|
|
792
|
-
"I want to build something but not sure what I need — can you help?",
|
|
793
|
-
"Recover the prompt from this output: [output example]",
|
|
794
|
-
"Argue against our decision to expand to Europe",
|
|
795
|
-
"Search the web for the latest React hooks documentation and summarize it",
|
|
796
|
-
"Write customer support responses — must be empathetic, don't use jargon",
|
|
797
|
-
"Improve this code review — check for security, readability, and edge cases"
|
|
798
|
-
]
|
|
799
|
-
|
|
800
|
-
for prompt in test_prompts:
|
|
801
|
-
print(f"\nPrompt: {prompt[:60]}...")
|
|
802
|
-
intent, confidence = detect_intent(prompt)
|
|
803
|
-
print(f"Intent: {intent} (confidence: {confidence})")
|
|
804
|
-
recs = analyze_use_case(prompt)
|
|
805
|
-
for rec in recs:
|
|
806
|
-
print(f" → {rec['name']} ({rec['complexity']}) | score: {rec['score']}")
|
|
807
|
-
print(f" Matches: {', '.join(rec['matches'][:2])}")
|
|
1
|
+
"""
|
|
2
|
+
Framework Analyzer - Recommends appropriate prompting frameworks
|
|
3
|
+
Uses intent-based selection matching the 7-category system in SKILL.md
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ─────────────────────────────────────────────────────────────
|
|
7
|
+
# INTENT CATEGORIES (maps to SKILL.md A-G)
|
|
8
|
+
# ─────────────────────────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
INTENT_SIGNALS = {
|
|
11
|
+
'recover': {
|
|
12
|
+
'description': 'Reconstruct a prompt from an existing output',
|
|
13
|
+
'keywords': ['reverse engineer', 'recover prompt', 'what prompt', 'lost prompt',
|
|
14
|
+
'reconstruct prompt', 'template from output', 'prompt that produced'],
|
|
15
|
+
'frameworks': ['rpef']
|
|
16
|
+
},
|
|
17
|
+
'clarify': {
|
|
18
|
+
'description': 'Requirements are unclear; need to gather information first',
|
|
19
|
+
'keywords': ['not sure what i need', 'help me figure out', 'interview me',
|
|
20
|
+
'ask me questions', 'what do i need', 'unclear requirements',
|
|
21
|
+
'not sure how to start'],
|
|
22
|
+
'frameworks': ['reverse_role']
|
|
23
|
+
},
|
|
24
|
+
'create': {
|
|
25
|
+
'description': 'Generating new content from scratch',
|
|
26
|
+
'keywords': ['write', 'create', 'draft', 'generate', 'compose', 'build', 'make',
|
|
27
|
+
'produce', 'develop', 'design'],
|
|
28
|
+
'frameworks': ['co-star', 'risen', 'rise-ie', 'rise-ix', 'tidd-ec',
|
|
29
|
+
'rtf', 'ctf', 'ape', 'race', 'crispe', 'broke', 'care']
|
|
30
|
+
},
|
|
31
|
+
'transform': {
|
|
32
|
+
'description': 'Improving or converting existing content',
|
|
33
|
+
'keywords': ['rewrite', 'refactor', 'convert', 'improve', 'edit', 'revise',
|
|
34
|
+
'transform', 'update', 'change', 'fix', 'clean up', 'restructure',
|
|
35
|
+
'rephrase', 'summarize', 'compress', 'densify', 'expand'],
|
|
36
|
+
'frameworks': ['bab', 'self_refine', 'chain_of_density', 'skeleton_of_thought']
|
|
37
|
+
},
|
|
38
|
+
'reason': {
|
|
39
|
+
'description': 'Solving a reasoning or calculation problem',
|
|
40
|
+
'keywords': ['calculate', 'solve', 'figure out', 'reason', 'analyze', 'evaluate',
|
|
41
|
+
'determine', 'compute', 'derive', 'proof', 'logic', 'math',
|
|
42
|
+
'should i', 'which is better', 'compare options'],
|
|
43
|
+
'frameworks': ['plan_and_solve', 'chain_of_thought', 'least_to_most',
|
|
44
|
+
'step_back', 'tree_of_thought', 'rcot']
|
|
45
|
+
},
|
|
46
|
+
'critique': {
|
|
47
|
+
'description': 'Stress-testing, attacking, or verifying output',
|
|
48
|
+
'keywords': ['review', 'critique', 'evaluate', 'stress test', 'find flaws',
|
|
49
|
+
'what could go wrong', 'attack', 'challenge', 'verify', 'check',
|
|
50
|
+
'validate', 'risks', 'failure modes', 'problems with', 'weaknesses'],
|
|
51
|
+
'frameworks': ['self_refine', 'cai_critique_revise', 'devils_advocate',
|
|
52
|
+
'pre_mortem', 'rcot']
|
|
53
|
+
},
|
|
54
|
+
'agentic': {
|
|
55
|
+
'description': 'Tool-use with iterative reasoning cycles',
|
|
56
|
+
'keywords': ['use tools', 'search and', 'run code', 'execute', 'fetch',
|
|
57
|
+
'query database', 'look up', 'agent', 'automate', 'multi-step with tools'],
|
|
58
|
+
'frameworks': ['react']
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# ─────────────────────────────────────────────────────────────
|
|
63
|
+
# FRAMEWORK DEFINITIONS (all 27)
|
|
64
|
+
# ─────────────────────────────────────────────────────────────
|
|
65
|
+
|
|
66
|
+
FRAMEWORKS = {
|
|
67
|
+
# ── CREATE family ────────────────────────────────────────
|
|
68
|
+
'ape': {
|
|
69
|
+
'name': 'APE',
|
|
70
|
+
'full_name': 'Action, Purpose, Expectation',
|
|
71
|
+
'intent': 'create',
|
|
72
|
+
'complexity': 'minimal',
|
|
73
|
+
'best_for': ['ultra_simple', 'one_off', 'quick_task', 'no_role_needed'],
|
|
74
|
+
'discriminators': ['short prompt', 'one-off', 'simple action'],
|
|
75
|
+
'indicators': {
|
|
76
|
+
'keywords': ['quickly', 'brief', 'simple', 'just'],
|
|
77
|
+
'signals': ['short_prompt', 'no_role', 'no_context_needed']
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
'rtf': {
|
|
81
|
+
'name': 'RTF',
|
|
82
|
+
'full_name': 'Role, Task, Format',
|
|
83
|
+
'intent': 'create',
|
|
84
|
+
'complexity': 'low',
|
|
85
|
+
'best_for': ['simple_tasks', 'expertise_driven', 'format_focused'],
|
|
86
|
+
'discriminators': ['expertise framing matters', 'simple task'],
|
|
87
|
+
'indicators': {
|
|
88
|
+
'keywords': ['format', 'structure', 'template', 'simple', 'quick', 'as a'],
|
|
89
|
+
'signals': ['short_prompt', 'format_primary']
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
'ctf': {
|
|
93
|
+
'name': 'CTF',
|
|
94
|
+
'full_name': 'Context, Task, Format',
|
|
95
|
+
'intent': 'create',
|
|
96
|
+
'complexity': 'low',
|
|
97
|
+
'best_for': ['context_driven', 'simple_tasks', 'situation_matters'],
|
|
98
|
+
'discriminators': ['situation/background more important than expertise'],
|
|
99
|
+
'indicators': {
|
|
100
|
+
'keywords': ['given that', 'because of', 'in this situation', 'mid-project',
|
|
101
|
+
'currently', 'background'],
|
|
102
|
+
'signals': ['context_heavy', 'no_role_needed']
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
'race': {
|
|
106
|
+
'name': 'RACE',
|
|
107
|
+
'full_name': 'Role, Action, Context, Expectation',
|
|
108
|
+
'intent': 'create',
|
|
109
|
+
'complexity': 'medium',
|
|
110
|
+
'best_for': ['expert_task_with_context', 'outcome_clarity_needed'],
|
|
111
|
+
'discriminators': ['role + context + explicit outcome all needed'],
|
|
112
|
+
'indicators': {
|
|
113
|
+
'keywords': ['review', 'assess', 'recommend', 'evaluate with context'],
|
|
114
|
+
'signals': ['role_needed', 'context_needed', 'outcome_explicit']
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
'crispe': {
|
|
118
|
+
'name': 'CRISPE',
|
|
119
|
+
'full_name': 'Capacity+Role, Insight, Instructions, Personality, Experiment',
|
|
120
|
+
'intent': 'create',
|
|
121
|
+
'complexity': 'medium',
|
|
122
|
+
'best_for': ['multiple_variants_needed', 'tone_critical', 'comprehensive'],
|
|
123
|
+
'discriminators': ['multiple output variants needed', 'A/B options'],
|
|
124
|
+
'indicators': {
|
|
125
|
+
'keywords': ['options', 'versions', 'variants', 'different approaches', 'alternatives'],
|
|
126
|
+
'signals': ['multiple_outputs', 'style_critical']
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
'broke': {
|
|
130
|
+
'name': 'BROKE',
|
|
131
|
+
'full_name': 'Background, Role, Objective, Key Results, Evolve',
|
|
132
|
+
'intent': 'create',
|
|
133
|
+
'complexity': 'medium',
|
|
134
|
+
'best_for': ['business_deliverable', 'measurable_outcomes', 'okr_aligned'],
|
|
135
|
+
'discriminators': ['business KPIs exist', 'self-critique loop desired'],
|
|
136
|
+
'indicators': {
|
|
137
|
+
'keywords': ['metric', 'kpi', 'goal', 'objective', 'measure', 'target',
|
|
138
|
+
'revenue', 'conversion', 'reduce', 'increase by'],
|
|
139
|
+
'signals': ['business_kpis', 'iteration_expected']
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
'care': {
|
|
143
|
+
'name': 'CARE',
|
|
144
|
+
'full_name': 'Context, Ask, Rules, Examples',
|
|
145
|
+
'intent': 'create',
|
|
146
|
+
'complexity': 'medium',
|
|
147
|
+
'best_for': ['compliance_required', 'rules_heavy', 'examples_help'],
|
|
148
|
+
'discriminators': ['explicit rules + examples (combined), not separate do/don\'t lists'],
|
|
149
|
+
'indicators': {
|
|
150
|
+
'keywords': ['must not', 'required', 'compliance', 'plain language', 'rule',
|
|
151
|
+
'standard', 'guideline', 'accessibility', 'grade level'],
|
|
152
|
+
'signals': ['rules_important', 'examples_provided', 'compliance']
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
'co-star': {
|
|
156
|
+
'name': 'CO-STAR',
|
|
157
|
+
'full_name': 'Context, Objective, Style, Tone, Audience, Response',
|
|
158
|
+
'intent': 'create',
|
|
159
|
+
'complexity': 'high',
|
|
160
|
+
'best_for': ['content_creation', 'audience_matters', 'tone_critical', 'writing'],
|
|
161
|
+
'discriminators': ['audience/tone/style are critical factors'],
|
|
162
|
+
'indicators': {
|
|
163
|
+
'keywords': ['write', 'create', 'article', 'blog', 'post', 'content', 'email',
|
|
164
|
+
'message', 'audience', 'tone', 'style', 'voice'],
|
|
165
|
+
'signals': ['audience_specified', 'tone_matters', 'writing_task']
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
'risen': {
|
|
169
|
+
'name': 'RISEN',
|
|
170
|
+
'full_name': 'Role, Instructions, Steps, End goal, Narrowing',
|
|
171
|
+
'intent': 'create',
|
|
172
|
+
'complexity': 'high',
|
|
173
|
+
'best_for': ['multi_step_process', 'methodology_matters', 'constraints_important'],
|
|
174
|
+
'discriminators': ['multi-step with constraints and methodology'],
|
|
175
|
+
'indicators': {
|
|
176
|
+
'keywords': ['process', 'procedure', 'workflow', 'steps', 'guide',
|
|
177
|
+
'methodology', 'systematic', 'checklist'],
|
|
178
|
+
'signals': ['sequential_steps', 'methodology_needed']
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
'tidd-ec': {
|
|
182
|
+
'name': 'TIDD-EC',
|
|
183
|
+
'full_name': 'Task type, Instructions, Do, Don\'t, Examples, Context',
|
|
184
|
+
'intent': 'create',
|
|
185
|
+
'complexity': 'high',
|
|
186
|
+
'best_for': ['explicit_dos_donts', 'high_precision', 'compliance_tasks'],
|
|
187
|
+
'discriminators': ['explicit separate DO and DON\'T lists needed'],
|
|
188
|
+
'indicators': {
|
|
189
|
+
'keywords': ['must', 'avoid', "don't", "shouldn't", 'do not', 'never',
|
|
190
|
+
'always', 'requirement', 'boundary', 'compliance', 'support'],
|
|
191
|
+
'signals': ['explicit_dos_donts', 'precision_required']
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
'rise-ie': {
|
|
195
|
+
'name': 'RISE-IE',
|
|
196
|
+
'full_name': 'Role, Input, Steps, Expectation (Input-Expectation)',
|
|
197
|
+
'intent': 'create',
|
|
198
|
+
'complexity': 'medium',
|
|
199
|
+
'best_for': ['data_transformation', 'input_output_defined', 'analytical'],
|
|
200
|
+
'discriminators': ['clear input → output transformation'],
|
|
201
|
+
'indicators': {
|
|
202
|
+
'keywords': ['analyze', 'process', 'transform', 'data', 'input', 'csv',
|
|
203
|
+
'json', 'file', 'extract', 'parse', 'convert'],
|
|
204
|
+
'signals': ['input_defined', 'output_defined', 'transformation']
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
'rise-ix': {
|
|
208
|
+
'name': 'RISE-IX',
|
|
209
|
+
'full_name': 'Role, Instructions, Steps, Examples (Instructions-Examples)',
|
|
210
|
+
'intent': 'create',
|
|
211
|
+
'complexity': 'medium',
|
|
212
|
+
'best_for': ['content_with_examples', 'style_matching', 'creative'],
|
|
213
|
+
'discriminators': ['content creation with reference examples'],
|
|
214
|
+
'indicators': {
|
|
215
|
+
'keywords': ['like this', 'similar to', 'example', 'style', 'format like',
|
|
216
|
+
'match this', 'replicate'],
|
|
217
|
+
'signals': ['examples_provided', 'style_reference']
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
# ── TRANSFORM family ─────────────────────────────────────
|
|
221
|
+
'bab': {
|
|
222
|
+
'name': 'BAB',
|
|
223
|
+
'full_name': 'Before, After, Bridge',
|
|
224
|
+
'intent': 'transform',
|
|
225
|
+
'complexity': 'low',
|
|
226
|
+
'best_for': ['rewrite', 'refactor', 'convert', 'transformation'],
|
|
227
|
+
'discriminators': ['existing content → new form'],
|
|
228
|
+
'indicators': {
|
|
229
|
+
'keywords': ['rewrite', 'refactor', 'convert', 'change this to', 'transform',
|
|
230
|
+
'turn into', 'migrate', 'update to'],
|
|
231
|
+
'signals': ['existing_content', 'desired_state_different']
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
'self_refine': {
|
|
235
|
+
'name': 'Self-Refine',
|
|
236
|
+
'full_name': 'Generate → Feedback → Refine',
|
|
237
|
+
'intent': 'transform',
|
|
238
|
+
'complexity': 'medium',
|
|
239
|
+
'best_for': ['quality_improvement', 'iterative_feedback', 'any_output'],
|
|
240
|
+
'discriminators': ['iterative quality improvement of any output'],
|
|
241
|
+
'indicators': {
|
|
242
|
+
'keywords': ['improve', 'make better', 'enhance', 'refine', 'review and fix',
|
|
243
|
+
'quality check', 'iterate'],
|
|
244
|
+
'signals': ['existing_output', 'quality_improvement']
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
'chain_of_density': {
|
|
248
|
+
'name': 'Chain of Density',
|
|
249
|
+
'full_name': 'Iterative compression and densification',
|
|
250
|
+
'intent': 'transform',
|
|
251
|
+
'complexity': 'medium',
|
|
252
|
+
'best_for': ['summarization', 'compression', 'densification'],
|
|
253
|
+
'discriminators': ['compress/densify content into tighter form'],
|
|
254
|
+
'indicators': {
|
|
255
|
+
'keywords': ['summarize', 'compress', 'condense', 'shorten', 'densify', 'tighten'],
|
|
256
|
+
'signals': ['compression_goal', 'existing_content']
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
'skeleton_of_thought': {
|
|
260
|
+
'name': 'Skeleton of Thought',
|
|
261
|
+
'full_name': 'Skeleton-first then expand (parallel)',
|
|
262
|
+
'intent': 'transform',
|
|
263
|
+
'complexity': 'medium',
|
|
264
|
+
'best_for': ['structured_long_form', 'outline_first', 'multi_section'],
|
|
265
|
+
'discriminators': ['outline-first then expand each section'],
|
|
266
|
+
'indicators': {
|
|
267
|
+
'keywords': ['outline', 'structure', 'organized', 'sections', 'comprehensive',
|
|
268
|
+
'document', 'report'],
|
|
269
|
+
'signals': ['multi_section', 'structure_important']
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
# ── REASON family ─────────────────────────────────────────
|
|
273
|
+
'plan_and_solve': {
|
|
274
|
+
'name': 'Plan-and-Solve (PS+)',
|
|
275
|
+
'full_name': 'Plan first, extract variables, calculate step by step',
|
|
276
|
+
'intent': 'reason',
|
|
277
|
+
'complexity': 'low',
|
|
278
|
+
'best_for': ['numerical_calculation', 'zero_shot_math', 'variable_extraction'],
|
|
279
|
+
'discriminators': ['numerical/calculation, zero-shot'],
|
|
280
|
+
'indicators': {
|
|
281
|
+
'keywords': ['calculate', 'compute', 'math', 'formula', '%', '$', 'total',
|
|
282
|
+
'how many', 'how much', 'rate', 'percentage', 'sum'],
|
|
283
|
+
'signals': ['numbers_present', 'calculation_needed']
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
'least_to_most': {
|
|
287
|
+
'name': 'Least-to-Most',
|
|
288
|
+
'full_name': 'Decompose into ordered subproblems, solve sequentially',
|
|
289
|
+
'intent': 'reason',
|
|
290
|
+
'complexity': 'medium',
|
|
291
|
+
'best_for': ['compositional_reasoning', 'multi_hop', 'dependency_order'],
|
|
292
|
+
'discriminators': ['multi-hop with ordered dependencies (A needed before B)'],
|
|
293
|
+
'indicators': {
|
|
294
|
+
'keywords': ['depends on', 'first need to know', 'requires knowing',
|
|
295
|
+
'multi-step', 'building on', 'chain of'],
|
|
296
|
+
'signals': ['dependency_chain', 'multi_hop']
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
'step_back': {
|
|
300
|
+
'name': 'Step-Back',
|
|
301
|
+
'full_name': 'Abstract to underlying principles, then answer',
|
|
302
|
+
'intent': 'reason',
|
|
303
|
+
'complexity': 'medium',
|
|
304
|
+
'best_for': ['principle_grounded', 'first_principles', 'stem_reasoning'],
|
|
305
|
+
'discriminators': ['needs first-principles reasoning before answering'],
|
|
306
|
+
'indicators': {
|
|
307
|
+
'keywords': ['why does', 'what principle', 'what rule', 'physics', 'chemistry',
|
|
308
|
+
'first principles', 'underlying', 'fundamentally'],
|
|
309
|
+
'signals': ['principle_needed', 'abstract_first']
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
'tree_of_thought': {
|
|
313
|
+
'name': 'Tree of Thought',
|
|
314
|
+
'full_name': 'Branching exploration of multiple solution paths',
|
|
315
|
+
'intent': 'reason',
|
|
316
|
+
'complexity': 'medium',
|
|
317
|
+
'best_for': ['multiple_approaches', 'decision_making', 'trade_off_analysis'],
|
|
318
|
+
'discriminators': ['multiple distinct approaches to compare'],
|
|
319
|
+
'indicators': {
|
|
320
|
+
'keywords': ['which approach', 'options', 'alternatives', 'trade-offs',
|
|
321
|
+
'should we use', 'pros and cons', 'compare', 'choose between'],
|
|
322
|
+
'signals': ['multiple_options', 'decision_needed']
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
'chain_of_thought': {
|
|
326
|
+
'name': 'Chain of Thought',
|
|
327
|
+
'full_name': 'Step-by-step linear reasoning',
|
|
328
|
+
'intent': 'reason',
|
|
329
|
+
'complexity': 'medium',
|
|
330
|
+
'best_for': ['linear_reasoning', 'debugging', 'logical_analysis'],
|
|
331
|
+
'discriminators': ['linear step-by-step reasoning'],
|
|
332
|
+
'indicators': {
|
|
333
|
+
'keywords': ['solve', 'reason', 'think through', 'debug', 'logic',
|
|
334
|
+
'why', 'how does', 'step by step'],
|
|
335
|
+
'signals': ['reasoning_needed', 'linear_path']
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
'rcot': {
|
|
339
|
+
'name': 'RCoT',
|
|
340
|
+
'full_name': 'Reverse Chain-of-Thought (verify by reconstruction)',
|
|
341
|
+
'intent': 'reason',
|
|
342
|
+
'complexity': 'medium',
|
|
343
|
+
'best_for': ['verification', 'multi_condition', 'overlooked_conditions'],
|
|
344
|
+
'discriminators': ['verify reasoning didn\'t overlook conditions'],
|
|
345
|
+
'indicators': {
|
|
346
|
+
'keywords': ['verify', 'check reasoning', 'missed anything', 'conditions',
|
|
347
|
+
'multi-constraint', 'overlook'],
|
|
348
|
+
'signals': ['verification_needed', 'multi_condition']
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
# ── CRITIQUE family ───────────────────────────────────────
|
|
352
|
+
'cai_critique_revise': {
|
|
353
|
+
'name': 'CAI Critique-Revise',
|
|
354
|
+
'full_name': 'Principle-based critique and revision',
|
|
355
|
+
'intent': 'critique',
|
|
356
|
+
'complexity': 'medium',
|
|
357
|
+
'best_for': ['principle_compliance', 'standard_alignment', 'quality_gate'],
|
|
358
|
+
'discriminators': ['align output to explicit stated principle/standard'],
|
|
359
|
+
'indicators': {
|
|
360
|
+
'keywords': ['principle', 'standard', 'policy', 'comply', 'against',
|
|
361
|
+
'violates', 'enforce', 'align to', 'plain language'],
|
|
362
|
+
'signals': ['explicit_principle', 'compliance_check']
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
'devils_advocate': {
|
|
366
|
+
'name': "Devil's Advocate",
|
|
367
|
+
'full_name': 'Strongest opposing argument generation',
|
|
368
|
+
'intent': 'critique',
|
|
369
|
+
'complexity': 'low',
|
|
370
|
+
'best_for': ['decision_testing', 'debiasing', 'find_weaknesses'],
|
|
371
|
+
'discriminators': ['find strongest opposing argument against a position'],
|
|
372
|
+
'indicators': {
|
|
373
|
+
'keywords': ['argue against', 'find flaws', 'challenge', 'opposition',
|
|
374
|
+
'devil\'s advocate', 'steelman', 'counterargument', 'push back'],
|
|
375
|
+
'signals': ['position_to_attack', 'opposing_view']
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
'pre_mortem': {
|
|
379
|
+
'name': 'Pre-Mortem',
|
|
380
|
+
'full_name': 'Assume failure, work backwards to causes',
|
|
381
|
+
'intent': 'critique',
|
|
382
|
+
'complexity': 'low',
|
|
383
|
+
'best_for': ['risk_identification', 'failure_analysis', 'pre_launch'],
|
|
384
|
+
'discriminators': ['identify failure modes before they happen'],
|
|
385
|
+
'indicators': {
|
|
386
|
+
'keywords': ['risks', 'failure', 'what could go wrong', 'pre-mortem',
|
|
387
|
+
'before launch', 'potential problems', 'failure modes'],
|
|
388
|
+
'signals': ['risk_analysis', 'forward_looking']
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
# ── META/REVERSE family ───────────────────────────────────
|
|
392
|
+
'rpef': {
|
|
393
|
+
'name': 'RPEF',
|
|
394
|
+
'full_name': 'Reverse Prompt Engineering Framework',
|
|
395
|
+
'intent': 'recover',
|
|
396
|
+
'complexity': 'low',
|
|
397
|
+
'best_for': ['recover_prompt', 'template_from_output', 'reverse_engineer'],
|
|
398
|
+
'discriminators': ['reconstruct a prompt from an existing output'],
|
|
399
|
+
'indicators': {
|
|
400
|
+
'keywords': ['reverse engineer', 'recover prompt', 'what prompt created',
|
|
401
|
+
'prompt template from', 'reconstruct'],
|
|
402
|
+
'signals': ['output_provided', 'prompt_recovery']
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
'reverse_role': {
|
|
406
|
+
'name': 'Reverse Role Prompting',
|
|
407
|
+
'full_name': 'AI-Led Interview (FATA)',
|
|
408
|
+
'intent': 'clarify',
|
|
409
|
+
'complexity': 'low',
|
|
410
|
+
'best_for': ['unclear_requirements', 'non_expert_user', 'discovery'],
|
|
411
|
+
'discriminators': ['gather information before executing'],
|
|
412
|
+
'indicators': {
|
|
413
|
+
'keywords': ['not sure', 'help me figure out', 'ask me', 'interview',
|
|
414
|
+
'what do i need', 'unclear', 'don\'t know how to start'],
|
|
415
|
+
'signals': ['requirements_unclear', 'needs_clarification']
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
# ── AGENTIC family ────────────────────────────────────────
|
|
419
|
+
'react': {
|
|
420
|
+
'name': 'ReAct',
|
|
421
|
+
'full_name': 'Reasoning + Acting (Thought-Action-Observation)',
|
|
422
|
+
'intent': 'agentic',
|
|
423
|
+
'complexity': 'medium',
|
|
424
|
+
'best_for': ['tool_use', 'agentic_workflow', 'iterative_tool_reasoning'],
|
|
425
|
+
'discriminators': ['task requires tools; each result informs next step'],
|
|
426
|
+
'indicators': {
|
|
427
|
+
'keywords': ['search', 'run code', 'query', 'fetch', 'execute', 'agent',
|
|
428
|
+
'use tools', 'look up', 'database', 'api call'],
|
|
429
|
+
'signals': ['tools_available', 'iterative_tool_use']
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
# ─────────────────────────────────────────────────────────────
|
|
436
|
+
# INTENT DETECTION
|
|
437
|
+
# ─────────────────────────────────────────────────────────────
|
|
438
|
+
|
|
439
|
+
def detect_intent(prompt_text):
|
|
440
|
+
"""
|
|
441
|
+
Detect the primary intent category from a prompt.
|
|
442
|
+
Returns intent category and confidence.
|
|
443
|
+
"""
|
|
444
|
+
prompt_lower = prompt_text.lower()
|
|
445
|
+
intent_scores = {}
|
|
446
|
+
|
|
447
|
+
for intent, config in INTENT_SIGNALS.items():
|
|
448
|
+
score = 0
|
|
449
|
+
for keyword in config['keywords']:
|
|
450
|
+
if keyword in prompt_lower:
|
|
451
|
+
score += 3
|
|
452
|
+
intent_scores[intent] = score
|
|
453
|
+
|
|
454
|
+
# Sort by score
|
|
455
|
+
sorted_intents = sorted(intent_scores.items(), key=lambda x: x[1], reverse=True)
|
|
456
|
+
top_intent = sorted_intents[0]
|
|
457
|
+
|
|
458
|
+
# If no strong intent signal, default to 'create' (most common)
|
|
459
|
+
if top_intent[1] == 0:
|
|
460
|
+
return 'create', 0
|
|
461
|
+
return top_intent[0], top_intent[1]
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
# ─────────────────────────────────────────────────────────────
|
|
465
|
+
# FRAMEWORK RECOMMENDATION
|
|
466
|
+
# ─────────────────────────────────────────────────────────────
|
|
467
|
+
|
|
468
|
+
def analyze_use_case(prompt_text):
|
|
469
|
+
"""
|
|
470
|
+
Analyze a prompt and recommend appropriate frameworks.
|
|
471
|
+
Uses intent-based selection matching SKILL.md's 7-category system.
|
|
472
|
+
|
|
473
|
+
Args:
|
|
474
|
+
prompt_text (str): The user's original prompt
|
|
475
|
+
|
|
476
|
+
Returns:
|
|
477
|
+
list: Recommended frameworks with reasoning
|
|
478
|
+
"""
|
|
479
|
+
prompt_lower = prompt_text.lower()
|
|
480
|
+
word_count = len(prompt_text.split())
|
|
481
|
+
|
|
482
|
+
# Step 1: Detect primary intent
|
|
483
|
+
intent, intent_confidence = detect_intent(prompt_text)
|
|
484
|
+
|
|
485
|
+
# Step 2: Get candidate frameworks for this intent
|
|
486
|
+
candidate_ids = INTENT_SIGNALS.get(intent, {}).get('frameworks', [])
|
|
487
|
+
|
|
488
|
+
# Step 3: Score candidates using discriminators
|
|
489
|
+
scores = {}
|
|
490
|
+
for fw_id in candidate_ids:
|
|
491
|
+
if fw_id not in FRAMEWORKS:
|
|
492
|
+
continue
|
|
493
|
+
fw = FRAMEWORKS[fw_id]
|
|
494
|
+
score = intent_confidence # Base score from intent match
|
|
495
|
+
matches = [f"intent: {intent}"]
|
|
496
|
+
|
|
497
|
+
for keyword in fw['indicators'].get('keywords', []):
|
|
498
|
+
if keyword in prompt_lower:
|
|
499
|
+
score += 2
|
|
500
|
+
matches.append(f"keyword: '{keyword}'")
|
|
501
|
+
|
|
502
|
+
# Apply framework-specific heuristics
|
|
503
|
+
if fw_id == 'ape' and word_count < 10:
|
|
504
|
+
score += 3
|
|
505
|
+
matches.append("very short prompt → ultra-minimal framework")
|
|
506
|
+
|
|
507
|
+
if fw_id == 'rtf' and word_count < 20:
|
|
508
|
+
score += 2
|
|
509
|
+
matches.append("short, focused prompt → RTF")
|
|
510
|
+
|
|
511
|
+
if fw_id == 'co-star' and any(w in prompt_lower for w in ['audience', 'tone', 'style', 'readers']):
|
|
512
|
+
score += 4
|
|
513
|
+
matches.append("audience/tone/style signals → CO-STAR")
|
|
514
|
+
|
|
515
|
+
if fw_id == 'tidd-ec' and any(w in prompt_lower for w in ["don't", "avoid", "must not", "never"]):
|
|
516
|
+
score += 4
|
|
517
|
+
matches.append("explicit don'ts → TIDD-EC over CARE")
|
|
518
|
+
|
|
519
|
+
if fw_id == 'care' and 'example' in prompt_lower and 'rule' in prompt_lower:
|
|
520
|
+
score += 3
|
|
521
|
+
matches.append("rules + examples → CARE")
|
|
522
|
+
|
|
523
|
+
if fw_id == 'broke':
|
|
524
|
+
if any(w in prompt_lower for w in ['metric', 'kpi', 'target', 'revenue', 'conversion']):
|
|
525
|
+
score += 4
|
|
526
|
+
matches.append("business KPI signals → BROKE")
|
|
527
|
+
|
|
528
|
+
if fw_id == 'risen' and any(w in prompt_lower for w in ['step', 'process', 'procedure', 'workflow']):
|
|
529
|
+
score += 3
|
|
530
|
+
matches.append("process signals → RISEN")
|
|
531
|
+
|
|
532
|
+
if fw_id == 'rise-ie' and any(w in prompt_lower for w in ['csv', 'json', 'data', 'file', 'input']):
|
|
533
|
+
score += 4
|
|
534
|
+
matches.append("data transformation signals → RISE-IE")
|
|
535
|
+
|
|
536
|
+
if fw_id == 'rise-ix' and any(w in prompt_lower for w in ['example', 'like', 'similar', 'style']):
|
|
537
|
+
score += 4
|
|
538
|
+
matches.append("style/example signals → RISE-IX")
|
|
539
|
+
|
|
540
|
+
if fw_id == 'bab' and any(w in prompt_lower for w in ['rewrite', 'refactor', 'convert', 'transform']):
|
|
541
|
+
score += 4
|
|
542
|
+
matches.append("transformation signals → BAB")
|
|
543
|
+
|
|
544
|
+
if fw_id == 'plan_and_solve' and any(c.isdigit() for c in prompt_text):
|
|
545
|
+
score += 3
|
|
546
|
+
matches.append("numbers present → Plan-and-Solve")
|
|
547
|
+
|
|
548
|
+
if fw_id == 'pre_mortem' and any(w in prompt_lower for w in ['risk', 'failure', 'wrong', 'fail']):
|
|
549
|
+
score += 4
|
|
550
|
+
matches.append("failure/risk signals → Pre-Mortem")
|
|
551
|
+
|
|
552
|
+
if fw_id == 'devils_advocate' and any(w in prompt_lower for w in ['challenge', 'argue', 'flaw', 'wrong']):
|
|
553
|
+
score += 4
|
|
554
|
+
matches.append("challenge/flaw signals → Devil's Advocate")
|
|
555
|
+
|
|
556
|
+
scores[fw_id] = {'score': score, 'matches': matches, 'framework': FRAMEWORKS[fw_id]}
|
|
557
|
+
|
|
558
|
+
# Sort by score, return top 2
|
|
559
|
+
sorted_frameworks = sorted(scores.items(), key=lambda x: x[1]['score'], reverse=True)
|
|
560
|
+
|
|
561
|
+
recommendations = []
|
|
562
|
+
for fw_id, data in sorted_frameworks[:2]:
|
|
563
|
+
if data['score'] > 0:
|
|
564
|
+
fw = data['framework']
|
|
565
|
+
recommendations.append({
|
|
566
|
+
'id': fw_id,
|
|
567
|
+
'name': fw['name'],
|
|
568
|
+
'full_name': fw['full_name'],
|
|
569
|
+
'intent': intent,
|
|
570
|
+
'score': data['score'],
|
|
571
|
+
'matches': data['matches'],
|
|
572
|
+
'complexity': fw['complexity'],
|
|
573
|
+
'best_for': fw['best_for'],
|
|
574
|
+
'discriminators': fw.get('discriminators', [])
|
|
575
|
+
})
|
|
576
|
+
|
|
577
|
+
# Fallback: if no candidates scored, suggest based on intent alone
|
|
578
|
+
if not recommendations:
|
|
579
|
+
fallback_map = {
|
|
580
|
+
'create': 'rtf', 'transform': 'bab', 'reason': 'chain_of_thought',
|
|
581
|
+
'critique': 'self_refine', 'recover': 'rpef',
|
|
582
|
+
'clarify': 'reverse_role', 'agentic': 'react'
|
|
583
|
+
}
|
|
584
|
+
fw_id = fallback_map.get(intent, 'rtf')
|
|
585
|
+
fw = FRAMEWORKS[fw_id]
|
|
586
|
+
recommendations.append({
|
|
587
|
+
'id': fw_id,
|
|
588
|
+
'name': fw['name'],
|
|
589
|
+
'full_name': fw['full_name'],
|
|
590
|
+
'intent': intent,
|
|
591
|
+
'score': 1,
|
|
592
|
+
'matches': [f"fallback for intent: {intent}"],
|
|
593
|
+
'complexity': fw['complexity'],
|
|
594
|
+
'best_for': fw['best_for'],
|
|
595
|
+
'discriminators': fw.get('discriminators', [])
|
|
596
|
+
})
|
|
597
|
+
|
|
598
|
+
return recommendations
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
# ─────────────────────────────────────────────────────────────
|
|
602
|
+
# CLARIFICATION QUESTIONS
|
|
603
|
+
# ─────────────────────────────────────────────────────────────
|
|
604
|
+
|
|
605
|
+
def get_framework_questions(framework_id):
|
|
606
|
+
"""
|
|
607
|
+
Get clarifying questions for a specific framework.
|
|
608
|
+
|
|
609
|
+
Args:
|
|
610
|
+
framework_id (str): Framework identifier
|
|
611
|
+
|
|
612
|
+
Returns:
|
|
613
|
+
list: Questions to ask user
|
|
614
|
+
"""
|
|
615
|
+
questions = {
|
|
616
|
+
'co-star': [
|
|
617
|
+
"What's the background context or situation?",
|
|
618
|
+
"Who is your target audience? (expertise level, role, characteristics)",
|
|
619
|
+
"What specific objective do you want to achieve?",
|
|
620
|
+
"What tone is appropriate? (professional, casual, urgent, friendly)",
|
|
621
|
+
"What style or format should the output follow?",
|
|
622
|
+
"How should the response be structured? (length, sections, format)"
|
|
623
|
+
],
|
|
624
|
+
'risen': [
|
|
625
|
+
"What role or expertise level should be demonstrated?",
|
|
626
|
+
"What principles or guidelines should guide the approach?",
|
|
627
|
+
"What are the specific steps or sequence of actions needed?",
|
|
628
|
+
"What defines success? What are the acceptance criteria?",
|
|
629
|
+
"What should be avoided? What constraints or boundaries exist?"
|
|
630
|
+
],
|
|
631
|
+
'rise-ie': [
|
|
632
|
+
"What role or perspective is needed for this analytical task?",
|
|
633
|
+
"What input are you providing? (format: CSV, JSON, text, etc.)",
|
|
634
|
+
"What are the characteristics of the input data?",
|
|
635
|
+
"What processing or transformation steps are needed?",
|
|
636
|
+
"What should the output look like? (format, structure, required elements)"
|
|
637
|
+
],
|
|
638
|
+
'rise-ix': [
|
|
639
|
+
"What role or persona is most appropriate?",
|
|
640
|
+
"What are the main instructions or task requirements?",
|
|
641
|
+
"What workflow or steps should be followed?",
|
|
642
|
+
"Can you provide 2-3 examples of desired output or style?",
|
|
643
|
+
"What format or style should be replicated?"
|
|
644
|
+
],
|
|
645
|
+
'tidd-ec': [
|
|
646
|
+
"What type of task is this?",
|
|
647
|
+
"What are the exact instructions to follow?",
|
|
648
|
+
"What MUST be included in the output? (explicit dos)",
|
|
649
|
+
"What must be AVOIDED? (explicit don'ts)",
|
|
650
|
+
"Can you provide examples of good output?",
|
|
651
|
+
"What context or background information is relevant?"
|
|
652
|
+
],
|
|
653
|
+
'rtf': [
|
|
654
|
+
"What expertise or perspective is needed?",
|
|
655
|
+
"What exactly needs to be done? (be specific)",
|
|
656
|
+
"How should the output be formatted? (structure, length, style)"
|
|
657
|
+
],
|
|
658
|
+
'ctf': [
|
|
659
|
+
"What is the current situation or background context?",
|
|
660
|
+
"What exactly needs to be done?",
|
|
661
|
+
"How should the output be formatted?"
|
|
662
|
+
],
|
|
663
|
+
'ape': [
|
|
664
|
+
"What is the core action to take? (one clear verb-driven instruction)",
|
|
665
|
+
"Why is this needed? (one sentence on how it will be used)",
|
|
666
|
+
"What does a good result look like? (format, length, quality bar)"
|
|
667
|
+
],
|
|
668
|
+
'race': [
|
|
669
|
+
"What role or expertise should the AI embody?",
|
|
670
|
+
"What exactly needs to be done?",
|
|
671
|
+
"What is the situational background and constraints?",
|
|
672
|
+
"What does a successful output look like?"
|
|
673
|
+
],
|
|
674
|
+
'crispe': [
|
|
675
|
+
"What expertise level and role should be embodied?",
|
|
676
|
+
"What background context and insight is needed?",
|
|
677
|
+
"What are the specific instructions?",
|
|
678
|
+
"What tone and personality should the output have?",
|
|
679
|
+
"How many variants would you like to compare? What dimension of variation?"
|
|
680
|
+
],
|
|
681
|
+
'broke': [
|
|
682
|
+
"What is the current situation and background?",
|
|
683
|
+
"What role should the AI take?",
|
|
684
|
+
"What is the specific objective/deliverable?",
|
|
685
|
+
"What measurable business outcomes should this drive? (Key Results)",
|
|
686
|
+
"Should the AI suggest 3 improvements after responding? (Evolve)"
|
|
687
|
+
],
|
|
688
|
+
'care': [
|
|
689
|
+
"What is the situation and background context?",
|
|
690
|
+
"What is the specific request?",
|
|
691
|
+
"What rules or constraints govern the output? (what must/must not happen)",
|
|
692
|
+
"Can you provide 1-3 examples showing the desired quality or style?"
|
|
693
|
+
],
|
|
694
|
+
'bab': [
|
|
695
|
+
"What is the current state? (what exists now, what's wrong with it)",
|
|
696
|
+
"What should it become? (desired end state and qualities)",
|
|
697
|
+
"What rules govern the transformation? (what to preserve, what to change)"
|
|
698
|
+
],
|
|
699
|
+
'chain_of_density': [
|
|
700
|
+
"What content needs to be compressed or densified?",
|
|
701
|
+
"How many iterations of refinement?",
|
|
702
|
+
"What should each iteration optimize for? (clarity, brevity, information density)",
|
|
703
|
+
"What constraints apply? (length limits, key information to preserve)"
|
|
704
|
+
],
|
|
705
|
+
'skeleton_of_thought': [
|
|
706
|
+
"What is the topic or question to structure?",
|
|
707
|
+
"How many skeleton points? (typically 5-8)",
|
|
708
|
+
"How deeply should each point be expanded?"
|
|
709
|
+
],
|
|
710
|
+
'plan_and_solve': [
|
|
711
|
+
"What is the full problem, including all relevant numbers and variables?",
|
|
712
|
+
"Are there intermediate calculation steps to show?"
|
|
713
|
+
],
|
|
714
|
+
'least_to_most': [
|
|
715
|
+
"What is the full complex problem?",
|
|
716
|
+
"What are the simpler prerequisite subproblems (in dependency order)?",
|
|
717
|
+
"Which subproblem must be solved first?"
|
|
718
|
+
],
|
|
719
|
+
'step_back': [
|
|
720
|
+
"What is the original specific question?",
|
|
721
|
+
"What higher-level principle or concept governs this question?"
|
|
722
|
+
],
|
|
723
|
+
'tree_of_thought': [
|
|
724
|
+
"What decision or problem needs to be solved?",
|
|
725
|
+
"What are the 2-5 distinct approaches or strategies to explore?",
|
|
726
|
+
"What criteria should be used to evaluate each branch?"
|
|
727
|
+
],
|
|
728
|
+
'chain_of_thought': [
|
|
729
|
+
"What problem needs to be reasoned through?",
|
|
730
|
+
"Should intermediate reasoning steps be shown?",
|
|
731
|
+
"What verification or validation is needed?"
|
|
732
|
+
],
|
|
733
|
+
'rcot': [
|
|
734
|
+
"What is the question with all its conditions?",
|
|
735
|
+
"Do you have an initial answer to verify, or should one be generated first?"
|
|
736
|
+
],
|
|
737
|
+
'self_refine': [
|
|
738
|
+
"What output needs to be improved?",
|
|
739
|
+
"What dimensions to evaluate? (e.g., clarity, completeness, tone, security)",
|
|
740
|
+
"How many refinement cycles? What's the stop condition?"
|
|
741
|
+
],
|
|
742
|
+
'cai_critique_revise': [
|
|
743
|
+
"What is the specific principle or standard to enforce?",
|
|
744
|
+
"What output should be critiqued against this principle?"
|
|
745
|
+
],
|
|
746
|
+
'devils_advocate': [
|
|
747
|
+
"What position, plan, or decision should be attacked?",
|
|
748
|
+
"What dimensions to attack? (assumptions, logic, execution risks, alternatives)",
|
|
749
|
+
"Should the 3 most fatal flaws be ranked at the end?"
|
|
750
|
+
],
|
|
751
|
+
'pre_mortem': [
|
|
752
|
+
"What project or decision is being analyzed?",
|
|
753
|
+
"What time horizon? (e.g., 6 months, 12 months from now)",
|
|
754
|
+
"What domains to cover? (technical, people, market, financial, external)"
|
|
755
|
+
],
|
|
756
|
+
'rpef': [
|
|
757
|
+
"What output do you want to reverse-engineer into a prompt?",
|
|
758
|
+
"Do you have the input data that produced this output? (optional)",
|
|
759
|
+
"Should the recovered prompt be specific or a generalized template?"
|
|
760
|
+
],
|
|
761
|
+
'reverse_role': [
|
|
762
|
+
"What is your goal in 1-2 sentences?",
|
|
763
|
+
"What domain or expertise should the AI bring to the interview?",
|
|
764
|
+
"Batch questions (all at once) or conversational (one at a time)?"
|
|
765
|
+
],
|
|
766
|
+
'react': [
|
|
767
|
+
"What is the goal to achieve?",
|
|
768
|
+
"What tools are available? (search, code execution, database, API, etc.)",
|
|
769
|
+
"What constraints apply? (max iterations, stop conditions)"
|
|
770
|
+
]
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
return questions.get(framework_id, [
|
|
774
|
+
"What is the specific task or goal?",
|
|
775
|
+
"What context or background is relevant?",
|
|
776
|
+
"What does a good output look like?"
|
|
777
|
+
])
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
# ─────────────────────────────────────────────────────────────
|
|
781
|
+
# MAIN (example usage)
|
|
782
|
+
# ─────────────────────────────────────────────────────────────
|
|
783
|
+
|
|
784
|
+
if __name__ == "__main__":
|
|
785
|
+
test_prompts = [
|
|
786
|
+
"Write a blog post about machine learning",
|
|
787
|
+
"Analyze this CSV file and find trends",
|
|
788
|
+
"Create a procedure for onboarding new employees",
|
|
789
|
+
"Rewrite this email to sound more professional",
|
|
790
|
+
"What are the risks of our Q4 product launch?",
|
|
791
|
+
"Calculate the payback period: CAC $1200, MRR $150, 70% margin",
|
|
792
|
+
"I want to build something but not sure what I need — can you help?",
|
|
793
|
+
"Recover the prompt from this output: [output example]",
|
|
794
|
+
"Argue against our decision to expand to Europe",
|
|
795
|
+
"Search the web for the latest React hooks documentation and summarize it",
|
|
796
|
+
"Write customer support responses — must be empathetic, don't use jargon",
|
|
797
|
+
"Improve this code review — check for security, readability, and edge cases"
|
|
798
|
+
]
|
|
799
|
+
|
|
800
|
+
for prompt in test_prompts:
|
|
801
|
+
print(f"\nPrompt: {prompt[:60]}...")
|
|
802
|
+
intent, confidence = detect_intent(prompt)
|
|
803
|
+
print(f"Intent: {intent} (confidence: {confidence})")
|
|
804
|
+
recs = analyze_use_case(prompt)
|
|
805
|
+
for rec in recs:
|
|
806
|
+
print(f" → {rec['name']} ({rec['complexity']}) | score: {rec['score']}")
|
|
807
|
+
print(f" Matches: {', '.join(rec['matches'][:2])}")
|