@heylemon/lemonade 0.1.6 → 0.1.7

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.
@@ -1,46 +1,682 @@
1
- # Document Templates
1
+ # Document Templates with docx-js Examples
2
2
 
3
- When the user asks for a document, pick the template that fits best.
3
+ Each template shows the structure and a docx-js code snippet for that document type.
4
4
 
5
5
  ## Report
6
6
 
7
- ```json
8
- {
9
- "title": "[Topic] Report",
10
- "sections": [
11
- {"heading": "Executive Summary", "level": 1, "content": "..."},
12
- {"heading": "Background", "level": 1, "content": "..."},
13
- {"heading": "Key Findings", "level": 1, "content": "..."},
14
- {"heading": "Recommendations", "level": 1, "items": ["...", "..."], "numbered": true},
15
- {"heading": "Next Steps", "level": 1, "table": {"headers": ["Action", "Owner", "Due Date"], "rows": [["...", "...", "..."]]}}
16
- ]
17
- }
7
+ The most versatile template. Use for analytical, strategic, or informational documents.
8
+
9
+ **Structure:**
10
+ 1. Executive Summary (2-3 paragraphs: findings, conclusions, recommendations upfront)
11
+ 2. Background (brief context only)
12
+ 3. Key Findings (3 major findings with supporting data/tables)
13
+ 4. Recommendations (numbered action items with owners and timeline)
14
+ 5. Next Steps (action table with owners and due dates)
15
+ 6. Appendices (supporting details, raw data)
16
+
17
+ **docx-js Example:**
18
+
19
+ ```javascript
20
+ const { Document, Packer, Paragraph, Table, TableRow, TableCell, WidthType,
21
+ HeadingLevel, AlignmentType, BorderStyle, ShadingType } = require("docx");
22
+ const fs = require("fs");
23
+
24
+ const TYPOGRAPHY = { title: 52, h1: 36, h2: 28, h3: 24, body: 22, small: 18 };
25
+ const COLORS = { primary: "1B3A5C", accent: "2E86AB", lightAccent: "E8F4F8", text: "2C3E50", muted: "7F8C8D" };
26
+
27
+ const doc = new Document({
28
+ sections: [{
29
+ properties: {
30
+ page: {
31
+ margins: { top: 1152, bottom: 1152, left: 1440, right: 1440 }
32
+ }
33
+ },
34
+ header: {
35
+ children: [
36
+ new Paragraph({
37
+ text: "Company Name",
38
+ alignment: AlignmentType.RIGHT,
39
+ run: { size: TYPOGRAPHY.small, color: COLORS.muted }
40
+ })
41
+ ]
42
+ },
43
+ children: [
44
+ // Title
45
+ new Paragraph({
46
+ text: "Q3 Analysis Report",
47
+ spacing: { before: 480, after: 120 },
48
+ run: { size: TYPOGRAPHY.title, bold: true, color: COLORS.primary, font: "Arial" }
49
+ }),
50
+ new Paragraph({
51
+ text: "Prepared for Executive Team • January 15, 2026",
52
+ run: { size: TYPOGRAPHY.small, color: COLORS.muted }
53
+ }),
54
+ new Paragraph({ text: "" }),
55
+
56
+ // Executive Summary heading
57
+ new Paragraph({
58
+ text: "Executive Summary",
59
+ heading: HeadingLevel.HEADING_1,
60
+ outlineLevel: 0,
61
+ style: "Heading1",
62
+ run: { size: TYPOGRAPHY.h1, bold: true, color: COLORS.primary },
63
+ spacing: { before: 480, after: 160 }
64
+ }),
65
+ new Paragraph({
66
+ text: "Q3 revenue reached $4.2M, exceeding target by 8%. Key drivers include expanded enterprise sales and improved product adoption in APAC.",
67
+ run: { size: TYPOGRAPHY.body },
68
+ spacing: { after: 120 }
69
+ }),
70
+ new Paragraph({
71
+ text: "We recommend accelerating hiring in sales engineering and increasing marketing spend in high-performing regions.",
72
+ run: { size: TYPOGRAPHY.body },
73
+ spacing: { after: 240 }
74
+ }),
75
+
76
+ // Key Findings heading
77
+ new Paragraph({
78
+ text: "Key Findings",
79
+ heading: HeadingLevel.HEADING_1,
80
+ outlineLevel: 0,
81
+ style: "Heading1",
82
+ run: { size: TYPOGRAPHY.h1, bold: true, color: COLORS.primary },
83
+ spacing: { before: 480, after: 160 }
84
+ }),
85
+
86
+ // Finding 1
87
+ new Paragraph({
88
+ text: "Enterprise Segment Strong Growth",
89
+ heading: HeadingLevel.HEADING_2,
90
+ outlineLevel: 1,
91
+ style: "Heading2",
92
+ run: { size: TYPOGRAPHY.h2, bold: true, color: COLORS.primary },
93
+ spacing: { before: 360, after: 120 }
94
+ }),
95
+ new Paragraph({
96
+ text: "Enterprise revenue grew 34% YoY to $2.1M, driven by 3 new Fortune 500 wins and expansion deals.",
97
+ run: { size: TYPOGRAPHY.body },
98
+ spacing: { after: 240 }
99
+ }),
100
+
101
+ // Example table
102
+ new Table({
103
+ width: { size: 100, type: WidthType.PERCENTAGE },
104
+ rows: [
105
+ new TableRow({
106
+ children: [
107
+ new TableCell({
108
+ width: { size: 3000, type: WidthType.DXA },
109
+ shading: { fill: COLORS.primary, type: ShadingType.CLEAR },
110
+ children: [new Paragraph({ text: "Segment", run: { color: "FFFFFF", bold: true } })]
111
+ }),
112
+ new TableCell({
113
+ width: { size: 3000, type: WidthType.DXA },
114
+ shading: { fill: COLORS.primary, type: ShadingType.CLEAR },
115
+ children: [new Paragraph({ text: "Q3 Revenue", run: { color: "FFFFFF", bold: true } })]
116
+ }),
117
+ new TableCell({
118
+ width: { size: 3360, type: WidthType.DXA },
119
+ shading: { fill: COLORS.primary, type: ShadingType.CLEAR },
120
+ children: [new Paragraph({ text: "Growth YoY", run: { color: "FFFFFF", bold: true } })]
121
+ })
122
+ ]
123
+ }),
124
+ new TableRow({
125
+ children: [
126
+ new TableCell({
127
+ width: { size: 3000, type: WidthType.DXA },
128
+ shading: { fill: COLORS.lightAccent, type: ShadingType.CLEAR },
129
+ children: [new Paragraph("Enterprise")]
130
+ }),
131
+ new TableCell({
132
+ width: { size: 3000, type: WidthType.DXA },
133
+ shading: { fill: COLORS.lightAccent, type: ShadingType.CLEAR },
134
+ children: [new Paragraph("$2.1M")]
135
+ }),
136
+ new TableCell({
137
+ width: { size: 3360, type: WidthType.DXA },
138
+ shading: { fill: COLORS.lightAccent, type: ShadingType.CLEAR },
139
+ children: [new Paragraph("34%")]
140
+ })
141
+ ]
142
+ }),
143
+ new TableRow({
144
+ children: [
145
+ new TableCell({
146
+ width: { size: 3000, type: WidthType.DXA },
147
+ children: [new Paragraph("Mid-Market")]
148
+ }),
149
+ new TableCell({
150
+ width: { size: 3000, type: WidthType.DXA },
151
+ children: [new Paragraph("$1.4M")]
152
+ }),
153
+ new TableCell({
154
+ width: { size: 3360, type: WidthType.DXA },
155
+ children: [new Paragraph("12%")]
156
+ })
157
+ ]
158
+ })
159
+ ]
160
+ }),
161
+ new Paragraph({ text: "" }),
162
+
163
+ // Recommendations
164
+ new Paragraph({
165
+ text: "Recommendations",
166
+ heading: HeadingLevel.HEADING_1,
167
+ outlineLevel: 0,
168
+ style: "Heading1",
169
+ run: { size: TYPOGRAPHY.h1, bold: true, color: COLORS.primary },
170
+ spacing: { before: 480, after: 160 }
171
+ }),
172
+ new Paragraph({
173
+ text: "Hire 2 enterprise sales engineers by Q1 2026",
174
+ numbering: { level: 0, instance: 0 },
175
+ run: { size: TYPOGRAPHY.body }
176
+ }),
177
+ new Paragraph({
178
+ text: "Increase marketing budget for APAC region by 25%",
179
+ numbering: { level: 0, instance: 0 },
180
+ run: { size: TYPOGRAPHY.body }
181
+ }),
182
+ new Paragraph({
183
+ text: "Launch partner program by end of Q1 2026",
184
+ numbering: { level: 0, instance: 0 },
185
+ run: { size: TYPOGRAPHY.body }
186
+ })
187
+ ]
188
+ }]
189
+ });
190
+
191
+ Packer.toBuffer(doc).then(buffer => {
192
+ fs.writeFileSync("report.docx", buffer);
193
+ console.log("Report created: report.docx");
194
+ });
18
195
  ```
19
196
 
197
+ ---
198
+
20
199
  ## Memo
21
200
 
22
- ```json
23
- {
24
- "title": "Memo: [Subject]",
25
- "sections": [
26
- {"heading": "Purpose", "level": 1, "content": "..."},
27
- {"heading": "Background", "level": 1, "content": "..."},
28
- {"heading": "Recommendation", "level": 1, "content": "...", "callout": "Key decision needed: ..."},
29
- {"heading": "Next Steps", "level": 1, "items": ["...", "..."]}
30
- ]
31
- }
201
+ Short, direct, internal communication. 1-2 pages maximum.
202
+
203
+ **Structure:**
204
+ 1. Purpose (one sentence: why this memo exists and what you're asking for)
205
+ 2. Background (2-3 sentences of context only)
206
+ 3. Recommendation (what you propose and why, with optional callout for key decision)
207
+ 4. Supporting Details (evidence, data, reasoning)
208
+ 5. Next Steps (bulleted actions with owners and dates)
209
+
210
+ **docx-js Example:**
211
+
212
+ ```javascript
213
+ const { Document, Packer, Paragraph, HeadingLevel, AlignmentType, BorderStyle } = require("docx");
214
+ const fs = require("fs");
215
+
216
+ const TYPOGRAPHY = { title: 52, h1: 36, h2: 28, body: 22, small: 18 };
217
+ const COLORS = { primary: "1B3A5C", accent: "2E86AB", lightAccent: "E8F4F8", text: "2C3E50", muted: "7F8C8D" };
218
+
219
+ const doc = new Document({
220
+ sections: [{
221
+ properties: {
222
+ page: {
223
+ margins: { top: 1152, bottom: 1152, left: 1440, right: 1440 }
224
+ }
225
+ },
226
+ children: [
227
+ // Title
228
+ new Paragraph({
229
+ text: "MEMO: Expand Remote Work Policy",
230
+ spacing: { before: 240, after: 240 },
231
+ run: { size: TYPOGRAPHY.title, bold: true, color: COLORS.primary }
232
+ }),
233
+ new Paragraph({
234
+ text: "To: Executive Team | From: People Operations | Date: January 15, 2026",
235
+ run: { size: TYPOGRAPHY.small, color: COLORS.muted },
236
+ spacing: { after: 240 }
237
+ }),
238
+
239
+ // Purpose
240
+ new Paragraph({
241
+ text: "Purpose",
242
+ heading: HeadingLevel.HEADING_1,
243
+ outlineLevel: 0,
244
+ style: "Heading1",
245
+ run: { size: TYPOGRAPHY.h1, bold: true, color: COLORS.primary },
246
+ spacing: { before: 240, after: 120 }
247
+ }),
248
+ new Paragraph({
249
+ text: "We are requesting approval to expand our remote work policy to enable fully distributed teams, effective March 1, 2026.",
250
+ spacing: { after: 240 }
251
+ }),
252
+
253
+ // Background
254
+ new Paragraph({
255
+ text: "Background",
256
+ heading: HeadingLevel.HEADING_1,
257
+ outlineLevel: 0,
258
+ style: "Heading1",
259
+ run: { size: TYPOGRAPHY.h1, bold: true, color: COLORS.primary },
260
+ spacing: { before: 240, after: 120 }
261
+ }),
262
+ new Paragraph({
263
+ text: "Since 2022, 45% of our workforce has worked remotely. Current policy requires 2 office days per week. Employee surveys show 68% prefer full remote or flexible arrangements. Competitor analysis shows distributed policies improve retention by 23%.",
264
+ spacing: { after: 240 }
265
+ }),
266
+
267
+ // Recommendation with callout
268
+ new Paragraph({
269
+ text: "Recommendation",
270
+ heading: HeadingLevel.HEADING_1,
271
+ outlineLevel: 0,
272
+ style: "Heading1",
273
+ run: { size: TYPOGRAPHY.h1, bold: true, color: COLORS.primary },
274
+ spacing: { before: 240, after: 120 }
275
+ }),
276
+ new Paragraph({
277
+ text: "Move to a fully flexible remote-first model. Teams decide on sync hours (typically 2-3 hours overlap). Quarterly in-person meetings for culture and alignment.",
278
+ spacing: { after: 120 }
279
+ }),
280
+
281
+ // Callout box
282
+ new Paragraph({
283
+ text: "Approval needed: New remote-first policy by January 31 to communicate to staff.",
284
+ border: {
285
+ left: { color: COLORS.accent, space: 1, style: BorderStyle.SINGLE, size: 24 }
286
+ },
287
+ shading: { fill: COLORS.lightAccent, type: ShadingType.CLEAR },
288
+ indent: { left: 360, right: 360 },
289
+ spacing: { before: 120, after: 120 },
290
+ run: { size: TYPOGRAPHY.body, bold: true, color: COLORS.primary }
291
+ }),
292
+
293
+ new Paragraph({ text: "" }),
294
+
295
+ // Next Steps
296
+ new Paragraph({
297
+ text: "Next Steps",
298
+ heading: HeadingLevel.HEADING_1,
299
+ outlineLevel: 0,
300
+ style: "Heading1",
301
+ run: { size: TYPOGRAPHY.h1, bold: true, color: COLORS.primary },
302
+ spacing: { before: 240, after: 120 }
303
+ }),
304
+ new Paragraph({
305
+ text: "Draft policy guidelines — People Ops — Due Jan 20",
306
+ bullet: { level: 0 },
307
+ spacing: { after: 80 }
308
+ }),
309
+ new Paragraph({
310
+ text: "Communicate to staff — Leadership — Due Feb 1",
311
+ bullet: { level: 0 },
312
+ spacing: { after: 80 }
313
+ }),
314
+ new Paragraph({
315
+ text: "Implement new process — People Ops — Effective Mar 1",
316
+ bullet: { level: 0 }
317
+ })
318
+ ]
319
+ }]
320
+ });
321
+
322
+ Packer.toBuffer(doc).then(buffer => {
323
+ fs.writeFileSync("memo.docx", buffer);
324
+ console.log("Memo created: memo.docx");
325
+ });
32
326
  ```
33
327
 
328
+ ---
329
+
34
330
  ## Proposal
35
331
 
36
- ```json
37
- {
38
- "title": "[Project] Proposal",
39
- "sections": [
40
- {"heading": "Executive Summary", "level": 1, "content": "..."},
41
- {"heading": "Proposed Solution", "level": 1, "content": "..."},
42
- {"heading": "Approach & Timeline", "level": 1, "table": {"headers": ["Phase", "Activities", "Timeline"], "rows": [["Discovery", "...", "Week 1-2"]]}},
43
- {"heading": "Investment", "level": 1, "table": {"headers": ["Item", "Description", "Cost"], "rows": [["...", "...", "$X"]]}}
44
- ]
45
- }
332
+ For pitching to clients, leadership, or partners. Persuasive structure.
333
+
334
+ **Structure:**
335
+ 1. Executive Summary (problem + your solution + why you)
336
+ 2. Understanding Your Challenge (show you understand their specific pain)
337
+ 3. Proposed Solution (what you'll do, how it works, what makes it different)
338
+ 4. Approach & Timeline (table: phases, activities, timeline)
339
+ 5. Investment (pricing table)
340
+ 6. Why Us (credentials, relevant experience, team)
341
+ 7. Next Steps (clear call to action)
342
+
343
+ **docx-js Code Pattern:**
344
+
345
+ The proposal follows the same setup as the report but focuses heavily on:
346
+ - The client's name in title and metadata
347
+ - Problems and pain points first
348
+ - Solution positioning second
349
+ - Pricing/investment as a table
350
+ - Clear timeline with phases
351
+
352
+ Implement as you would the report template, but with the proposal structure and persuasive tone. Key sections:
353
+
354
+ ```javascript
355
+ // Title
356
+ new Paragraph({
357
+ text: "Project Proposal: [Project Name]",
358
+ ...
359
+ }),
360
+ new Paragraph({
361
+ text: "Prepared for [Client Name]",
362
+ run: { size: TYPOGRAPHY.subtitle, color: COLORS.muted }
363
+ }),
364
+
365
+ // Executive Summary focusing on their problem first
366
+ new Paragraph({
367
+ text: "Understanding Your Challenge",
368
+ heading: HeadingLevel.HEADING_1,
369
+ ...
370
+ }),
371
+ new Paragraph({
372
+ text: "[Specific pain points for their business]",
373
+ spacing: { after: 240 }
374
+ }),
375
+
376
+ // Proposed Solution
377
+ new Paragraph({
378
+ text: "Our Proposed Approach",
379
+ heading: HeadingLevel.HEADING_1,
380
+ ...
381
+ }),
382
+ // Include Table: Phases, Activities, Timeline
383
+
384
+ // Investment/Pricing
385
+ // Include Table: Items, Description, Cost
386
+
387
+ // Why Us
388
+ new Paragraph({
389
+ text: "Why Partner With Us",
390
+ heading: HeadingLevel.HEADING_1,
391
+ ...
392
+ }),
393
+ // Credentials, case studies, team
394
+ ```
395
+
396
+ ---
397
+
398
+ ## Brief
399
+
400
+ 1-page executive overview. Use for project briefs, creative briefs, strategy briefs.
401
+
402
+ **Structure:**
403
+ 1. Objective (one sentence: what we're trying to achieve)
404
+ 2. Context (2-3 sentences of background)
405
+ 3. Key Points (bulleted, 3 maximum)
406
+ 4. Constraints (budget, timeline, scope)
407
+ 5. Success Criteria (how we measure success)
408
+ 6. Decision Needed (callout with specific ask and deadline)
409
+
410
+ **docx-js Example:**
411
+
412
+ ```javascript
413
+ const { Document, Packer, Paragraph, HeadingLevel, AlignmentType, BorderStyle, ShadingType } = require("docx");
414
+ const fs = require("fs");
415
+
416
+ const TYPOGRAPHY = { title: 48, h1: 32, body: 22 };
417
+ const COLORS = { primary: "1B3A5C", accent: "2E86AB", lightAccent: "E8F4F8", text: "2C3E50", muted: "7F8C8D" };
418
+
419
+ const doc = new Document({
420
+ sections: [{
421
+ properties: {
422
+ page: {
423
+ margins: { top: 1152, bottom: 1152, left: 1440, right: 1440 }
424
+ }
425
+ },
426
+ children: [
427
+ // Title
428
+ new Paragraph({
429
+ text: "Brand Refresh Brief",
430
+ spacing: { before: 240, after: 120 },
431
+ run: { size: TYPOGRAPHY.title, bold: true, color: COLORS.primary }
432
+ }),
433
+ new Paragraph({
434
+ text: "January 2026",
435
+ run: { size: TYPOGRAPHY.small, color: COLORS.muted },
436
+ spacing: { after: 240 }
437
+ }),
438
+
439
+ // Objective
440
+ new Paragraph({
441
+ text: "Objective",
442
+ heading: HeadingLevel.HEADING_1,
443
+ outlineLevel: 0,
444
+ style: "Heading1",
445
+ run: { size: TYPOGRAPHY.h1, bold: true, color: COLORS.primary },
446
+ spacing: { before: 240, after: 120 }
447
+ }),
448
+ new Paragraph({
449
+ text: "Modernize brand identity to appeal to millennial and Gen Z audiences while maintaining recognition among existing customer base.",
450
+ spacing: { after: 240 }
451
+ }),
452
+
453
+ // Context
454
+ new Paragraph({
455
+ text: "Context",
456
+ heading: HeadingLevel.HEADING_1,
457
+ outlineLevel: 0,
458
+ style: "Heading1",
459
+ run: { size: TYPOGRAPHY.h1, bold: true, color: COLORS.primary },
460
+ spacing: { before: 240, after: 120 }
461
+ }),
462
+ new Paragraph({
463
+ text: "Current brand positioning feels dated. Competitors have modernized their visual identity. New market research shows our target audience perceives the brand as legacy and uninnovative.",
464
+ spacing: { after: 240 }
465
+ }),
466
+
467
+ // Key Points
468
+ new Paragraph({
469
+ text: "Key Points",
470
+ heading: HeadingLevel.HEADING_1,
471
+ outlineLevel: 0,
472
+ style: "Heading1",
473
+ run: { size: TYPOGRAPHY.h1, bold: true, color: COLORS.primary },
474
+ spacing: { before: 240, after: 120 }
475
+ }),
476
+ new Paragraph({ text: "Simplify logo (remove legacy elements)", bullet: { level: 0 }, spacing: { after: 80 } }),
477
+ new Paragraph({ text: "Introduce modern color palette (tech-forward blues and greens)", bullet: { level: 0 }, spacing: { after: 80 } }),
478
+ new Paragraph({ text: "Develop comprehensive brand guidelines for consistency", bullet: { level: 0 } }),
479
+
480
+ new Paragraph({ text: "" }),
481
+
482
+ // Constraints
483
+ new Paragraph({
484
+ text: "Constraints",
485
+ heading: HeadingLevel.HEADING_1,
486
+ outlineLevel: 0,
487
+ style: "Heading1",
488
+ run: { size: TYPOGRAPHY.h1, bold: true, color: COLORS.primary },
489
+ spacing: { before: 240, after: 120 }
490
+ }),
491
+ new Paragraph({ text: "Budget: $50,000", bullet: { level: 0 }, spacing: { after: 80 } }),
492
+ new Paragraph({ text: "Timeline: 6 weeks from kickoff to launch", bullet: { level: 0 }, spacing: { after: 80 } }),
493
+ new Paragraph({ text: "Stakeholder approval required before final implementation", bullet: { level: 0 } }),
494
+
495
+ new Paragraph({ text: "" }),
496
+
497
+ // Success Criteria
498
+ new Paragraph({
499
+ text: "Success Criteria",
500
+ heading: HeadingLevel.HEADING_1,
501
+ outlineLevel: 0,
502
+ style: "Heading1",
503
+ run: { size: TYPOGRAPHY.h1, bold: true, color: COLORS.primary },
504
+ spacing: { before: 240, after: 120 }
505
+ }),
506
+ new Paragraph({ text: "75%+ stakeholder approval on final designs", bullet: { level: 0 }, spacing: { after: 80 } }),
507
+ new Paragraph({ text: "Zero negative customer perception impact", bullet: { level: 0 }, spacing: { after: 80 } }),
508
+ new Paragraph({ text: "Brand guidelines adopted across all teams within 30 days", bullet: { level: 0 } }),
509
+
510
+ new Paragraph({ text: "" }),
511
+
512
+ // Decision Needed (callout)
513
+ new Paragraph({
514
+ text: "Decision Needed",
515
+ heading: HeadingLevel.HEADING_1,
516
+ outlineLevel: 0,
517
+ style: "Heading1",
518
+ run: { size: TYPOGRAPHY.h1, bold: true, color: COLORS.primary },
519
+ spacing: { before: 240, after: 120 }
520
+ }),
521
+ new Paragraph({
522
+ text: "Approve brand refresh direction by January 24 to maintain launch timeline. Submit feedback via this form by EOD January 22.",
523
+ border: {
524
+ left: { color: COLORS.accent, space: 1, style: BorderStyle.SINGLE, size: 24 }
525
+ },
526
+ shading: { fill: COLORS.lightAccent, type: ShadingType.CLEAR },
527
+ indent: { left: 360, right: 360 },
528
+ spacing: { before: 120, after: 120 },
529
+ run: { size: TYPOGRAPHY.body, bold: true, color: COLORS.primary }
530
+ })
531
+ ]
532
+ }]
533
+ });
534
+
535
+ Packer.toBuffer(doc).then(buffer => {
536
+ fs.writeFileSync("brief.docx", buffer);
537
+ console.log("Brief created: brief.docx");
538
+ });
46
539
  ```
540
+
541
+ ---
542
+
543
+ ## Letter
544
+
545
+ Formal business correspondence.
546
+
547
+ **Structure:**
548
+ 1. Date and recipient address
549
+ 2. Salutation
550
+ 3. Opening (purpose in 1-2 sentences)
551
+ 4. Body (supporting details, 1-3 paragraphs)
552
+ 5. Closing (next steps or call to action)
553
+ 6. Sign-off
554
+
555
+ **docx-js Example:**
556
+
557
+ ```javascript
558
+ const { Document, Packer, Paragraph, HeadingLevel, AlignmentType } = require("docx");
559
+ const fs = require("fs");
560
+
561
+ const TYPOGRAPHY = { body: 22, small: 18 };
562
+ const COLORS = { primary: "1B3A5C", text: "2C3E50", muted: "7F8C8D" };
563
+
564
+ const doc = new Document({
565
+ sections: [{
566
+ properties: {
567
+ page: {
568
+ margins: { top: 1152, bottom: 1152, left: 1440, right: 1440 }
569
+ }
570
+ },
571
+ children: [
572
+ // Date and recipient
573
+ new Paragraph({
574
+ text: "January 15, 2026",
575
+ spacing: { after: 240 },
576
+ run: { size: TYPOGRAPHY.body }
577
+ }),
578
+ new Paragraph({
579
+ text: "John Smith\nChief Executive Officer\nAcme Corporation\n123 Business Ave\nNew York, NY 10001",
580
+ spacing: { after: 240 },
581
+ run: { size: TYPOGRAPHY.body }
582
+ }),
583
+
584
+ // Salutation
585
+ new Paragraph({
586
+ text: "Dear Mr. Smith,",
587
+ spacing: { after: 240 },
588
+ run: { size: TYPOGRAPHY.body }
589
+ }),
590
+
591
+ // Opening
592
+ new Paragraph({
593
+ text: "I am writing to confirm our partnership agreement for the upcoming fiscal year and to outline the key deliverables and timeline.",
594
+ spacing: { after: 240 },
595
+ run: { size: TYPOGRAPHY.body }
596
+ }),
597
+
598
+ // Body
599
+ new Paragraph({
600
+ text: "We are excited to work together on this strategic initiative. Our team will deliver the following:",
601
+ spacing: { after: 120 },
602
+ run: { size: TYPOGRAPHY.body }
603
+ }),
604
+ new Paragraph({ text: "Quarterly business reviews and performance reporting", bullet: { level: 0 }, spacing: { after: 80 } }),
605
+ new Paragraph({ text: "Dedicated account management and support", bullet: { level: 0 }, spacing: { after: 80 } }),
606
+ new Paragraph({ text: "Custom solutions tailored to your organization's needs", bullet: { level: 0 }, spacing: { after: 240 } }),
607
+
608
+ // Closing
609
+ new Paragraph({
610
+ text: "We look forward to a productive partnership. Please confirm your acceptance of these terms by January 31, 2026.",
611
+ spacing: { after: 240 },
612
+ run: { size: TYPOGRAPHY.body }
613
+ }),
614
+
615
+ // Sign-off
616
+ new Paragraph({
617
+ text: "Sincerely,",
618
+ spacing: { after: 120 },
619
+ run: { size: TYPOGRAPHY.body }
620
+ }),
621
+ new Paragraph({
622
+ text: "\n\n\nAlice Johnson\nDirector of Partnerships",
623
+ spacing: { after: 0 },
624
+ run: { size: TYPOGRAPHY.body }
625
+ })
626
+ ]
627
+ }]
628
+ });
629
+
630
+ Packer.toBuffer(doc).then(buffer => {
631
+ fs.writeFileSync("letter.docx", buffer);
632
+ console.log("Letter created: letter.docx");
633
+ });
634
+ ```
635
+
636
+ ---
637
+
638
+ ## Template Selection Guide
639
+
640
+ | Situation | Template | Why |
641
+ |-----------|----------|-----|
642
+ | User says "write a report" or "analysis" | Report | Most versatile; supports detailed findings |
643
+ | "Keep it brief" or "one page" | Brief | Structured for quick reading |
644
+ | "For the board" or "leadership" | Report with exec summary | High-level findings upfront |
645
+ | "Internal heads up" or "FYI" | Memo | Short, direct, low ceremony |
646
+ | "Pitch to client" or "proposal" | Proposal | Persuasive structure; focuses on client pain |
647
+ | "Need a letter" or "formal correspondence" | Letter | Professional tone, traditional format |
648
+ | Ambiguous request | Report | Default; can be adapted |
649
+
650
+ ---
651
+
652
+ ## Tips for Each Template Type
653
+
654
+ **Reports:**
655
+ - Always lead with key findings, not background
656
+ - Use tables for data comparisons
657
+ - Include a numbered recommendation list
658
+ - Validate with the validation script
659
+
660
+ **Memos:**
661
+ - Keep to 1-2 pages maximum
662
+ - Use callouts for decisions needed
663
+ - Clear action items with owners and dates
664
+ - No fluff — just essential info
665
+
666
+ **Proposals:**
667
+ - Mirror the client's language and concerns
668
+ - Show deep understanding of their problem before presenting solution
669
+ - Include a detailed timeline and pricing
670
+ - Always end with a clear next step
671
+
672
+ **Briefs:**
673
+ - Stick to one page (use smaller margins if needed)
674
+ - Maximum 3 key points
675
+ - Constraints and success criteria are equally important
676
+ - Callout for decision needed is critical
677
+
678
+ **Letters:**
679
+ - Traditional format: date, recipient, salutation, body, closing
680
+ - Professional tone; no casual language
681
+ - Clear purpose in opening
682
+ - Specific ask in closing