dimcode-darwin-x64 0.1.1-beta.0 → 0.1.2-beta.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/bin/dimcode +0 -0
- package/bin/runtime/sandbox/dim-sandbox-runner +0 -0
- package/bin/runtime/sandbox/manifest.json +15 -0
- package/bin/skills-assets/deep-investigate/SKILL.md +101 -0
- package/bin/skills-assets/deep-investigate/references/prompts.md +75 -0
- package/bin/skills-assets/deep-investigate/references/templates.md +73 -0
- package/bin/skills-assets/deep-investigate/references/thinking-tools.md +36 -0
- package/bin/skills-assets/docs-sprint/SKILL.md +73 -0
- package/bin/skills-assets/docs-sprint/agents/openai.yaml +4 -0
- package/bin/skills-assets/docs-sprint/references/contract-discipline.md +30 -0
- package/bin/skills-assets/docs-sprint/references/delivery-plan.md +162 -0
- package/bin/skills-assets/docs-sprint/references/documentation-system.md +109 -0
- package/bin/skills-assets/docs-sprint/references/ui-layout.md +73 -0
- package/bin/skills-assets/docs-sprint/references/worktree-guide.md +45 -0
- package/bin/skills-assets/docx/SKILL.md +273 -0
- package/bin/skills-assets/docx/assets/styles/academic_styles.xml +250 -0
- package/bin/skills-assets/docx/assets/styles/corporate_styles.xml +284 -0
- package/bin/skills-assets/docx/assets/styles/default_styles.xml +449 -0
- package/bin/skills-assets/docx/assets/xsd/aesthetic-rules.xsd +470 -0
- package/bin/skills-assets/docx/assets/xsd/business-rules.xsd +130 -0
- package/bin/skills-assets/docx/assets/xsd/common-types.xsd +159 -0
- package/bin/skills-assets/docx/assets/xsd/wml-subset.xsd +589 -0
- package/bin/skills-assets/docx/references/cjk_typography.md +357 -0
- package/bin/skills-assets/docx/references/cjk_university_template_guide.md +184 -0
- package/bin/skills-assets/docx/references/comments_guide.md +191 -0
- package/bin/skills-assets/docx/references/design_good_bad_examples.md +829 -0
- package/bin/skills-assets/docx/references/design_principles.md +819 -0
- package/bin/skills-assets/docx/references/openxml_element_order.md +308 -0
- package/bin/skills-assets/docx/references/openxml_encyclopedia_part1.md +4061 -0
- package/bin/skills-assets/docx/references/openxml_encyclopedia_part2.md +2820 -0
- package/bin/skills-assets/docx/references/openxml_encyclopedia_part3.md +3381 -0
- package/bin/skills-assets/docx/references/openxml_namespaces.md +82 -0
- package/bin/skills-assets/docx/references/openxml_units.md +72 -0
- package/bin/skills-assets/docx/references/scenario_a_create.md +284 -0
- package/bin/skills-assets/docx/references/scenario_b_edit_content.md +295 -0
- package/bin/skills-assets/docx/references/scenario_c_apply_template.md +456 -0
- package/bin/skills-assets/docx/references/track_changes_guide.md +200 -0
- package/bin/skills-assets/docx/references/troubleshooting.md +506 -0
- package/bin/skills-assets/docx/references/typography_guide.md +294 -0
- package/bin/skills-assets/docx/references/xsd_validation_guide.md +158 -0
- package/bin/skills-assets/docx/scripts/doc_to_docx.sh +40 -0
- package/bin/skills-assets/docx/scripts/docx_preview.sh +37 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Cli/Docx.Cli.csproj +19 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Cli/Program.cs +18 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Commands/AnalyzeCommand.cs +147 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Commands/ApplyTemplateCommand.cs +322 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Commands/CreateCommand.cs +324 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Commands/DiffCommand.cs +155 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Commands/EditContentCommand.cs +487 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Commands/FixOrderCommand.cs +108 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Commands/MergeRunsCommand.cs +122 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Commands/ValidateCommand.cs +107 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Docx.Core.csproj +15 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/OpenXml/CommentSynchronizer.cs +169 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/OpenXml/ElementOrder.cs +80 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/OpenXml/NamespaceConstants.cs +42 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/OpenXml/RunMerger.cs +81 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/OpenXml/StyleAnalyzer.cs +81 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/OpenXml/TrackChangesHelper.cs +99 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/OpenXml/UnitConverter.cs +23 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/AestheticRecipeSamples.cs +1832 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/AestheticRecipeSamples_Batch1.cs +910 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/AestheticRecipeSamples_Batch2.cs +999 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/AestheticRecipeSamples_Batch3.cs +1048 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/AestheticRecipeSamples_Batch4.cs +1038 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/CharacterFormattingSamples.cs +1020 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/DocumentCreationSamples.cs +1121 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/FieldAndTocSamples.cs +624 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/FootnoteAndCommentSamples.cs +675 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/HeaderFooterSamples.cs +838 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/ImageSamples.cs +917 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/ListAndNumberingSamples.cs +826 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/ParagraphFormattingSamples.cs +1199 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/StyleSystemSamples.cs +1487 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/TableSamples.cs +1163 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Samples/TrackChangesSamples.cs +595 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Typography/CjkHelper.cs +39 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Typography/FontDefaults.cs +24 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Typography/PageSizes.cs +20 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Validation/BusinessRuleValidator.cs +224 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Validation/GateCheckValidator.cs +148 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Validation/ValidationResult.cs +23 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.Core/Validation/XsdValidator.cs +69 -0
- package/bin/skills-assets/docx/scripts/dotnet/Docx.slnx +4 -0
- package/bin/skills-assets/docx/scripts/env_check.sh +196 -0
- package/bin/skills-assets/docx/scripts/setup.ps1 +274 -0
- package/bin/skills-assets/docx/scripts/setup.sh +504 -0
- package/bin/skills-assets/pdf/README.md +222 -0
- package/bin/skills-assets/pdf/SKILL.md +191 -0
- package/bin/skills-assets/pdf/design/design.md +381 -0
- package/bin/skills-assets/pdf/scripts/cover.py +1579 -0
- package/bin/skills-assets/pdf/scripts/fill_inspect.py +200 -0
- package/bin/skills-assets/pdf/scripts/fill_write.py +242 -0
- package/bin/skills-assets/pdf/scripts/make.sh +491 -0
- package/bin/skills-assets/pdf/scripts/merge.py +112 -0
- package/bin/skills-assets/pdf/scripts/palette.py +521 -0
- package/bin/skills-assets/pdf/scripts/reformat_parse.py +374 -0
- package/bin/skills-assets/pdf/scripts/render_body.py +1052 -0
- package/bin/skills-assets/pdf/scripts/render_cover.js +111 -0
- package/bin/skills-assets/pptx-generator/SKILL.md +248 -0
- package/bin/skills-assets/pptx-generator/references/design-system.md +392 -0
- package/bin/skills-assets/pptx-generator/references/editing.md +162 -0
- package/bin/skills-assets/pptx-generator/references/pitfalls.md +112 -0
- package/bin/skills-assets/pptx-generator/references/pptxgenjs.md +420 -0
- package/bin/skills-assets/pptx-generator/references/slide-types.md +413 -0
- package/bin/skills-assets/skill-creator/SKILL.md +368 -0
- package/bin/skills-assets/skill-creator/agents/openai.yaml +5 -0
- package/bin/skills-assets/skill-creator/assets/skill-creator-small.svg +3 -0
- package/bin/skills-assets/skill-creator/assets/skill-creator.png +0 -0
- package/bin/skills-assets/skill-creator/license.txt +202 -0
- package/bin/skills-assets/skill-creator/references/openai_yaml.md +49 -0
- package/bin/skills-assets/skill-creator/scripts/generate_openai_yaml.py +226 -0
- package/bin/skills-assets/skill-creator/scripts/init_skill.py +397 -0
- package/bin/skills-assets/skill-creator/scripts/quick_validate.py +101 -0
- package/bin/skills-assets/skill-installer/LICENSE.txt +202 -0
- package/bin/skills-assets/skill-installer/SKILL.md +58 -0
- package/bin/skills-assets/skill-installer/agents/openai.yaml +5 -0
- package/bin/skills-assets/skill-installer/assets/skill-installer-small.svg +3 -0
- package/bin/skills-assets/skill-installer/assets/skill-installer.png +0 -0
- package/bin/skills-assets/skill-installer/scripts/github_utils.py +21 -0
- package/bin/skills-assets/skill-installer/scripts/install-skill-from-github.py +308 -0
- package/bin/skills-assets/skill-installer/scripts/list-skills.py +107 -0
- package/bin/skills-assets/xlsx/SKILL.md +137 -0
- package/bin/skills-assets/xlsx/references/create.md +691 -0
- package/bin/skills-assets/xlsx/references/edit.md +684 -0
- package/bin/skills-assets/xlsx/references/fix.md +37 -0
- package/bin/skills-assets/xlsx/references/format.md +768 -0
- package/bin/skills-assets/xlsx/references/ooxml-cheatsheet.md +231 -0
- package/bin/skills-assets/xlsx/references/read-analyze.md +97 -0
- package/bin/skills-assets/xlsx/references/validate.md +772 -0
- package/bin/skills-assets/xlsx/scripts/formula_check.py +422 -0
- package/bin/skills-assets/xlsx/scripts/libreoffice_recalc.py +248 -0
- package/bin/skills-assets/xlsx/scripts/shared_strings_builder.py +163 -0
- package/bin/skills-assets/xlsx/scripts/style_audit.py +575 -0
- package/bin/skills-assets/xlsx/scripts/xlsx_add_column.py +395 -0
- package/bin/skills-assets/xlsx/scripts/xlsx_insert_row.py +274 -0
- package/bin/skills-assets/xlsx/scripts/xlsx_pack.py +87 -0
- package/bin/skills-assets/xlsx/scripts/xlsx_reader.py +362 -0
- package/bin/skills-assets/xlsx/scripts/xlsx_shift_rows.py +396 -0
- package/bin/skills-assets/xlsx/scripts/xlsx_unpack.py +130 -0
- package/bin/skills-assets/xlsx/templates/minimal_xlsx/[Content_Types].xml +9 -0
- package/bin/skills-assets/xlsx/templates/minimal_xlsx/_rels/.rels +6 -0
- package/bin/skills-assets/xlsx/templates/minimal_xlsx/xl/_rels/workbook.xml.rels +19 -0
- package/bin/skills-assets/xlsx/templates/minimal_xlsx/xl/sharedStrings.xml +33 -0
- package/bin/skills-assets/xlsx/templates/minimal_xlsx/xl/styles.xml +160 -0
- package/bin/skills-assets/xlsx/templates/minimal_xlsx/xl/workbook.xml +30 -0
- package/bin/skills-assets/xlsx/templates/minimal_xlsx/xl/worksheets/sheet1.xml +70 -0
- package/package.json +1 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# pdf
|
|
2
|
+
|
|
3
|
+
A skill for creating and editing visually polished PDFs.
|
|
4
|
+
Three routes. One design system. Tokens flow from content analysis through every renderer.
|
|
5
|
+
|
|
6
|
+
## Quick start
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
bash scripts/make.sh check # verify deps
|
|
10
|
+
bash scripts/make.sh fix # auto-install missing deps
|
|
11
|
+
bash scripts/make.sh demo # → demo.pdf
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Route A: CREATE — generate a new PDF
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
bash scripts/make.sh run \
|
|
20
|
+
--title "Q3 Strategy Review" \
|
|
21
|
+
--type "proposal" \
|
|
22
|
+
--author "Strategy Team" \
|
|
23
|
+
--date "October 2025" \
|
|
24
|
+
--content content.json \
|
|
25
|
+
--out report.pdf
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**`--type` options:**
|
|
29
|
+
|
|
30
|
+
| Type | Palette | Cover pattern | Google Fonts (cover) |
|
|
31
|
+
|---|---|---|---|
|
|
32
|
+
| `report` | Deep ink, teal accent | `fullbleed` | Playfair Display / IBM Plex Sans |
|
|
33
|
+
| `proposal` | Near-black, amber accent | `split` | Syne / Nunito Sans |
|
|
34
|
+
| `resume` | White, navy accent | `typographic` | DM Serif Display / DM Sans |
|
|
35
|
+
| `portfolio` | Deep violet, coral accent | `atmospheric` | Fraunces / Inter |
|
|
36
|
+
| `academic` | Warm white, navy accent | `typographic` | EB Garamond / Source Sans 3 |
|
|
37
|
+
| `general` | Dark slate, blue accent | `fullbleed` | Outfit / Outfit |
|
|
38
|
+
| `minimal` | Near-white, red accent | `minimal` | Cormorant Garamond / Jost |
|
|
39
|
+
| `stripe` | Dark navy, amber accent | `stripe` | Barlow Condensed / Barlow |
|
|
40
|
+
| `diagonal` | Dark blue, teal accent | `diagonal` | Montserrat / Montserrat |
|
|
41
|
+
| `frame` | Warm cream, brown accent | `frame` | Cormorant / Crimson Pro |
|
|
42
|
+
| `editorial` | White, red accent | `editorial` | Bebas Neue / Libre Franklin |
|
|
43
|
+
| `magazine` | Warm linen, deep navy accent | `magazine` | Playfair Display / EB Garamond |
|
|
44
|
+
| `darkroom` | Deep navy, steel blue accent | `darkroom` | Playfair Display / EB Garamond |
|
|
45
|
+
| `terminal` | Near-black, neon green accent | `terminal` | Space Mono |
|
|
46
|
+
| `poster` | White, near-black accent | `poster` | Barlow Condensed / Courier Prime |
|
|
47
|
+
|
|
48
|
+
**content.json block types:**
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
[
|
|
52
|
+
{"type": "h1", "text": "Section Title"},
|
|
53
|
+
{"type": "h2", "text": "Subsection"},
|
|
54
|
+
{"type": "h3", "text": "Sub-subsection"},
|
|
55
|
+
{"type": "body", "text": "Paragraph. Supports <b>bold</b> and <i>italic</i>."},
|
|
56
|
+
{"type": "bullet", "text": "Unordered list item"},
|
|
57
|
+
{"type": "numbered","text": "Ordered list item — counter auto-resets between lists"},
|
|
58
|
+
{"type": "callout", "text": "Key insight or highlighted finding"},
|
|
59
|
+
{"type": "table",
|
|
60
|
+
"headers": ["Col A", "Col B"],
|
|
61
|
+
"rows": [["a", "b"], ["c", "d"]]
|
|
62
|
+
},
|
|
63
|
+
{"type": "image", "path": "chart.png", "caption": "Figure 1: optional caption"},
|
|
64
|
+
{"type": "code", "text": "def hello():\n print('world')"},
|
|
65
|
+
{"type": "math", "text": "\\int_0^\\infty e^{-x^2} dx = \\frac{\\sqrt{\\pi}}{2}", "label": "(1)"},
|
|
66
|
+
{"type": "divider"},
|
|
67
|
+
{"type": "caption", "text": "Table 1: standalone caption label"},
|
|
68
|
+
{"type": "pagebreak"},
|
|
69
|
+
{"type": "spacer", "pt": 16}
|
|
70
|
+
]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Route B: FILL — fill form fields in an existing PDF
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# See what fields the PDF has
|
|
79
|
+
bash scripts/make.sh fill --input form.pdf --inspect
|
|
80
|
+
|
|
81
|
+
# Fill fields
|
|
82
|
+
bash scripts/make.sh fill \
|
|
83
|
+
--input form.pdf \
|
|
84
|
+
--out filled.pdf \
|
|
85
|
+
--values '{"FirstName": "Jane", "Agree": "true", "Country": "US"}'
|
|
86
|
+
|
|
87
|
+
# Or from a JSON file
|
|
88
|
+
bash scripts/make.sh fill --input form.pdf --out filled.pdf --data values.json
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Field value rules:
|
|
92
|
+
- `text` → any string
|
|
93
|
+
- `checkbox` → `"true"` or `"false"`
|
|
94
|
+
- `dropdown` → must match a choice value shown by `--inspect`
|
|
95
|
+
- `radio` → must match a radio value shown by `--inspect`
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Route C: REFORMAT — apply design to an existing document
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
bash scripts/make.sh reformat \
|
|
103
|
+
--input source.md \
|
|
104
|
+
--title "Annual Report" \
|
|
105
|
+
--type "report" \
|
|
106
|
+
--author "Research Team" \
|
|
107
|
+
--out output.pdf
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Supported input: `.md` `.txt` `.pdf` `.json`
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Architecture
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
SKILL.md ← Skill entry point, route table
|
|
118
|
+
design/design.md ← Aesthetic system (read before CREATE/REFORMAT)
|
|
119
|
+
scripts/
|
|
120
|
+
make.sh ← Unified CLI
|
|
121
|
+
palette.py ← metadata → tokens.json [CREATE, REFORMAT]
|
|
122
|
+
cover.py ← tokens.json → cover.html [CREATE, REFORMAT]
|
|
123
|
+
render_cover.js ← cover.html → cover.pdf [CREATE, REFORMAT]
|
|
124
|
+
render_body.py ← tokens + content → body.pdf [CREATE, REFORMAT]
|
|
125
|
+
merge.py ← cover + body → final.pdf [CREATE, REFORMAT]
|
|
126
|
+
fill_inspect.py ← PDF → field list [FILL]
|
|
127
|
+
fill_write.py ← PDF + values → filled PDF [FILL]
|
|
128
|
+
reformat_parse.py ← doc → content.json [REFORMAT]
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Design tokens (`tokens.json`) flow from `palette.py` to every renderer — cover and body are always visually consistent.
|
|
132
|
+
|
|
133
|
+
## Dependencies
|
|
134
|
+
|
|
135
|
+
| Tool | Used by | Install |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| Python 3.9+ | all `.py` scripts | system |
|
|
138
|
+
| `reportlab` | `render_body.py` | `pip install reportlab` |
|
|
139
|
+
| `pypdf` | fill, merge, reformat | `pip install pypdf` |
|
|
140
|
+
| Node.js 18+ | `render_cover.js` | system |
|
|
141
|
+
| `playwright` + Chromium | `render_cover.js` | `npm install -g playwright && npx playwright install chromium` |
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
MIT
|
|
146
|
+
|
|
147
|
+
## Document types
|
|
148
|
+
|
|
149
|
+
| `--type` | Mood | Cover pattern | Cover fonts |
|
|
150
|
+
|---|---|---|---|
|
|
151
|
+
| `report` | Authoritative | `fullbleed` | Playfair Display / IBM Plex Sans |
|
|
152
|
+
| `proposal` | Confident | `split` | Syne / Nunito Sans |
|
|
153
|
+
| `resume` | Clean | `typographic` | DM Serif Display / DM Sans |
|
|
154
|
+
| `portfolio` | Expressive | `atmospheric` | Fraunces / Inter |
|
|
155
|
+
| `academic` | Scholarly | `typographic` | EB Garamond / Source Sans 3 |
|
|
156
|
+
| `general` | Neutral | `fullbleed` | Outfit |
|
|
157
|
+
| `minimal` | Restrained | `minimal` | Cormorant Garamond / Jost |
|
|
158
|
+
| `stripe` | Bold | `stripe` | Barlow Condensed / Barlow |
|
|
159
|
+
| `diagonal` | Dynamic | `diagonal` | Montserrat |
|
|
160
|
+
| `frame` | Classical | `frame` | Cormorant / Crimson Pro |
|
|
161
|
+
| `editorial` | Editorial | `editorial` | Bebas Neue / Libre Franklin |
|
|
162
|
+
|
|
163
|
+
Cover fonts load via Google Fonts `@import` at render time — no local caching.
|
|
164
|
+
Body pages always use system fonts (Times / Helvetica) via ReportLab.
|
|
165
|
+
|
|
166
|
+
## content.json schema
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
[
|
|
170
|
+
{"type": "h1", "text": "Section Title"},
|
|
171
|
+
{"type": "h2", "text": "Subsection"},
|
|
172
|
+
{"type": "h3", "text": "Sub-subsection"},
|
|
173
|
+
{"type": "body", "text": "Paragraph text. Supports <b>bold</b> and <i>italic</i>."},
|
|
174
|
+
{"type": "bullet", "text": "Unordered list item"},
|
|
175
|
+
{"type": "numbered","text": "Ordered list item — auto-numbered, counter resets between lists"},
|
|
176
|
+
{"type": "callout", "text": "Highlighted insight or key finding"},
|
|
177
|
+
{"type": "table",
|
|
178
|
+
"headers": ["Column A", "Column B", "Column C"],
|
|
179
|
+
"rows": [["row1a", "row1b", "row1c"], ["row2a", "row2b", "row2c"]]
|
|
180
|
+
},
|
|
181
|
+
{"type": "image", "path": "chart.png", "caption": "Figure 1: Sales by quarter"},
|
|
182
|
+
{"type": "code", "text": "SELECT * FROM users\nWHERE active = 1;"},
|
|
183
|
+
{"type": "math", "text": "\\sigma = \\sqrt{\\frac{1}{N}\\sum_{i=1}^N (x_i - \\mu)^2}", "label": "(2)"},
|
|
184
|
+
{"type": "divider"},
|
|
185
|
+
{"type": "caption", "text": "Table 2: standalone label"},
|
|
186
|
+
{"type": "pagebreak"},
|
|
187
|
+
{"type": "spacer", "pt": 16}
|
|
188
|
+
]
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Architecture
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
SKILL.md ← Skill entry point, routing only
|
|
195
|
+
design/design.md ← Aesthetic system (read before any script)
|
|
196
|
+
scripts/
|
|
197
|
+
make.sh ← Unified CLI: check / fix / run / demo
|
|
198
|
+
palette.py ← content metadata → tokens.json
|
|
199
|
+
cover.py ← tokens.json → cover.html
|
|
200
|
+
render_cover.js ← cover.html → cover.pdf (Playwright)
|
|
201
|
+
render_body.py ← tokens.json + content.json → body.pdf (ReportLab)
|
|
202
|
+
merge.py ← cover.pdf + body.pdf → final.pdf + QA report
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Design tokens (color, typography, spacing) are written once by `palette.py` and consumed by every downstream script. This guarantees visual consistency between cover and body without any manual coordination.
|
|
206
|
+
|
|
207
|
+
## Dependencies
|
|
208
|
+
|
|
209
|
+
| Tool | Purpose | Install |
|
|
210
|
+
|---|---|---|
|
|
211
|
+
| Python 3.9+ | palette, cover, render_body, merge | system |
|
|
212
|
+
| `reportlab` | Body page rendering | `pip install reportlab` |
|
|
213
|
+
| `pypdf` | Merging PDFs | `pip install pypdf` |
|
|
214
|
+
| Node.js 18+ | Cover rendering | system |
|
|
215
|
+
| `playwright` | Headless Chromium for cover | `npm install -g playwright && npx playwright install chromium` |
|
|
216
|
+
|
|
217
|
+
Run `bash scripts/make.sh check` to verify everything at once.
|
|
218
|
+
Run `bash scripts/make.sh fix` to auto-install what is missing.
|
|
219
|
+
|
|
220
|
+
## License
|
|
221
|
+
|
|
222
|
+
MIT
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pdf
|
|
3
|
+
description: >
|
|
4
|
+
Use this skill when visual quality and design identity matter for a PDF.
|
|
5
|
+
CREATE (generate from scratch): "make a PDF", "generate a report", "write a proposal",
|
|
6
|
+
"create a resume", "beautiful PDF", "professional document", "cover page",
|
|
7
|
+
"polished PDF", "client-ready document".
|
|
8
|
+
FILL (complete form fields): "fill in the form", "fill out this PDF",
|
|
9
|
+
"complete the form fields", "write values into PDF", "what fields does this PDF have".
|
|
10
|
+
REFORMAT (apply design to an existing doc): "reformat this document", "apply our style",
|
|
11
|
+
"convert this Markdown/text to PDF", "make this doc look good", "re-style this PDF".
|
|
12
|
+
This skill uses a token-based design system: color, typography, and spacing are derived
|
|
13
|
+
from the document type and flow through every page. The output is print-ready.
|
|
14
|
+
Prefer this skill when appearance matters, not just when any PDF output is needed.
|
|
15
|
+
metadata:
|
|
16
|
+
version: "1.0"
|
|
17
|
+
category: document-generation
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# pdf
|
|
21
|
+
|
|
22
|
+
Three tasks. One skill.
|
|
23
|
+
|
|
24
|
+
## Read `design/design.md` before any CREATE or REFORMAT work.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Route table
|
|
29
|
+
|
|
30
|
+
| User intent | Route | Scripts used |
|
|
31
|
+
|---|---|---|
|
|
32
|
+
| Generate a new PDF from scratch | **CREATE** | `palette.py` → `cover.py` → `render_cover.js` → `render_body.py` → `merge.py` |
|
|
33
|
+
| Fill / complete form fields in an existing PDF | **FILL** | `fill_inspect.py` → `fill_write.py` |
|
|
34
|
+
| Reformat / re-style an existing document | **REFORMAT** | `reformat_parse.py` → then full CREATE pipeline |
|
|
35
|
+
|
|
36
|
+
**Rule:** when in doubt between CREATE and REFORMAT, ask whether the user has an existing document to start from. If yes → REFORMAT. If no → CREATE.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Route A: CREATE
|
|
41
|
+
|
|
42
|
+
Full pipeline — content → design tokens → cover → body → merged PDF.
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
bash scripts/make.sh run \
|
|
46
|
+
--title "Q3 Strategy Review" --type proposal \
|
|
47
|
+
--author "Strategy Team" --date "October 2025" \
|
|
48
|
+
--accent "#2D5F8A" \
|
|
49
|
+
--content content.json --out report.pdf
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Doc types:** `report` · `proposal` · `resume` · `portfolio` · `academic` · `general` · `minimal` · `stripe` · `diagonal` · `frame` · `editorial` · `magazine` · `darkroom` · `terminal` · `poster`
|
|
53
|
+
|
|
54
|
+
| Type | Cover pattern | Visual identity |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| `report` | `fullbleed` | Dark bg, dot grid, Playfair Display |
|
|
57
|
+
| `proposal` | `split` | Left panel + right geometric, Syne |
|
|
58
|
+
| `resume` | `typographic` | Oversized first-word, DM Serif Display |
|
|
59
|
+
| `portfolio` | `atmospheric` | Near-black, radial glow, Fraunces |
|
|
60
|
+
| `academic` | `typographic` | Light bg, classical serif, EB Garamond |
|
|
61
|
+
| `general` | `fullbleed` | Dark slate, Outfit |
|
|
62
|
+
| `minimal` | `minimal` | White + single 8px accent bar, Cormorant Garamond |
|
|
63
|
+
| `stripe` | `stripe` | 3 bold horizontal color bands, Barlow Condensed |
|
|
64
|
+
| `diagonal` | `diagonal` | SVG angled cut, dark/light halves, Montserrat |
|
|
65
|
+
| `frame` | `frame` | Inset border, corner ornaments, Cormorant |
|
|
66
|
+
| `editorial` | `editorial` | Ghost letter, all-caps title, Bebas Neue |
|
|
67
|
+
| `magazine` | `magazine` | Warm cream bg, centered stack, hero image, Playfair Display |
|
|
68
|
+
| `darkroom` | `darkroom` | Navy bg, centered stack, grayscale image, Playfair Display |
|
|
69
|
+
| `terminal` | `terminal` | Near-black, grid lines, monospace, neon green |
|
|
70
|
+
| `poster` | `poster` | White bg, thick sidebar, oversized title, Barlow Condensed |
|
|
71
|
+
|
|
72
|
+
Cover extras (inject into tokens via `--abstract`, `--cover-image`):
|
|
73
|
+
- `--abstract "text"` — abstract text block on the cover (magazine/darkroom)
|
|
74
|
+
- `--cover-image "url"` — hero image URL/path (magazine, darkroom, poster)
|
|
75
|
+
|
|
76
|
+
**Color overrides — always choose these based on document content:**
|
|
77
|
+
- `--accent "#HEX"` — override the accent color; `accent_lt` is auto-derived by lightening toward white
|
|
78
|
+
- `--cover-bg "#HEX"` — override the cover background color
|
|
79
|
+
|
|
80
|
+
**Accent color selection guidance:**
|
|
81
|
+
|
|
82
|
+
You have creative authority over the accent color. Pick it from the document's semantic context — title, industry, purpose, audience — not from generic "safe" choices. The accent appears on section rules, callout bars, table headers, and the cover: it carries the document's visual identity.
|
|
83
|
+
|
|
84
|
+
| Context | Suggested accent range |
|
|
85
|
+
|---|---|
|
|
86
|
+
| Legal / compliance / finance | Deep navy `#1C3A5E`, charcoal `#2E3440`, slate `#3D4C5E` |
|
|
87
|
+
| Healthcare / medical | Teal-green `#2A6B5A`, cool green `#3A7D6A` |
|
|
88
|
+
| Technology / engineering | Steel blue `#2D5F8A`, indigo `#3D4F8A` |
|
|
89
|
+
| Environmental / sustainability | Forest `#2E5E3A`, olive `#4A5E2A` |
|
|
90
|
+
| Creative / arts / culture | Burgundy `#6B2A35`, plum `#5A2A6B`, terracotta `#8A3A2A` |
|
|
91
|
+
| Academic / research | Deep teal `#2A5A6B`, library blue `#2A4A6B` |
|
|
92
|
+
| Corporate / neutral | Slate `#3D4A5A`, graphite `#444C56` |
|
|
93
|
+
| Luxury / premium | Warm black `#1A1208`, deep bronze `#4A3820` |
|
|
94
|
+
|
|
95
|
+
**Rule:** choose a color that a thoughtful designer would select for this specific document — not the type's default. Muted, desaturated tones work best; avoid vivid primaries. When in doubt, go darker and more neutral.
|
|
96
|
+
|
|
97
|
+
**content.json block types:**
|
|
98
|
+
|
|
99
|
+
| Block | Usage | Key fields |
|
|
100
|
+
|---|---|---|
|
|
101
|
+
| `h1` | Section heading + accent rule | `text` |
|
|
102
|
+
| `h2` | Subsection heading | `text` |
|
|
103
|
+
| `h3` | Sub-subsection (bold) | `text` |
|
|
104
|
+
| `body` | Justified paragraph; supports `<b>` `<i>` markup | `text` |
|
|
105
|
+
| `bullet` | Unordered list item (• prefix) | `text` |
|
|
106
|
+
| `numbered` | Ordered list item — counter auto-resets on non-numbered blocks | `text` |
|
|
107
|
+
| `callout` | Highlighted insight box with accent left bar | `text` |
|
|
108
|
+
| `table` | Data table — accent header, alternating row tints | `headers`, `rows`, `col_widths`?, `caption`? |
|
|
109
|
+
| `image` | Embedded image scaled to column width | `path`/`src`, `caption`? |
|
|
110
|
+
| `figure` | Image with auto-numbered "Figure N:" caption | `path`/`src`, `caption`? |
|
|
111
|
+
| `code` | Monospace code block with accent left border | `text`, `language`? |
|
|
112
|
+
| `math` | Display math — LaTeX syntax via matplotlib mathtext | `text`, `label`?, `caption`? |
|
|
113
|
+
| `chart` | Bar / line / pie chart rendered with matplotlib | `chart_type`, `labels`, `datasets`, `title`?, `x_label`?, `y_label`?, `caption`?, `figure`? |
|
|
114
|
+
| `flowchart` | Process diagram with nodes + edges via matplotlib | `nodes`, `edges`, `caption`?, `figure`? |
|
|
115
|
+
| `bibliography` | Numbered reference list with hanging indent | `items` [{id, text}], `title`? |
|
|
116
|
+
| `divider` | Accent-colored full-width rule | — |
|
|
117
|
+
| `caption` | Small muted label | `text` |
|
|
118
|
+
| `pagebreak` | Force a new page | — |
|
|
119
|
+
| `spacer` | Vertical whitespace | `pt` (default 12) |
|
|
120
|
+
|
|
121
|
+
**chart / flowchart schemas:**
|
|
122
|
+
```json
|
|
123
|
+
{"type":"chart","chart_type":"bar","labels":["Q1","Q2","Q3","Q4"],
|
|
124
|
+
"datasets":[{"label":"Revenue","values":[120,145,132,178]}],"caption":"Q results"}
|
|
125
|
+
|
|
126
|
+
{"type":"flowchart",
|
|
127
|
+
"nodes":[{"id":"s","label":"Start","shape":"oval"},
|
|
128
|
+
{"id":"p","label":"Process","shape":"rect"},
|
|
129
|
+
{"id":"d","label":"Valid?","shape":"diamond"},
|
|
130
|
+
{"id":"e","label":"End","shape":"oval"}],
|
|
131
|
+
"edges":[{"from":"s","to":"p"},{"from":"p","to":"d"},
|
|
132
|
+
{"from":"d","to":"e","label":"Yes"},{"from":"d","to":"p","label":"No"}]}
|
|
133
|
+
|
|
134
|
+
{"type":"bibliography","items":[
|
|
135
|
+
{"id":"1","text":"Author (Year). Title. Publisher."}]}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Route B: FILL
|
|
141
|
+
|
|
142
|
+
Fill form fields in an existing PDF without altering layout or design.
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Step 1: inspect
|
|
146
|
+
python3 scripts/fill_inspect.py --input form.pdf
|
|
147
|
+
|
|
148
|
+
# Step 2: fill
|
|
149
|
+
python3 scripts/fill_write.py --input form.pdf --out filled.pdf \
|
|
150
|
+
--values '{"FirstName": "Jane", "Agree": "true", "Country": "US"}'
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
| Field type | Value format |
|
|
154
|
+
|---|---|
|
|
155
|
+
| `text` | Any string |
|
|
156
|
+
| `checkbox` | `"true"` or `"false"` |
|
|
157
|
+
| `dropdown` | Must match a choice value from inspect output |
|
|
158
|
+
| `radio` | Must match a radio value (often starts with `/`) |
|
|
159
|
+
|
|
160
|
+
Always run `fill_inspect.py` first to get exact field names.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Route C: REFORMAT
|
|
165
|
+
|
|
166
|
+
Parse an existing document → content.json → CREATE pipeline.
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
bash scripts/make.sh reformat \
|
|
170
|
+
--input source.md --title "My Report" --type report --out output.pdf
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Supported input formats:** `.md` `.txt` `.pdf` `.json`
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Environment
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
bash scripts/make.sh check # verify all deps
|
|
181
|
+
bash scripts/make.sh fix # auto-install missing deps
|
|
182
|
+
bash scripts/make.sh demo # build a sample PDF
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
| Tool | Used by | Install |
|
|
186
|
+
|---|---|---|
|
|
187
|
+
| Python 3.9+ | all `.py` scripts | system |
|
|
188
|
+
| `reportlab` | `render_body.py` | `pip install reportlab` |
|
|
189
|
+
| `pypdf` | fill, merge, reformat | `pip install pypdf` |
|
|
190
|
+
| Node.js 18+ | `render_cover.js` | system |
|
|
191
|
+
| `playwright` + Chromium | `render_cover.js` | `npm install -g playwright && npx playwright install chromium` |
|