@ckelsoe/prompt-architect 3.0.0 → 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 -135
  10. package/scripts/build-skill.js +64 -0
  11. package/scripts/install.js +35 -56
  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,479 +1,479 @@
1
- # Chain of Density (CoD) Framework
2
-
3
- ## Overview
4
-
5
- Chain of Density is an iterative refinement technique that progressively improves outputs through multiple passes. Each iteration increases information density, removes redundancy, and enhances quality without significantly increasing length. It's based on the insight that iteration often produces better results than trying to get everything perfect in one shot.
6
-
7
- ## Core Concept
8
-
9
- Instead of requesting the perfect output immediately, CoD:
10
- 1. Starts with a basic/verbose version
11
- 2. Iteratively refines through multiple passes
12
- 3. Increases information density each time
13
- 4. Removes fluff and redundancy
14
- 5. Enhances clarity and precision
15
- 6. Converges on optimal output
16
-
17
- Think of it as "progressive enhancement" for prompts.
18
-
19
- ## When to Use Chain of Density
20
-
21
- **Ideal for:**
22
- - Summarization tasks
23
- - Content compression
24
- - Iterative improvement of writing
25
- - Optimizing explanations
26
- - Refining complex outputs
27
- - Tasks where quality improves with iteration
28
-
29
- **Not needed for:**
30
- - Simple one-shot tasks
31
- - When first draft is sufficient
32
- - Time-critical quick tasks
33
- - Tasks with fixed formats that can't improve
34
-
35
- ## Implementation Approaches
36
-
37
- ### Approach 1: Explicit Multi-Pass
38
- Request multiple iterations upfront.
39
-
40
- **Example:**
41
- ```
42
- Create a summary of this article using Chain of Density:
43
-
44
- ITERATION 1:
45
- Write a verbose summary hitting all main points (150-200 words)
46
-
47
- ITERATION 2:
48
- Refine the summary: increase information density, remove redundancy, keep it under 150 words
49
-
50
- ITERATION 3:
51
- Further refine: make every word count, increase precision, keep it under 120 words
52
-
53
- ITERATION 4:
54
- Final pass: maximize information density while maintaining clarity (100 words max)
55
-
56
- ITERATION 5:
57
- Ultimate compression: distill to absolute essentials (50 words max)
58
-
59
- After all iterations, explain what improved in each pass.
60
- ```
61
-
62
- ### Approach 2: Recursive Refinement
63
- Use output from one iteration as input to the next.
64
-
65
- **Example:**
66
- ```
67
- PASS 1: Write a first draft explanation of quantum entanglement for a general audience.
68
-
69
- PASS 2: Review your explanation. What's unclear? What's redundant? Rewrite it, addressing these issues.
70
-
71
- PASS 3: Review again. Where can you be more precise? Where can you use better examples? Rewrite.
72
-
73
- PASS 4: Final review. Every sentence should earn its place. Remove or improve anything that doesn't. Final version.
74
-
75
- Show all passes so we can see the evolution.
76
- ```
77
-
78
- ### Approach 3: Targeted Improvement
79
- Focus each iteration on specific aspect.
80
-
81
- **Example:**
82
- ```
83
- Write a product description, then improve it iteratively:
84
-
85
- DRAFT:
86
- [Initial version]
87
-
88
- ITERATION 1 - CLARITY:
89
- Rewrite focusing on making it clearer and easier to understand.
90
-
91
- ITERATION 2 - IMPACT:
92
- Rewrite focusing on making it more compelling and persuasive.
93
-
94
- ITERATION 3 - CONCISION:
95
- Rewrite focusing on removing every unnecessary word.
96
-
97
- ITERATION 4 - PRECISION:
98
- Rewrite focusing on being more specific and accurate.
99
-
100
- FINAL:
101
- Combine the best elements from all iterations.
102
- ```
103
-
104
- ### Approach 4: Constraint-Based Refinement
105
- Add tighter constraints with each iteration.
106
-
107
- **Example:**
108
- ```
109
- Explain this technical concept through progressive refinement:
110
-
111
- VERSION 1: Explain in 500 words or less
112
- VERSION 2: Reduce to 300 words without losing key information
113
- VERSION 3: Reduce to 150 words, keeping only essentials
114
- VERSION 4: Create a 50-word version capturing the core idea
115
- VERSION 5: One sentence (25 words max)
116
-
117
- Each version should be complete and self-contained.
118
- ```
119
-
120
- ## Best Practices
121
-
122
- ### 1. Define What to Optimize
123
- ```
124
- Good:
125
- "Iterate to improve:
126
- - Information density
127
- - Clarity
128
- - Conciseness
129
- - Precision"
130
-
131
- Poor:
132
- "Make it better"
133
- ```
134
-
135
- ### 2. Specify Number of Iterations
136
- ```
137
- Good:
138
- "Refine through 4 iterations, showing each version"
139
-
140
- Poor:
141
- "Keep improving until it's good"
142
- ```
143
-
144
- ### 3. Show Evolution
145
- ```
146
- Good:
147
- "Show each iteration and explain what changed and why"
148
-
149
- Poor:
150
- "Just give me the final version"
151
- ```
152
-
153
- ### 4. Set Clear Constraints
154
- ```
155
- Good:
156
- "Each iteration should be 20% shorter while maintaining completeness"
157
-
158
- Poor:
159
- "Make it shorter"
160
- ```
161
-
162
- ## Complete Examples
163
-
164
- ### Example 1: Summarization
165
-
166
- **Without CoD:**
167
- ```
168
- Summarize this research paper.
169
- ```
170
-
171
- **With CoD:**
172
- ```
173
- Summarize this research paper using Chain of Density:
174
-
175
- [Paper content]
176
-
177
- ITERATION 1 (200 words):
178
- Create a comprehensive summary covering all major points. Prioritize completeness over brevity.
179
-
180
- ITERATION 2 (150 words):
181
- Refine the summary:
182
- - Remove redundant information
183
- - Combine related points
184
- - Increase information density
185
-
186
- ITERATION 3 (100 words):
187
- Further compression:
188
- - Keep only essential information
189
- - Make every sentence count
190
- - Maintain accuracy
191
-
192
- ITERATION 4 (75 words):
193
- Maximum density:
194
- - Distill to core findings
195
- - Remove all fluff
196
- - Preserve critical details
197
-
198
- For each iteration, highlight what you removed and why.
199
- ```
200
-
201
- ### Example 2: Code Documentation
202
-
203
- **Without CoD:**
204
- ```
205
- Document this function.
206
- ```
207
-
208
- **With CoD:**
209
- ```
210
- Document this function through iterative refinement:
211
-
212
- [Code]
213
-
214
- DRAFT DOCUMENTATION:
215
- Write complete documentation with examples, edge cases, everything.
216
-
217
- ITERATION 1 - CLARITY:
218
- Review and rewrite confusing sections. Add examples where helpful.
219
-
220
- ITERATION 2 - CONCISION:
221
- Remove redundancy. Combine related points. Make it tighter.
222
-
223
- ITERATION 3 - PRECISION:
224
- Be more specific about types, behaviors, edge cases.
225
-
226
- ITERATION 4 - USABILITY:
227
- Optimize for developer experience. What do they need to know most?
228
-
229
- Show each version and explain key changes.
230
- ```
231
-
232
- ### Example 3: Email Refinement
233
-
234
- **Without CoD:**
235
- ```
236
- Write an email announcing this feature.
237
- ```
238
-
239
- **With CoD:**
240
- ```
241
- Draft an announcement email, then refine it:
242
-
243
- DRAFT:
244
- Write a first draft covering all important information.
245
-
246
- ITERATION 1 - STRUCTURE:
247
- Reorganize for better flow. Most important information first.
248
-
249
- ITERATION 2 - CLARITY:
250
- Simplify language. Remove jargon. Make it scannable.
251
-
252
- ITERATION 3 - ENGAGEMENT:
253
- Strengthen the call-to-action. Make it more compelling.
254
-
255
- ITERATION 4 - POLISH:
256
- Final edits for tone, concision, impact.
257
-
258
- Show the evolution and explain major changes.
259
- ```
260
-
261
- ### Example 4: Technical Explanation
262
-
263
- **Without CoD:**
264
- ```
265
- Explain how this algorithm works.
266
- ```
267
-
268
- **With CoD:**
269
- ```
270
- Explain this algorithm through progressive refinement:
271
-
272
- PASS 1 - COMPREHENSIVE:
273
- Explain thoroughly, assuming no prior knowledge. Include:
274
- - What it does
275
- - How it works
276
- - Why it's designed this way
277
- - Example walkthrough
278
-
279
- PASS 2 - REFINED:
280
- Review Pass 1. What's unclear? What's redundant? Rewrite addressing these.
281
-
282
- PASS 3 - OPTIMIZED:
283
- Make it maximally clear and concise. Every paragraph must earn its place.
284
-
285
- PASS 4 - POLISHED:
286
- Final pass. Perfect clarity, zero fluff, optimal examples.
287
-
288
- Show all passes and note significant improvements.
289
- ```
290
-
291
- ## Combining CoD with Other Frameworks
292
-
293
- ### CoD + CO-STAR
294
- ```
295
- CONTEXT: [Background]
296
- OBJECTIVE: [Goal]
297
- STYLE: [Writing style]
298
- TONE: [Tone]
299
- AUDIENCE: [Readers]
300
-
301
- RESPONSE PROCESS (Chain of Density):
302
- Draft 1: [Comprehensive version]
303
- Draft 2: [Refined for clarity]
304
- Draft 3: [Optimized for audience]
305
- Draft 4: [Final polished version]
306
- ```
307
-
308
- ### CoD + RISEN
309
- ```
310
- ROLE: [Expertise]
311
- INSTRUCTIONS: Use iterative refinement
312
- STEPS:
313
- 1. Create initial version
314
- 2. Review and identify weaknesses
315
- 3. Refine addressing weaknesses
316
- 4. Repeat until optimal
317
- END GOAL: [Final quality criteria]
318
- NARROWING: [Constraints on iterations]
319
- ```
320
-
321
- ### CoD + Chain of Thought
322
- ```
323
- For each iteration of Chain of Density, use Chain of Thought:
324
-
325
- ITERATION 1:
326
- Think through: What should this initial version include?
327
- [Create version]
328
-
329
- ITERATION 2:
330
- Think through: What weaknesses exist? How to address them?
331
- [Refine version]
332
-
333
- ITERATION 3:
334
- Think through: What can be compressed or improved?
335
- [Further refine]
336
- ```
337
-
338
- ## Advanced Techniques
339
-
340
- ### Aspect-Focused Iteration
341
- Each iteration improves a different dimension:
342
-
343
- ```
344
- ITERATION 1 - ACCURACY: Get the facts right
345
- ITERATION 2 - CLARITY: Make it understandable
346
- ITERATION 3 - CONCISION: Remove waste
347
- ITERATION 4 - IMPACT: Make it compelling
348
- ITERATION 5 - STYLE: Polish the voice
349
- ```
350
-
351
- ### A/B Iteration Branches
352
- Create alternative versions and merge best parts:
353
-
354
- ```
355
- DRAFT: [Initial version]
356
-
357
- BRANCH A - CONCISION:
358
- [Optimize for brevity]
359
-
360
- BRANCH B - COMPLETENESS:
361
- [Optimize for thoroughness]
362
-
363
- MERGE:
364
- Combine the best elements of both branches.
365
- ```
366
-
367
- ### Constrained Progressive Compression
368
- ```
369
- VERSION 1: 1000 words - Complete explanation
370
- VERSION 2: 500 words - 50% compression
371
- VERSION 3: 250 words - 75% compression
372
- VERSION 4: 100 words - 90% compression
373
- VERSION 5: 25 words - 97.5% compression
374
-
375
- Each version must be self-contained and accurate.
376
- ```
377
-
378
- ### Quality Metric Iteration
379
- ```
380
- ITERATION 1:
381
- [Create initial version]
382
- Self-assess (1-10): Clarity ___ Concision ___ Accuracy ___ Impact ___
383
-
384
- ITERATION 2:
385
- [Improve lowest scoring dimension]
386
- Self-assess: Clarity ___ Concision ___ Accuracy ___ Impact ___
387
-
388
- ITERATION 3:
389
- [Improve next lowest dimension]
390
- Self-assess: Clarity ___ Concision ___ Accuracy ___ Impact ___
391
-
392
- Continue until all metrics > 8
393
- ```
394
-
395
- ## Refinement Strategies
396
-
397
- ### What to Remove
398
- - Redundant information
399
- - Obvious statements
400
- - Unnecessary qualifiers ("very", "really")
401
- - Passive voice (often)
402
- - Filler words
403
- - Overly general statements
404
-
405
- ### What to Add
406
- - Specific examples
407
- - Precise numbers
408
- - Concrete details
409
- - Missing context (if essential)
410
- - Clarifying examples
411
-
412
- ### What to Improve
413
- - Vague language → specific language
414
- - Long sentences → shorter, punchier
415
- - Complex words → simpler alternatives (if clearer)
416
- - Weak verbs → strong verbs
417
- - Passive voice → active voice
418
-
419
- ## Quality Indicators
420
-
421
- **Good CoD iterations show:**
422
- - ✅ Measurable improvement each pass
423
- - ✅ Increased information density
424
- - ✅ Reduced redundancy
425
- - ✅ Maintained accuracy
426
- - ✅ Enhanced clarity
427
- - ✅ Clear evolution path
428
-
429
- **Poor CoD iterations show:**
430
- - ❌ No meaningful change
431
- - ❌ Loss of important information
432
- - ❌ Decreased clarity
433
- - ❌ Introduced errors
434
- - ❌ Just made it shorter without improvement
435
-
436
- ## Use Cases
437
-
438
- ### 1. Content Summarization
439
- Taking long documents and progressively distilling essence
440
-
441
- ### 2. Message Refinement
442
- Iteratively improving emails, announcements, communications
443
-
444
- ### 3. Documentation Optimization
445
- Making docs clearer and more concise through iteration
446
-
447
- ### 4. Explanation Enhancement
448
- Progressively improving how concepts are explained
449
-
450
- ### 5. Writing Polish
451
- Iterative editing of creative or professional writing
452
-
453
- ### 6. Presentation Optimization
454
- Refining slides/talks through multiple passes
455
-
456
- ## Assessment Checklist
457
-
458
- When using Chain of Density:
459
- - [ ] Task benefits from iteration
460
- - [ ] Number of iterations specified
461
- - [ ] Optimization goals are clear
462
- - [ ] Each iteration has purpose
463
- - [ ] Constraints defined for each pass
464
- - [ ] Evolution is tracked/shown
465
- - [ ] Quality criteria established
466
- - [ ] Stopping condition exists
467
- - [ ] Final version is actually better
468
- - [ ] Process improved understanding
469
-
470
- ## Tips for Success
471
-
472
- 1. **Start Verbose**: First iteration should be complete, even if wordy
473
- 2. **One Focus Per Iteration**: Don't try to improve everything at once
474
- 3. **Show Your Work**: Display each iteration to see progress
475
- 4. **Set Constraints**: Give specific targets (word counts, focus areas)
476
- 5. **Verify Improvement**: Check that each iteration actually improves quality
477
- 6. **Don't Over-Iterate**: 3-5 iterations usually sufficient
478
- 7. **Preserve Accuracy**: Never sacrifice correctness for brevity
479
- 8. **Explain Changes**: Note what improved and why
1
+ # Chain of Density (CoD) Framework
2
+
3
+ ## Overview
4
+
5
+ Chain of Density is an iterative refinement technique that progressively improves outputs through multiple passes. Each iteration increases information density, removes redundancy, and enhances quality without significantly increasing length. It's based on the insight that iteration often produces better results than trying to get everything perfect in one shot.
6
+
7
+ ## Core Concept
8
+
9
+ Instead of requesting the perfect output immediately, CoD:
10
+ 1. Starts with a basic/verbose version
11
+ 2. Iteratively refines through multiple passes
12
+ 3. Increases information density each time
13
+ 4. Removes fluff and redundancy
14
+ 5. Enhances clarity and precision
15
+ 6. Converges on optimal output
16
+
17
+ Think of it as "progressive enhancement" for prompts.
18
+
19
+ ## When to Use Chain of Density
20
+
21
+ **Ideal for:**
22
+ - Summarization tasks
23
+ - Content compression
24
+ - Iterative improvement of writing
25
+ - Optimizing explanations
26
+ - Refining complex outputs
27
+ - Tasks where quality improves with iteration
28
+
29
+ **Not needed for:**
30
+ - Simple one-shot tasks
31
+ - When first draft is sufficient
32
+ - Time-critical quick tasks
33
+ - Tasks with fixed formats that can't improve
34
+
35
+ ## Implementation Approaches
36
+
37
+ ### Approach 1: Explicit Multi-Pass
38
+ Request multiple iterations upfront.
39
+
40
+ **Example:**
41
+ ```
42
+ Create a summary of this article using Chain of Density:
43
+
44
+ ITERATION 1:
45
+ Write a verbose summary hitting all main points (150-200 words)
46
+
47
+ ITERATION 2:
48
+ Refine the summary: increase information density, remove redundancy, keep it under 150 words
49
+
50
+ ITERATION 3:
51
+ Further refine: make every word count, increase precision, keep it under 120 words
52
+
53
+ ITERATION 4:
54
+ Final pass: maximize information density while maintaining clarity (100 words max)
55
+
56
+ ITERATION 5:
57
+ Ultimate compression: distill to absolute essentials (50 words max)
58
+
59
+ After all iterations, explain what improved in each pass.
60
+ ```
61
+
62
+ ### Approach 2: Recursive Refinement
63
+ Use output from one iteration as input to the next.
64
+
65
+ **Example:**
66
+ ```
67
+ PASS 1: Write a first draft explanation of quantum entanglement for a general audience.
68
+
69
+ PASS 2: Review your explanation. What's unclear? What's redundant? Rewrite it, addressing these issues.
70
+
71
+ PASS 3: Review again. Where can you be more precise? Where can you use better examples? Rewrite.
72
+
73
+ PASS 4: Final review. Every sentence should earn its place. Remove or improve anything that doesn't. Final version.
74
+
75
+ Show all passes so we can see the evolution.
76
+ ```
77
+
78
+ ### Approach 3: Targeted Improvement
79
+ Focus each iteration on specific aspect.
80
+
81
+ **Example:**
82
+ ```
83
+ Write a product description, then improve it iteratively:
84
+
85
+ DRAFT:
86
+ [Initial version]
87
+
88
+ ITERATION 1 - CLARITY:
89
+ Rewrite focusing on making it clearer and easier to understand.
90
+
91
+ ITERATION 2 - IMPACT:
92
+ Rewrite focusing on making it more compelling and persuasive.
93
+
94
+ ITERATION 3 - CONCISION:
95
+ Rewrite focusing on removing every unnecessary word.
96
+
97
+ ITERATION 4 - PRECISION:
98
+ Rewrite focusing on being more specific and accurate.
99
+
100
+ FINAL:
101
+ Combine the best elements from all iterations.
102
+ ```
103
+
104
+ ### Approach 4: Constraint-Based Refinement
105
+ Add tighter constraints with each iteration.
106
+
107
+ **Example:**
108
+ ```
109
+ Explain this technical concept through progressive refinement:
110
+
111
+ VERSION 1: Explain in 500 words or less
112
+ VERSION 2: Reduce to 300 words without losing key information
113
+ VERSION 3: Reduce to 150 words, keeping only essentials
114
+ VERSION 4: Create a 50-word version capturing the core idea
115
+ VERSION 5: One sentence (25 words max)
116
+
117
+ Each version should be complete and self-contained.
118
+ ```
119
+
120
+ ## Best Practices
121
+
122
+ ### 1. Define What to Optimize
123
+ ```
124
+ Good:
125
+ "Iterate to improve:
126
+ - Information density
127
+ - Clarity
128
+ - Conciseness
129
+ - Precision"
130
+
131
+ Poor:
132
+ "Make it better"
133
+ ```
134
+
135
+ ### 2. Specify Number of Iterations
136
+ ```
137
+ Good:
138
+ "Refine through 4 iterations, showing each version"
139
+
140
+ Poor:
141
+ "Keep improving until it's good"
142
+ ```
143
+
144
+ ### 3. Show Evolution
145
+ ```
146
+ Good:
147
+ "Show each iteration and explain what changed and why"
148
+
149
+ Poor:
150
+ "Just give me the final version"
151
+ ```
152
+
153
+ ### 4. Set Clear Constraints
154
+ ```
155
+ Good:
156
+ "Each iteration should be 20% shorter while maintaining completeness"
157
+
158
+ Poor:
159
+ "Make it shorter"
160
+ ```
161
+
162
+ ## Complete Examples
163
+
164
+ ### Example 1: Summarization
165
+
166
+ **Without CoD:**
167
+ ```
168
+ Summarize this research paper.
169
+ ```
170
+
171
+ **With CoD:**
172
+ ```
173
+ Summarize this research paper using Chain of Density:
174
+
175
+ [Paper content]
176
+
177
+ ITERATION 1 (200 words):
178
+ Create a comprehensive summary covering all major points. Prioritize completeness over brevity.
179
+
180
+ ITERATION 2 (150 words):
181
+ Refine the summary:
182
+ - Remove redundant information
183
+ - Combine related points
184
+ - Increase information density
185
+
186
+ ITERATION 3 (100 words):
187
+ Further compression:
188
+ - Keep only essential information
189
+ - Make every sentence count
190
+ - Maintain accuracy
191
+
192
+ ITERATION 4 (75 words):
193
+ Maximum density:
194
+ - Distill to core findings
195
+ - Remove all fluff
196
+ - Preserve critical details
197
+
198
+ For each iteration, highlight what you removed and why.
199
+ ```
200
+
201
+ ### Example 2: Code Documentation
202
+
203
+ **Without CoD:**
204
+ ```
205
+ Document this function.
206
+ ```
207
+
208
+ **With CoD:**
209
+ ```
210
+ Document this function through iterative refinement:
211
+
212
+ [Code]
213
+
214
+ DRAFT DOCUMENTATION:
215
+ Write complete documentation with examples, edge cases, everything.
216
+
217
+ ITERATION 1 - CLARITY:
218
+ Review and rewrite confusing sections. Add examples where helpful.
219
+
220
+ ITERATION 2 - CONCISION:
221
+ Remove redundancy. Combine related points. Make it tighter.
222
+
223
+ ITERATION 3 - PRECISION:
224
+ Be more specific about types, behaviors, edge cases.
225
+
226
+ ITERATION 4 - USABILITY:
227
+ Optimize for developer experience. What do they need to know most?
228
+
229
+ Show each version and explain key changes.
230
+ ```
231
+
232
+ ### Example 3: Email Refinement
233
+
234
+ **Without CoD:**
235
+ ```
236
+ Write an email announcing this feature.
237
+ ```
238
+
239
+ **With CoD:**
240
+ ```
241
+ Draft an announcement email, then refine it:
242
+
243
+ DRAFT:
244
+ Write a first draft covering all important information.
245
+
246
+ ITERATION 1 - STRUCTURE:
247
+ Reorganize for better flow. Most important information first.
248
+
249
+ ITERATION 2 - CLARITY:
250
+ Simplify language. Remove jargon. Make it scannable.
251
+
252
+ ITERATION 3 - ENGAGEMENT:
253
+ Strengthen the call-to-action. Make it more compelling.
254
+
255
+ ITERATION 4 - POLISH:
256
+ Final edits for tone, concision, impact.
257
+
258
+ Show the evolution and explain major changes.
259
+ ```
260
+
261
+ ### Example 4: Technical Explanation
262
+
263
+ **Without CoD:**
264
+ ```
265
+ Explain how this algorithm works.
266
+ ```
267
+
268
+ **With CoD:**
269
+ ```
270
+ Explain this algorithm through progressive refinement:
271
+
272
+ PASS 1 - COMPREHENSIVE:
273
+ Explain thoroughly, assuming no prior knowledge. Include:
274
+ - What it does
275
+ - How it works
276
+ - Why it's designed this way
277
+ - Example walkthrough
278
+
279
+ PASS 2 - REFINED:
280
+ Review Pass 1. What's unclear? What's redundant? Rewrite addressing these.
281
+
282
+ PASS 3 - OPTIMIZED:
283
+ Make it maximally clear and concise. Every paragraph must earn its place.
284
+
285
+ PASS 4 - POLISHED:
286
+ Final pass. Perfect clarity, zero fluff, optimal examples.
287
+
288
+ Show all passes and note significant improvements.
289
+ ```
290
+
291
+ ## Combining CoD with Other Frameworks
292
+
293
+ ### CoD + CO-STAR
294
+ ```
295
+ CONTEXT: [Background]
296
+ OBJECTIVE: [Goal]
297
+ STYLE: [Writing style]
298
+ TONE: [Tone]
299
+ AUDIENCE: [Readers]
300
+
301
+ RESPONSE PROCESS (Chain of Density):
302
+ Draft 1: [Comprehensive version]
303
+ Draft 2: [Refined for clarity]
304
+ Draft 3: [Optimized for audience]
305
+ Draft 4: [Final polished version]
306
+ ```
307
+
308
+ ### CoD + RISEN
309
+ ```
310
+ ROLE: [Expertise]
311
+ INSTRUCTIONS: Use iterative refinement
312
+ STEPS:
313
+ 1. Create initial version
314
+ 2. Review and identify weaknesses
315
+ 3. Refine addressing weaknesses
316
+ 4. Repeat until optimal
317
+ END GOAL: [Final quality criteria]
318
+ NARROWING: [Constraints on iterations]
319
+ ```
320
+
321
+ ### CoD + Chain of Thought
322
+ ```
323
+ For each iteration of Chain of Density, use Chain of Thought:
324
+
325
+ ITERATION 1:
326
+ Think through: What should this initial version include?
327
+ [Create version]
328
+
329
+ ITERATION 2:
330
+ Think through: What weaknesses exist? How to address them?
331
+ [Refine version]
332
+
333
+ ITERATION 3:
334
+ Think through: What can be compressed or improved?
335
+ [Further refine]
336
+ ```
337
+
338
+ ## Advanced Techniques
339
+
340
+ ### Aspect-Focused Iteration
341
+ Each iteration improves a different dimension:
342
+
343
+ ```
344
+ ITERATION 1 - ACCURACY: Get the facts right
345
+ ITERATION 2 - CLARITY: Make it understandable
346
+ ITERATION 3 - CONCISION: Remove waste
347
+ ITERATION 4 - IMPACT: Make it compelling
348
+ ITERATION 5 - STYLE: Polish the voice
349
+ ```
350
+
351
+ ### A/B Iteration Branches
352
+ Create alternative versions and merge best parts:
353
+
354
+ ```
355
+ DRAFT: [Initial version]
356
+
357
+ BRANCH A - CONCISION:
358
+ [Optimize for brevity]
359
+
360
+ BRANCH B - COMPLETENESS:
361
+ [Optimize for thoroughness]
362
+
363
+ MERGE:
364
+ Combine the best elements of both branches.
365
+ ```
366
+
367
+ ### Constrained Progressive Compression
368
+ ```
369
+ VERSION 1: 1000 words - Complete explanation
370
+ VERSION 2: 500 words - 50% compression
371
+ VERSION 3: 250 words - 75% compression
372
+ VERSION 4: 100 words - 90% compression
373
+ VERSION 5: 25 words - 97.5% compression
374
+
375
+ Each version must be self-contained and accurate.
376
+ ```
377
+
378
+ ### Quality Metric Iteration
379
+ ```
380
+ ITERATION 1:
381
+ [Create initial version]
382
+ Self-assess (1-10): Clarity ___ Concision ___ Accuracy ___ Impact ___
383
+
384
+ ITERATION 2:
385
+ [Improve lowest scoring dimension]
386
+ Self-assess: Clarity ___ Concision ___ Accuracy ___ Impact ___
387
+
388
+ ITERATION 3:
389
+ [Improve next lowest dimension]
390
+ Self-assess: Clarity ___ Concision ___ Accuracy ___ Impact ___
391
+
392
+ Continue until all metrics > 8
393
+ ```
394
+
395
+ ## Refinement Strategies
396
+
397
+ ### What to Remove
398
+ - Redundant information
399
+ - Obvious statements
400
+ - Unnecessary qualifiers ("very", "really")
401
+ - Passive voice (often)
402
+ - Filler words
403
+ - Overly general statements
404
+
405
+ ### What to Add
406
+ - Specific examples
407
+ - Precise numbers
408
+ - Concrete details
409
+ - Missing context (if essential)
410
+ - Clarifying examples
411
+
412
+ ### What to Improve
413
+ - Vague language → specific language
414
+ - Long sentences → shorter, punchier
415
+ - Complex words → simpler alternatives (if clearer)
416
+ - Weak verbs → strong verbs
417
+ - Passive voice → active voice
418
+
419
+ ## Quality Indicators
420
+
421
+ **Good CoD iterations show:**
422
+ - ✅ Measurable improvement each pass
423
+ - ✅ Increased information density
424
+ - ✅ Reduced redundancy
425
+ - ✅ Maintained accuracy
426
+ - ✅ Enhanced clarity
427
+ - ✅ Clear evolution path
428
+
429
+ **Poor CoD iterations show:**
430
+ - ❌ No meaningful change
431
+ - ❌ Loss of important information
432
+ - ❌ Decreased clarity
433
+ - ❌ Introduced errors
434
+ - ❌ Just made it shorter without improvement
435
+
436
+ ## Use Cases
437
+
438
+ ### 1. Content Summarization
439
+ Taking long documents and progressively distilling essence
440
+
441
+ ### 2. Message Refinement
442
+ Iteratively improving emails, announcements, communications
443
+
444
+ ### 3. Documentation Optimization
445
+ Making docs clearer and more concise through iteration
446
+
447
+ ### 4. Explanation Enhancement
448
+ Progressively improving how concepts are explained
449
+
450
+ ### 5. Writing Polish
451
+ Iterative editing of creative or professional writing
452
+
453
+ ### 6. Presentation Optimization
454
+ Refining slides/talks through multiple passes
455
+
456
+ ## Assessment Checklist
457
+
458
+ When using Chain of Density:
459
+ - [ ] Task benefits from iteration
460
+ - [ ] Number of iterations specified
461
+ - [ ] Optimization goals are clear
462
+ - [ ] Each iteration has purpose
463
+ - [ ] Constraints defined for each pass
464
+ - [ ] Evolution is tracked/shown
465
+ - [ ] Quality criteria established
466
+ - [ ] Stopping condition exists
467
+ - [ ] Final version is actually better
468
+ - [ ] Process improved understanding
469
+
470
+ ## Tips for Success
471
+
472
+ 1. **Start Verbose**: First iteration should be complete, even if wordy
473
+ 2. **One Focus Per Iteration**: Don't try to improve everything at once
474
+ 3. **Show Your Work**: Display each iteration to see progress
475
+ 4. **Set Constraints**: Give specific targets (word counts, focus areas)
476
+ 5. **Verify Improvement**: Check that each iteration actually improves quality
477
+ 6. **Don't Over-Iterate**: 3-5 iterations usually sufficient
478
+ 7. **Preserve Accuracy**: Never sacrifice correctness for brevity
479
+ 8. **Explain Changes**: Note what improved and why