scientific-writer 2.3.1__py3-none-any.whl

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 (315) hide show
  1. scientific_writer/.claude/WRITER.md +822 -0
  2. scientific_writer/.claude/settings.local.json +30 -0
  3. scientific_writer/.claude/skills/citation-management/SKILL.md +1046 -0
  4. scientific_writer/.claude/skills/citation-management/assets/bibtex_template.bib +264 -0
  5. scientific_writer/.claude/skills/citation-management/assets/citation_checklist.md +386 -0
  6. scientific_writer/.claude/skills/citation-management/references/bibtex_formatting.md +908 -0
  7. scientific_writer/.claude/skills/citation-management/references/citation_validation.md +794 -0
  8. scientific_writer/.claude/skills/citation-management/references/google_scholar_search.md +725 -0
  9. scientific_writer/.claude/skills/citation-management/references/metadata_extraction.md +870 -0
  10. scientific_writer/.claude/skills/citation-management/references/pubmed_search.md +839 -0
  11. scientific_writer/.claude/skills/citation-management/scripts/doi_to_bibtex.py +204 -0
  12. scientific_writer/.claude/skills/citation-management/scripts/extract_metadata.py +569 -0
  13. scientific_writer/.claude/skills/citation-management/scripts/format_bibtex.py +349 -0
  14. scientific_writer/.claude/skills/citation-management/scripts/search_google_scholar.py +282 -0
  15. scientific_writer/.claude/skills/citation-management/scripts/search_pubmed.py +398 -0
  16. scientific_writer/.claude/skills/citation-management/scripts/validate_citations.py +497 -0
  17. scientific_writer/.claude/skills/clinical-reports/IMPLEMENTATION_SUMMARY.md +641 -0
  18. scientific_writer/.claude/skills/clinical-reports/README.md +236 -0
  19. scientific_writer/.claude/skills/clinical-reports/SKILL.md +1088 -0
  20. scientific_writer/.claude/skills/clinical-reports/assets/case_report_template.md +352 -0
  21. scientific_writer/.claude/skills/clinical-reports/assets/clinical_trial_csr_template.md +353 -0
  22. scientific_writer/.claude/skills/clinical-reports/assets/clinical_trial_sae_template.md +359 -0
  23. scientific_writer/.claude/skills/clinical-reports/assets/consult_note_template.md +305 -0
  24. scientific_writer/.claude/skills/clinical-reports/assets/discharge_summary_template.md +453 -0
  25. scientific_writer/.claude/skills/clinical-reports/assets/hipaa_compliance_checklist.md +395 -0
  26. scientific_writer/.claude/skills/clinical-reports/assets/history_physical_template.md +305 -0
  27. scientific_writer/.claude/skills/clinical-reports/assets/lab_report_template.md +309 -0
  28. scientific_writer/.claude/skills/clinical-reports/assets/pathology_report_template.md +249 -0
  29. scientific_writer/.claude/skills/clinical-reports/assets/quality_checklist.md +338 -0
  30. scientific_writer/.claude/skills/clinical-reports/assets/radiology_report_template.md +318 -0
  31. scientific_writer/.claude/skills/clinical-reports/assets/soap_note_template.md +253 -0
  32. scientific_writer/.claude/skills/clinical-reports/references/case_report_guidelines.md +570 -0
  33. scientific_writer/.claude/skills/clinical-reports/references/clinical_trial_reporting.md +693 -0
  34. scientific_writer/.claude/skills/clinical-reports/references/data_presentation.md +530 -0
  35. scientific_writer/.claude/skills/clinical-reports/references/diagnostic_reports_standards.md +629 -0
  36. scientific_writer/.claude/skills/clinical-reports/references/medical_terminology.md +588 -0
  37. scientific_writer/.claude/skills/clinical-reports/references/patient_documentation.md +744 -0
  38. scientific_writer/.claude/skills/clinical-reports/references/peer_review_standards.md +585 -0
  39. scientific_writer/.claude/skills/clinical-reports/references/regulatory_compliance.md +577 -0
  40. scientific_writer/.claude/skills/clinical-reports/scripts/check_deidentification.py +346 -0
  41. scientific_writer/.claude/skills/clinical-reports/scripts/compliance_checker.py +78 -0
  42. scientific_writer/.claude/skills/clinical-reports/scripts/extract_clinical_data.py +102 -0
  43. scientific_writer/.claude/skills/clinical-reports/scripts/format_adverse_events.py +103 -0
  44. scientific_writer/.claude/skills/clinical-reports/scripts/generate_report_template.py +163 -0
  45. scientific_writer/.claude/skills/clinical-reports/scripts/terminology_validator.py +133 -0
  46. scientific_writer/.claude/skills/clinical-reports/scripts/validate_case_report.py +334 -0
  47. scientific_writer/.claude/skills/clinical-reports/scripts/validate_trial_report.py +89 -0
  48. scientific_writer/.claude/skills/document-skills/docx/LICENSE.txt +30 -0
  49. scientific_writer/.claude/skills/document-skills/docx/SKILL.md +197 -0
  50. scientific_writer/.claude/skills/document-skills/docx/docx-js.md +350 -0
  51. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  52. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  53. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  54. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  55. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  56. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  57. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  58. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  59. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  60. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  61. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  62. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  63. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  64. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  65. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  66. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  67. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  68. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  69. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  70. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  71. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  72. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  73. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  74. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  75. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  76. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  77. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  78. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  79. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  80. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  81. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  82. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/mce/mc.xsd +75 -0
  83. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
  84. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
  85. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
  86. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
  87. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
  88. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  89. scientific_writer/.claude/skills/document-skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
  90. scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/pack.py +159 -0
  91. scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/unpack.py +29 -0
  92. scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/validate.py +69 -0
  93. scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/validation/__init__.py +15 -0
  94. scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/validation/base.py +951 -0
  95. scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/validation/docx.py +274 -0
  96. scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/validation/pptx.py +315 -0
  97. scientific_writer/.claude/skills/document-skills/docx/ooxml/scripts/validation/redlining.py +279 -0
  98. scientific_writer/.claude/skills/document-skills/docx/ooxml.md +610 -0
  99. scientific_writer/.claude/skills/document-skills/docx/scripts/__init__.py +1 -0
  100. scientific_writer/.claude/skills/document-skills/docx/scripts/document.py +1276 -0
  101. scientific_writer/.claude/skills/document-skills/docx/scripts/templates/comments.xml +3 -0
  102. scientific_writer/.claude/skills/document-skills/docx/scripts/templates/commentsExtended.xml +3 -0
  103. scientific_writer/.claude/skills/document-skills/docx/scripts/templates/commentsExtensible.xml +3 -0
  104. scientific_writer/.claude/skills/document-skills/docx/scripts/templates/commentsIds.xml +3 -0
  105. scientific_writer/.claude/skills/document-skills/docx/scripts/templates/people.xml +3 -0
  106. scientific_writer/.claude/skills/document-skills/docx/scripts/utilities.py +374 -0
  107. scientific_writer/.claude/skills/document-skills/pdf/LICENSE.txt +30 -0
  108. scientific_writer/.claude/skills/document-skills/pdf/SKILL.md +294 -0
  109. scientific_writer/.claude/skills/document-skills/pdf/forms.md +205 -0
  110. scientific_writer/.claude/skills/document-skills/pdf/reference.md +612 -0
  111. scientific_writer/.claude/skills/document-skills/pdf/scripts/check_bounding_boxes.py +70 -0
  112. scientific_writer/.claude/skills/document-skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
  113. scientific_writer/.claude/skills/document-skills/pdf/scripts/check_fillable_fields.py +12 -0
  114. scientific_writer/.claude/skills/document-skills/pdf/scripts/convert_pdf_to_images.py +35 -0
  115. scientific_writer/.claude/skills/document-skills/pdf/scripts/create_validation_image.py +41 -0
  116. scientific_writer/.claude/skills/document-skills/pdf/scripts/extract_form_field_info.py +152 -0
  117. scientific_writer/.claude/skills/document-skills/pdf/scripts/fill_fillable_fields.py +114 -0
  118. scientific_writer/.claude/skills/document-skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
  119. scientific_writer/.claude/skills/document-skills/pptx/LICENSE.txt +30 -0
  120. scientific_writer/.claude/skills/document-skills/pptx/SKILL.md +484 -0
  121. scientific_writer/.claude/skills/document-skills/pptx/html2pptx.md +625 -0
  122. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  123. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  124. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  125. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  126. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  127. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  128. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  129. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  130. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  131. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  132. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  133. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  134. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  135. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  136. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  137. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  138. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  139. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  140. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  141. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  142. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  143. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  144. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  145. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  146. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  147. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  148. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  149. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  150. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  151. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  152. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  153. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/mce/mc.xsd +75 -0
  154. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
  155. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
  156. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
  157. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
  158. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
  159. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  160. scientific_writer/.claude/skills/document-skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
  161. scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/pack.py +159 -0
  162. scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/unpack.py +29 -0
  163. scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/validate.py +69 -0
  164. scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/validation/__init__.py +15 -0
  165. scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/validation/base.py +951 -0
  166. scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/validation/docx.py +274 -0
  167. scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/validation/pptx.py +315 -0
  168. scientific_writer/.claude/skills/document-skills/pptx/ooxml/scripts/validation/redlining.py +279 -0
  169. scientific_writer/.claude/skills/document-skills/pptx/ooxml.md +427 -0
  170. scientific_writer/.claude/skills/document-skills/pptx/scripts/html2pptx.js +979 -0
  171. scientific_writer/.claude/skills/document-skills/pptx/scripts/inventory.py +1020 -0
  172. scientific_writer/.claude/skills/document-skills/pptx/scripts/rearrange.py +231 -0
  173. scientific_writer/.claude/skills/document-skills/pptx/scripts/replace.py +385 -0
  174. scientific_writer/.claude/skills/document-skills/pptx/scripts/thumbnail.py +450 -0
  175. scientific_writer/.claude/skills/document-skills/xlsx/LICENSE.txt +30 -0
  176. scientific_writer/.claude/skills/document-skills/xlsx/SKILL.md +289 -0
  177. scientific_writer/.claude/skills/document-skills/xlsx/recalc.py +178 -0
  178. scientific_writer/.claude/skills/hypothesis-generation/SKILL.md +155 -0
  179. scientific_writer/.claude/skills/hypothesis-generation/assets/hypothesis_output_template.md +302 -0
  180. scientific_writer/.claude/skills/hypothesis-generation/references/experimental_design_patterns.md +327 -0
  181. scientific_writer/.claude/skills/hypothesis-generation/references/hypothesis_quality_criteria.md +196 -0
  182. scientific_writer/.claude/skills/hypothesis-generation/references/literature_search_strategies.md +505 -0
  183. scientific_writer/.claude/skills/latex-posters/README.md +417 -0
  184. scientific_writer/.claude/skills/latex-posters/SKILL.md +919 -0
  185. scientific_writer/.claude/skills/latex-posters/assets/baposter_template.tex +257 -0
  186. scientific_writer/.claude/skills/latex-posters/assets/beamerposter_template.tex +244 -0
  187. scientific_writer/.claude/skills/latex-posters/assets/poster_quality_checklist.md +358 -0
  188. scientific_writer/.claude/skills/latex-posters/assets/tikzposter_template.tex +251 -0
  189. scientific_writer/.claude/skills/latex-posters/references/latex_poster_packages.md +745 -0
  190. scientific_writer/.claude/skills/latex-posters/references/poster_content_guide.md +748 -0
  191. scientific_writer/.claude/skills/latex-posters/references/poster_design_principles.md +806 -0
  192. scientific_writer/.claude/skills/latex-posters/references/poster_layout_design.md +900 -0
  193. scientific_writer/.claude/skills/latex-posters/scripts/review_poster.sh +214 -0
  194. scientific_writer/.claude/skills/literature-review/SKILL.md +546 -0
  195. scientific_writer/.claude/skills/literature-review/assets/review_template.md +412 -0
  196. scientific_writer/.claude/skills/literature-review/references/citation_styles.md +166 -0
  197. scientific_writer/.claude/skills/literature-review/references/database_strategies.md +381 -0
  198. scientific_writer/.claude/skills/literature-review/scripts/generate_pdf.py +176 -0
  199. scientific_writer/.claude/skills/literature-review/scripts/search_databases.py +303 -0
  200. scientific_writer/.claude/skills/literature-review/scripts/verify_citations.py +222 -0
  201. scientific_writer/.claude/skills/markitdown/INSTALLATION_GUIDE.md +318 -0
  202. scientific_writer/.claude/skills/markitdown/LICENSE.txt +22 -0
  203. scientific_writer/.claude/skills/markitdown/OPENROUTER_INTEGRATION.md +359 -0
  204. scientific_writer/.claude/skills/markitdown/QUICK_REFERENCE.md +309 -0
  205. scientific_writer/.claude/skills/markitdown/README.md +184 -0
  206. scientific_writer/.claude/skills/markitdown/SKILL.md +450 -0
  207. scientific_writer/.claude/skills/markitdown/SKILL_SUMMARY.md +307 -0
  208. scientific_writer/.claude/skills/markitdown/assets/example_usage.md +463 -0
  209. scientific_writer/.claude/skills/markitdown/references/api_reference.md +399 -0
  210. scientific_writer/.claude/skills/markitdown/references/file_formats.md +542 -0
  211. scientific_writer/.claude/skills/markitdown/scripts/batch_convert.py +228 -0
  212. scientific_writer/.claude/skills/markitdown/scripts/convert_literature.py +283 -0
  213. scientific_writer/.claude/skills/markitdown/scripts/convert_with_ai.py +243 -0
  214. scientific_writer/.claude/skills/paper-2-web/SKILL.md +455 -0
  215. scientific_writer/.claude/skills/paper-2-web/references/installation.md +141 -0
  216. scientific_writer/.claude/skills/paper-2-web/references/paper2poster.md +346 -0
  217. scientific_writer/.claude/skills/paper-2-web/references/paper2video.md +305 -0
  218. scientific_writer/.claude/skills/paper-2-web/references/paper2web.md +187 -0
  219. scientific_writer/.claude/skills/paper-2-web/references/usage_examples.md +436 -0
  220. scientific_writer/.claude/skills/peer-review/SKILL.md +375 -0
  221. scientific_writer/.claude/skills/peer-review/references/common_issues.md +552 -0
  222. scientific_writer/.claude/skills/peer-review/references/reporting_standards.md +290 -0
  223. scientific_writer/.claude/skills/research-grants/README.md +285 -0
  224. scientific_writer/.claude/skills/research-grants/SKILL.md +896 -0
  225. scientific_writer/.claude/skills/research-grants/assets/budget_justification_template.md +453 -0
  226. scientific_writer/.claude/skills/research-grants/assets/nih_specific_aims_template.md +166 -0
  227. scientific_writer/.claude/skills/research-grants/assets/nsf_project_summary_template.md +92 -0
  228. scientific_writer/.claude/skills/research-grants/references/broader_impacts.md +392 -0
  229. scientific_writer/.claude/skills/research-grants/references/darpa_guidelines.md +636 -0
  230. scientific_writer/.claude/skills/research-grants/references/doe_guidelines.md +586 -0
  231. scientific_writer/.claude/skills/research-grants/references/nih_guidelines.md +851 -0
  232. scientific_writer/.claude/skills/research-grants/references/nsf_guidelines.md +570 -0
  233. scientific_writer/.claude/skills/research-grants/references/specific_aims_guide.md +458 -0
  234. scientific_writer/.claude/skills/research-lookup/README.md +116 -0
  235. scientific_writer/.claude/skills/research-lookup/SKILL.md +443 -0
  236. scientific_writer/.claude/skills/research-lookup/examples.py +174 -0
  237. scientific_writer/.claude/skills/research-lookup/lookup.py +93 -0
  238. scientific_writer/.claude/skills/research-lookup/research_lookup.py +335 -0
  239. scientific_writer/.claude/skills/research-lookup/scripts/research_lookup.py +261 -0
  240. scientific_writer/.claude/skills/scholar-evaluation/SKILL.md +254 -0
  241. scientific_writer/.claude/skills/scholar-evaluation/references/evaluation_framework.md +663 -0
  242. scientific_writer/.claude/skills/scholar-evaluation/scripts/calculate_scores.py +378 -0
  243. scientific_writer/.claude/skills/scientific-critical-thinking/SKILL.md +530 -0
  244. scientific_writer/.claude/skills/scientific-critical-thinking/references/common_biases.md +364 -0
  245. scientific_writer/.claude/skills/scientific-critical-thinking/references/evidence_hierarchy.md +484 -0
  246. scientific_writer/.claude/skills/scientific-critical-thinking/references/experimental_design.md +496 -0
  247. scientific_writer/.claude/skills/scientific-critical-thinking/references/logical_fallacies.md +478 -0
  248. scientific_writer/.claude/skills/scientific-critical-thinking/references/scientific_method.md +169 -0
  249. scientific_writer/.claude/skills/scientific-critical-thinking/references/statistical_pitfalls.md +506 -0
  250. scientific_writer/.claude/skills/scientific-schematics/SKILL.md +2035 -0
  251. scientific_writer/.claude/skills/scientific-schematics/assets/block_diagram_template.tex +199 -0
  252. scientific_writer/.claude/skills/scientific-schematics/assets/circuit_template.tex +159 -0
  253. scientific_writer/.claude/skills/scientific-schematics/assets/flowchart_template.tex +161 -0
  254. scientific_writer/.claude/skills/scientific-schematics/assets/pathway_template.tex +162 -0
  255. scientific_writer/.claude/skills/scientific-schematics/assets/tikz_styles.tex +422 -0
  256. scientific_writer/.claude/skills/scientific-schematics/references/best_practices.md +562 -0
  257. scientific_writer/.claude/skills/scientific-schematics/references/diagram_types.md +637 -0
  258. scientific_writer/.claude/skills/scientific-schematics/references/python_libraries.md +791 -0
  259. scientific_writer/.claude/skills/scientific-schematics/references/tikz_guide.md +734 -0
  260. scientific_writer/.claude/skills/scientific-schematics/scripts/circuit_generator.py +307 -0
  261. scientific_writer/.claude/skills/scientific-schematics/scripts/compile_tikz.py +292 -0
  262. scientific_writer/.claude/skills/scientific-schematics/scripts/generate_flowchart.py +281 -0
  263. scientific_writer/.claude/skills/scientific-schematics/scripts/pathway_diagram.py +406 -0
  264. scientific_writer/.claude/skills/scientific-writing/SKILL.md +443 -0
  265. scientific_writer/.claude/skills/scientific-writing/references/citation_styles.md +720 -0
  266. scientific_writer/.claude/skills/scientific-writing/references/figures_tables.md +806 -0
  267. scientific_writer/.claude/skills/scientific-writing/references/imrad_structure.md +658 -0
  268. scientific_writer/.claude/skills/scientific-writing/references/reporting_guidelines.md +748 -0
  269. scientific_writer/.claude/skills/scientific-writing/references/writing_principles.md +824 -0
  270. scientific_writer/.claude/skills/treatment-plans/README.md +488 -0
  271. scientific_writer/.claude/skills/treatment-plans/SKILL.md +1536 -0
  272. scientific_writer/.claude/skills/treatment-plans/assets/STYLING_QUICK_REFERENCE.md +185 -0
  273. scientific_writer/.claude/skills/treatment-plans/assets/chronic_disease_management_plan.tex +665 -0
  274. scientific_writer/.claude/skills/treatment-plans/assets/general_medical_treatment_plan.tex +547 -0
  275. scientific_writer/.claude/skills/treatment-plans/assets/medical_treatment_plan.sty +222 -0
  276. scientific_writer/.claude/skills/treatment-plans/assets/mental_health_treatment_plan.tex +774 -0
  277. scientific_writer/.claude/skills/treatment-plans/assets/one_page_treatment_plan.tex +193 -0
  278. scientific_writer/.claude/skills/treatment-plans/assets/pain_management_plan.tex +799 -0
  279. scientific_writer/.claude/skills/treatment-plans/assets/perioperative_care_plan.tex +753 -0
  280. scientific_writer/.claude/skills/treatment-plans/assets/quality_checklist.md +471 -0
  281. scientific_writer/.claude/skills/treatment-plans/assets/rehabilitation_treatment_plan.tex +756 -0
  282. scientific_writer/.claude/skills/treatment-plans/references/goal_setting_frameworks.md +411 -0
  283. scientific_writer/.claude/skills/treatment-plans/references/intervention_guidelines.md +507 -0
  284. scientific_writer/.claude/skills/treatment-plans/references/regulatory_compliance.md +476 -0
  285. scientific_writer/.claude/skills/treatment-plans/references/specialty_specific_guidelines.md +655 -0
  286. scientific_writer/.claude/skills/treatment-plans/references/treatment_plan_standards.md +485 -0
  287. scientific_writer/.claude/skills/treatment-plans/scripts/check_completeness.py +318 -0
  288. scientific_writer/.claude/skills/treatment-plans/scripts/generate_template.py +244 -0
  289. scientific_writer/.claude/skills/treatment-plans/scripts/timeline_generator.py +369 -0
  290. scientific_writer/.claude/skills/treatment-plans/scripts/validate_treatment_plan.py +367 -0
  291. scientific_writer/.claude/skills/venue-templates/SKILL.md +590 -0
  292. scientific_writer/.claude/skills/venue-templates/assets/grants/nih_specific_aims.tex +235 -0
  293. scientific_writer/.claude/skills/venue-templates/assets/grants/nsf_proposal_template.tex +375 -0
  294. scientific_writer/.claude/skills/venue-templates/assets/journals/nature_article.tex +171 -0
  295. scientific_writer/.claude/skills/venue-templates/assets/journals/neurips_article.tex +283 -0
  296. scientific_writer/.claude/skills/venue-templates/assets/journals/plos_one.tex +317 -0
  297. scientific_writer/.claude/skills/venue-templates/assets/posters/beamerposter_academic.tex +311 -0
  298. scientific_writer/.claude/skills/venue-templates/references/conferences_formatting.md +564 -0
  299. scientific_writer/.claude/skills/venue-templates/references/grants_requirements.md +787 -0
  300. scientific_writer/.claude/skills/venue-templates/references/journals_formatting.md +486 -0
  301. scientific_writer/.claude/skills/venue-templates/references/posters_guidelines.md +628 -0
  302. scientific_writer/.claude/skills/venue-templates/scripts/customize_template.py +206 -0
  303. scientific_writer/.claude/skills/venue-templates/scripts/query_template.py +260 -0
  304. scientific_writer/.claude/skills/venue-templates/scripts/validate_format.py +255 -0
  305. scientific_writer/__init__.py +43 -0
  306. scientific_writer/api.py +393 -0
  307. scientific_writer/cli.py +326 -0
  308. scientific_writer/core.py +275 -0
  309. scientific_writer/models.py +76 -0
  310. scientific_writer/utils.py +289 -0
  311. scientific_writer-2.3.1.dist-info/METADATA +272 -0
  312. scientific_writer-2.3.1.dist-info/RECORD +315 -0
  313. scientific_writer-2.3.1.dist-info/WHEEL +4 -0
  314. scientific_writer-2.3.1.dist-info/entry_points.txt +2 -0
  315. scientific_writer-2.3.1.dist-info/licenses/LICENSE +22 -0
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Validate clinical trial reports against ICH-E3 structure.
4
+
5
+ Checks Clinical Study Reports (CSR) for ICH-E3 compliance.
6
+
7
+ Usage:
8
+ python validate_trial_report.py <csr_file.md>
9
+ """
10
+
11
+ import argparse
12
+ import json
13
+ import re
14
+ from pathlib import Path
15
+
16
+
17
+ ICH_E3_SECTIONS = {
18
+ "title_page": "Title Page",
19
+ "synopsis": "Synopsis (2)",
20
+ "toc": "Table of Contents (3)",
21
+ "abbreviations": "List of Abbreviations (4)",
22
+ "ethics": "Ethics (Section 2)",
23
+ "investigators": "Investigators and Study Administrative Structure (Section 3)",
24
+ "introduction": "Introduction (Section 4)",
25
+ "objectives": "Study Objectives and Plan (Section 5)",
26
+ "study_patients": "Study Patients (Section 6)",
27
+ "efficacy": "Efficacy Evaluation (Section 7)",
28
+ "safety": "Safety Evaluation (Section 8)",
29
+ "discussion": "Discussion and Overall Conclusions (Section 9)",
30
+ "tables_figures": "Tables, Figures, and Graphs (Section 10)",
31
+ "references": "References (Section 11)",
32
+ "appendices": "Appendices (Section 12-14)",
33
+ }
34
+
35
+
36
+ def validate_ich_e3(filename: str) -> dict:
37
+ """Validate CSR structure against ICH-E3."""
38
+ with open(filename, 'r', encoding='utf-8') as f:
39
+ content = f.read()
40
+
41
+ results = {}
42
+ for section_id, section_name in ICH_E3_SECTIONS.items():
43
+ # Simple pattern matching for section headers
44
+ pattern = rf"(?i)##?\s*{re.escape(section_name.split('(')[0].strip())}"
45
+ found = bool(re.search(pattern, content))
46
+ results[section_id] = {"name": section_name, "found": found}
47
+
48
+ compliance_rate = sum(1 for r in results.values() if r["found"]) / len(results) * 100
49
+
50
+ return {
51
+ "filename": filename,
52
+ "compliance_rate": round(compliance_rate, 1),
53
+ "sections": results,
54
+ "status": "PASS" if compliance_rate >= 90 else "NEEDS_REVISION"
55
+ }
56
+
57
+
58
+ def main():
59
+ """Main entry point."""
60
+ parser = argparse.ArgumentParser(description="Validate CSR against ICH-E3")
61
+ parser.add_argument("input_file", help="Path to CSR file")
62
+ parser.add_argument("--json", action="store_true", help="Output JSON")
63
+
64
+ args = parser.parse_args()
65
+
66
+ try:
67
+ report = validate_ich_e3(args.input_file)
68
+
69
+ if args.json:
70
+ print(json.dumps(report, indent=2))
71
+ else:
72
+ print(f"\nICH-E3 Compliance: {report['compliance_rate']}%")
73
+ print(f"Status: {report['status']}\n")
74
+ print("Section Checklist:")
75
+ for section, details in report["sections"].items():
76
+ symbol = "✓" if details["found"] else "✗"
77
+ print(f"{symbol} {details['name']}")
78
+
79
+ return 0 if report["status"] == "PASS" else 1
80
+
81
+ except Exception as e:
82
+ print(f"Error: {e}")
83
+ return 1
84
+
85
+
86
+ if __name__ == "__main__":
87
+ import sys
88
+ sys.exit(main())
89
+
@@ -0,0 +1,30 @@
1
+ © 2025 Anthropic, PBC. All rights reserved.
2
+
3
+ LICENSE: Use of these materials (including all code, prompts, assets, files,
4
+ and other components of this Skill) is governed by your agreement with
5
+ Anthropic regarding use of Anthropic's services. If no separate agreement
6
+ exists, use is governed by Anthropic's Consumer Terms of Service or
7
+ Commercial Terms of Service, as applicable:
8
+ https://www.anthropic.com/legal/consumer-terms
9
+ https://www.anthropic.com/legal/commercial-terms
10
+ Your applicable agreement is referred to as the "Agreement." "Services" are
11
+ as defined in the Agreement.
12
+
13
+ ADDITIONAL RESTRICTIONS: Notwithstanding anything in the Agreement to the
14
+ contrary, users may not:
15
+
16
+ - Extract these materials from the Services or retain copies of these
17
+ materials outside the Services
18
+ - Reproduce or copy these materials, except for temporary copies created
19
+ automatically during authorized use of the Services
20
+ - Create derivative works based on these materials
21
+ - Distribute, sublicense, or transfer these materials to any third party
22
+ - Make, offer to sell, sell, or import any inventions embodied in these
23
+ materials
24
+ - Reverse engineer, decompile, or disassemble these materials
25
+
26
+ The receipt, viewing, or possession of these materials does not convey or
27
+ imply any license or right beyond those expressly granted above.
28
+
29
+ Anthropic retains all right, title, and interest in these materials,
30
+ including all copyrights, patents, and other intellectual property rights.
@@ -0,0 +1,197 @@
1
+ ---
2
+ name: docx
3
+ description: "Document toolkit (.docx). Create/edit documents, tracked changes, comments, formatting preservation, text extraction, for professional document processing."
4
+ license: Proprietary. LICENSE.txt has complete terms
5
+ ---
6
+
7
+ # DOCX creation, editing, and analysis
8
+
9
+ ## Overview
10
+
11
+ A .docx file is a ZIP archive containing XML files and resources. Create, edit, or analyze Word documents using text extraction, raw XML access, or redlining workflows. Apply this skill for professional document processing, tracked changes, and content manipulation.
12
+
13
+ ## Workflow Decision Tree
14
+
15
+ ### Reading/Analyzing Content
16
+ Use "Text extraction" or "Raw XML access" sections below
17
+
18
+ ### Creating New Document
19
+ Use "Creating a new Word document" workflow
20
+
21
+ ### Editing Existing Document
22
+ - **Your own document + simple changes**
23
+ Use "Basic OOXML editing" workflow
24
+
25
+ - **Someone else's document**
26
+ Use **"Redlining workflow"** (recommended default)
27
+
28
+ - **Legal, academic, business, or government docs**
29
+ Use **"Redlining workflow"** (required)
30
+
31
+ ## Reading and analyzing content
32
+
33
+ ### Text extraction
34
+ To read the text contents of a document, convert the document to markdown using pandoc. Pandoc provides excellent support for preserving document structure and can show tracked changes:
35
+
36
+ ```bash
37
+ # Convert document to markdown with tracked changes
38
+ pandoc --track-changes=all path-to-file.docx -o output.md
39
+ # Options: --track-changes=accept/reject/all
40
+ ```
41
+
42
+ ### Raw XML access
43
+ Raw XML access is required for: comments, complex formatting, document structure, embedded media, and metadata. For any of these features, unpack a document and read its raw XML contents.
44
+
45
+ #### Unpacking a file
46
+ `python ooxml/scripts/unpack.py <office_file> <output_directory>`
47
+
48
+ #### Key file structures
49
+ * `word/document.xml` - Main document contents
50
+ * `word/comments.xml` - Comments referenced in document.xml
51
+ * `word/media/` - Embedded images and media files
52
+ * Tracked changes use `<w:ins>` (insertions) and `<w:del>` (deletions) tags
53
+
54
+ ## Creating a new Word document
55
+
56
+ When creating a new Word document from scratch, use **docx-js**, which allows you to create Word documents using JavaScript/TypeScript.
57
+
58
+ ### Workflow
59
+ 1. **MANDATORY - READ ENTIRE FILE**: Read [`docx-js.md`](docx-js.md) (~500 lines) completely from start to finish. **NEVER set any range limits when reading this file.** Read the full file content for detailed syntax, critical formatting rules, and best practices before proceeding with document creation.
60
+ 2. Create a JavaScript/TypeScript file using Document, Paragraph, TextRun components (You can assume all dependencies are installed, but if not, refer to the dependencies section below)
61
+ 3. Export as .docx using Packer.toBuffer()
62
+
63
+ ## Editing an existing Word document
64
+
65
+ When editing an existing Word document, use the **Document library** (a Python library for OOXML manipulation). The library automatically handles infrastructure setup and provides methods for document manipulation. For complex scenarios, you can access the underlying DOM directly through the library.
66
+
67
+ ### Workflow
68
+ 1. **MANDATORY - READ ENTIRE FILE**: Read [`ooxml.md`](ooxml.md) (~600 lines) completely from start to finish. **NEVER set any range limits when reading this file.** Read the full file content for the Document library API and XML patterns for directly editing document files.
69
+ 2. Unpack the document: `python ooxml/scripts/unpack.py <office_file> <output_directory>`
70
+ 3. Create and run a Python script using the Document library (see "Document Library" section in ooxml.md)
71
+ 4. Pack the final document: `python ooxml/scripts/pack.py <input_directory> <office_file>`
72
+
73
+ The Document library provides both high-level methods for common operations and direct DOM access for complex scenarios.
74
+
75
+ ## Redlining workflow for document review
76
+
77
+ This workflow allows planning comprehensive tracked changes using markdown before implementing them in OOXML. **CRITICAL**: For complete tracked changes, implement ALL changes systematically.
78
+
79
+ **Batching Strategy**: Group related changes into batches of 3-10 changes. This makes debugging manageable while maintaining efficiency. Test each batch before moving to the next.
80
+
81
+ **Principle: Minimal, Precise Edits**
82
+ When implementing tracked changes, only mark text that actually changes. Repeating unchanged text makes edits harder to review and appears unprofessional. Break replacements into: [unchanged text] + [deletion] + [insertion] + [unchanged text]. Preserve the original run's RSID for unchanged text by extracting the `<w:r>` element from the original and reusing it.
83
+
84
+ Example - Changing "30 days" to "60 days" in a sentence:
85
+ ```python
86
+ # BAD - Replaces entire sentence
87
+ '<w:del><w:r><w:delText>The term is 30 days.</w:delText></w:r></w:del><w:ins><w:r><w:t>The term is 60 days.</w:t></w:r></w:ins>'
88
+
89
+ # GOOD - Only marks what changed, preserves original <w:r> for unchanged text
90
+ '<w:r w:rsidR="00AB12CD"><w:t>The term is </w:t></w:r><w:del><w:r><w:delText>30</w:delText></w:r></w:del><w:ins><w:r><w:t>60</w:t></w:r></w:ins><w:r w:rsidR="00AB12CD"><w:t> days.</w:t></w:r>'
91
+ ```
92
+
93
+ ### Tracked changes workflow
94
+
95
+ 1. **Get markdown representation**: Convert document to markdown with tracked changes preserved:
96
+ ```bash
97
+ pandoc --track-changes=all path-to-file.docx -o current.md
98
+ ```
99
+
100
+ 2. **Identify and group changes**: Review the document and identify ALL changes needed, organizing them into logical batches:
101
+
102
+ **Location methods** (for finding changes in XML):
103
+ - Section/heading numbers (e.g., "Section 3.2", "Article IV")
104
+ - Paragraph identifiers if numbered
105
+ - Grep patterns with unique surrounding text
106
+ - Document structure (e.g., "first paragraph", "signature block")
107
+ - **DO NOT use markdown line numbers** - they don't map to XML structure
108
+
109
+ **Batch organization** (group 3-10 related changes per batch):
110
+ - By section: "Batch 1: Section 2 amendments", "Batch 2: Section 5 updates"
111
+ - By type: "Batch 1: Date corrections", "Batch 2: Party name changes"
112
+ - By complexity: Start with simple text replacements, then tackle complex structural changes
113
+ - Sequential: "Batch 1: Pages 1-3", "Batch 2: Pages 4-6"
114
+
115
+ 3. **Read documentation and unpack**:
116
+ - **MANDATORY - READ ENTIRE FILE**: Read [`ooxml.md`](ooxml.md) (~600 lines) completely from start to finish. **NEVER set any range limits when reading this file.** Pay special attention to the "Document Library" and "Tracked Change Patterns" sections.
117
+ - **Unpack the document**: `python ooxml/scripts/unpack.py <file.docx> <dir>`
118
+ - **Note the suggested RSID**: The unpack script will suggest an RSID to use for your tracked changes. Copy this RSID for use in step 4b.
119
+
120
+ 4. **Implement changes in batches**: Group changes logically (by section, by type, or by proximity) and implement them together in a single script. This approach:
121
+ - Makes debugging easier (smaller batch = easier to isolate errors)
122
+ - Allows incremental progress
123
+ - Maintains efficiency (batch size of 3-10 changes works well)
124
+
125
+ **Suggested batch groupings:**
126
+ - By document section (e.g., "Section 3 changes", "Definitions", "Termination clause")
127
+ - By change type (e.g., "Date changes", "Party name updates", "Legal term replacements")
128
+ - By proximity (e.g., "Changes on pages 1-3", "Changes in first half of document")
129
+
130
+ For each batch of related changes:
131
+
132
+ **a. Map text to XML**: Grep for text in `word/document.xml` to verify how text is split across `<w:r>` elements.
133
+
134
+ **b. Create and run script**: Use `get_node` to find nodes, implement changes, then `doc.save()`. See **"Document Library"** section in ooxml.md for patterns.
135
+
136
+ **Note**: Always grep `word/document.xml` immediately before writing a script to get current line numbers and verify text content. Line numbers change after each script run.
137
+
138
+ 5. **Pack the document**: After all batches are complete, convert the unpacked directory back to .docx:
139
+ ```bash
140
+ python ooxml/scripts/pack.py unpacked reviewed-document.docx
141
+ ```
142
+
143
+ 6. **Final verification**: Do a comprehensive check of the complete document:
144
+ - Convert final document to markdown:
145
+ ```bash
146
+ pandoc --track-changes=all reviewed-document.docx -o verification.md
147
+ ```
148
+ - Verify ALL changes were applied correctly:
149
+ ```bash
150
+ grep "original phrase" verification.md # Should NOT find it
151
+ grep "replacement phrase" verification.md # Should find it
152
+ ```
153
+ - Check that no unintended changes were introduced
154
+
155
+
156
+ ## Converting Documents to Images
157
+
158
+ To visually analyze Word documents, convert them to images using a two-step process:
159
+
160
+ 1. **Convert DOCX to PDF**:
161
+ ```bash
162
+ soffice --headless --convert-to pdf document.docx
163
+ ```
164
+
165
+ 2. **Convert PDF pages to JPEG images**:
166
+ ```bash
167
+ pdftoppm -jpeg -r 150 document.pdf page
168
+ ```
169
+ This creates files like `page-1.jpg`, `page-2.jpg`, etc.
170
+
171
+ Options:
172
+ - `-r 150`: Sets resolution to 150 DPI (adjust for quality/size balance)
173
+ - `-jpeg`: Output JPEG format (use `-png` for PNG if preferred)
174
+ - `-f N`: First page to convert (e.g., `-f 2` starts from page 2)
175
+ - `-l N`: Last page to convert (e.g., `-l 5` stops at page 5)
176
+ - `page`: Prefix for output files
177
+
178
+ Example for specific range:
179
+ ```bash
180
+ pdftoppm -jpeg -r 150 -f 2 -l 5 document.pdf page # Converts only pages 2-5
181
+ ```
182
+
183
+ ## Code Style Guidelines
184
+ **IMPORTANT**: When generating code for DOCX operations:
185
+ - Write concise code
186
+ - Avoid verbose variable names and redundant operations
187
+ - Avoid unnecessary print statements
188
+
189
+ ## Dependencies
190
+
191
+ Required dependencies (install if not available):
192
+
193
+ - **pandoc**: `sudo apt-get install pandoc` (for text extraction)
194
+ - **docx**: `npm install -g docx` (for creating new documents)
195
+ - **LibreOffice**: `sudo apt-get install libreoffice` (for PDF conversion)
196
+ - **Poppler**: `sudo apt-get install poppler-utils` (for pdftoppm to convert PDF to images)
197
+ - **defusedxml**: `pip install defusedxml` (for secure XML parsing)
@@ -0,0 +1,350 @@
1
+ # DOCX Library Tutorial
2
+
3
+ Generate .docx files with JavaScript/TypeScript.
4
+
5
+ **Important: Read this entire document before starting.** Critical formatting rules and common pitfalls are covered throughout - skipping sections may result in corrupted files or rendering issues.
6
+
7
+ ## Setup
8
+ Assumes docx is already installed globally
9
+ If not installed: `npm install -g docx`
10
+
11
+ ```javascript
12
+ const { Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell, ImageRun, Media,
13
+ Header, Footer, AlignmentType, PageOrientation, LevelFormat, ExternalHyperlink,
14
+ InternalHyperlink, TableOfContents, HeadingLevel, BorderStyle, WidthType, TabStopType,
15
+ TabStopPosition, UnderlineType, ShadingType, VerticalAlign, SymbolRun, PageNumber,
16
+ FootnoteReferenceRun, Footnote, PageBreak } = require('docx');
17
+
18
+ // Create & Save
19
+ const doc = new Document({ sections: [{ children: [/* content */] }] });
20
+ Packer.toBuffer(doc).then(buffer => fs.writeFileSync("doc.docx", buffer)); // Node.js
21
+ Packer.toBlob(doc).then(blob => { /* download logic */ }); // Browser
22
+ ```
23
+
24
+ ## Text & Formatting
25
+ ```javascript
26
+ // IMPORTANT: Never use \n for line breaks - always use separate Paragraph elements
27
+ // ❌ WRONG: new TextRun("Line 1\nLine 2")
28
+ // ✅ CORRECT: new Paragraph({ children: [new TextRun("Line 1")] }), new Paragraph({ children: [new TextRun("Line 2")] })
29
+
30
+ // Basic text with all formatting options
31
+ new Paragraph({
32
+ alignment: AlignmentType.CENTER,
33
+ spacing: { before: 200, after: 200 },
34
+ indent: { left: 720, right: 720 },
35
+ children: [
36
+ new TextRun({ text: "Bold", bold: true }),
37
+ new TextRun({ text: "Italic", italics: true }),
38
+ new TextRun({ text: "Underlined", underline: { type: UnderlineType.DOUBLE, color: "FF0000" } }),
39
+ new TextRun({ text: "Colored", color: "FF0000", size: 28, font: "Arial" }), // Arial default
40
+ new TextRun({ text: "Highlighted", highlight: "yellow" }),
41
+ new TextRun({ text: "Strikethrough", strike: true }),
42
+ new TextRun({ text: "x2", superScript: true }),
43
+ new TextRun({ text: "H2O", subScript: true }),
44
+ new TextRun({ text: "SMALL CAPS", smallCaps: true }),
45
+ new SymbolRun({ char: "2022", font: "Symbol" }), // Bullet •
46
+ new SymbolRun({ char: "00A9", font: "Arial" }) // Copyright © - Arial for symbols
47
+ ]
48
+ })
49
+ ```
50
+
51
+ ## Styles & Professional Formatting
52
+
53
+ ```javascript
54
+ const doc = new Document({
55
+ styles: {
56
+ default: { document: { run: { font: "Arial", size: 24 } } }, // 12pt default
57
+ paragraphStyles: [
58
+ // Document title style - override built-in Title style
59
+ { id: "Title", name: "Title", basedOn: "Normal",
60
+ run: { size: 56, bold: true, color: "000000", font: "Arial" },
61
+ paragraph: { spacing: { before: 240, after: 120 }, alignment: AlignmentType.CENTER } },
62
+ // IMPORTANT: Override built-in heading styles by using their exact IDs
63
+ { id: "Heading1", name: "Heading 1", basedOn: "Normal", next: "Normal", quickFormat: true,
64
+ run: { size: 32, bold: true, color: "000000", font: "Arial" }, // 16pt
65
+ paragraph: { spacing: { before: 240, after: 240 }, outlineLevel: 0 } }, // Required for TOC
66
+ { id: "Heading2", name: "Heading 2", basedOn: "Normal", next: "Normal", quickFormat: true,
67
+ run: { size: 28, bold: true, color: "000000", font: "Arial" }, // 14pt
68
+ paragraph: { spacing: { before: 180, after: 180 }, outlineLevel: 1 } },
69
+ // Custom styles use your own IDs
70
+ { id: "myStyle", name: "My Style", basedOn: "Normal",
71
+ run: { size: 28, bold: true, color: "000000" },
72
+ paragraph: { spacing: { after: 120 }, alignment: AlignmentType.CENTER } }
73
+ ],
74
+ characterStyles: [{ id: "myCharStyle", name: "My Char Style",
75
+ run: { color: "FF0000", bold: true, underline: { type: UnderlineType.SINGLE } } }]
76
+ },
77
+ sections: [{
78
+ properties: { page: { margin: { top: 1440, right: 1440, bottom: 1440, left: 1440 } } },
79
+ children: [
80
+ new Paragraph({ heading: HeadingLevel.TITLE, children: [new TextRun("Document Title")] }), // Uses overridden Title style
81
+ new Paragraph({ heading: HeadingLevel.HEADING_1, children: [new TextRun("Heading 1")] }), // Uses overridden Heading1 style
82
+ new Paragraph({ style: "myStyle", children: [new TextRun("Custom paragraph style")] }),
83
+ new Paragraph({ children: [
84
+ new TextRun("Normal with "),
85
+ new TextRun({ text: "custom char style", style: "myCharStyle" })
86
+ ]})
87
+ ]
88
+ }]
89
+ });
90
+ ```
91
+
92
+ **Professional Font Combinations:**
93
+ - **Arial (Headers) + Arial (Body)** - Most universally supported, clean and professional
94
+ - **Times New Roman (Headers) + Arial (Body)** - Classic serif headers with modern sans-serif body
95
+ - **Georgia (Headers) + Verdana (Body)** - Optimized for screen reading, elegant contrast
96
+
97
+ **Key Styling Principles:**
98
+ - **Override built-in styles**: Use exact IDs like "Heading1", "Heading2", "Heading3" to override Word's built-in heading styles
99
+ - **HeadingLevel constants**: `HeadingLevel.HEADING_1` uses "Heading1" style, `HeadingLevel.HEADING_2` uses "Heading2" style, etc.
100
+ - **Include outlineLevel**: Set `outlineLevel: 0` for H1, `outlineLevel: 1` for H2, etc. to ensure TOC works correctly
101
+ - **Use custom styles** instead of inline formatting for consistency
102
+ - **Set a default font** using `styles.default.document.run.font` - Arial is universally supported
103
+ - **Establish visual hierarchy** with different font sizes (titles > headers > body)
104
+ - **Add proper spacing** with `before` and `after` paragraph spacing
105
+ - **Use colors sparingly**: Default to black (000000) and shades of gray for titles and headings (heading 1, heading 2, etc.)
106
+ - **Set consistent margins** (1440 = 1 inch is standard)
107
+
108
+
109
+ ## Lists (ALWAYS USE PROPER LISTS - NEVER USE UNICODE BULLETS)
110
+ ```javascript
111
+ // Bullets - ALWAYS use the numbering config, NOT unicode symbols
112
+ // CRITICAL: Use LevelFormat.BULLET constant, NOT the string "bullet"
113
+ const doc = new Document({
114
+ numbering: {
115
+ config: [
116
+ { reference: "bullet-list",
117
+ levels: [{ level: 0, format: LevelFormat.BULLET, text: "•", alignment: AlignmentType.LEFT,
118
+ style: { paragraph: { indent: { left: 720, hanging: 360 } } } }] },
119
+ { reference: "first-numbered-list",
120
+ levels: [{ level: 0, format: LevelFormat.DECIMAL, text: "%1.", alignment: AlignmentType.LEFT,
121
+ style: { paragraph: { indent: { left: 720, hanging: 360 } } } }] },
122
+ { reference: "second-numbered-list", // Different reference = restarts at 1
123
+ levels: [{ level: 0, format: LevelFormat.DECIMAL, text: "%1.", alignment: AlignmentType.LEFT,
124
+ style: { paragraph: { indent: { left: 720, hanging: 360 } } } }] }
125
+ ]
126
+ },
127
+ sections: [{
128
+ children: [
129
+ // Bullet list items
130
+ new Paragraph({ numbering: { reference: "bullet-list", level: 0 },
131
+ children: [new TextRun("First bullet point")] }),
132
+ new Paragraph({ numbering: { reference: "bullet-list", level: 0 },
133
+ children: [new TextRun("Second bullet point")] }),
134
+ // Numbered list items
135
+ new Paragraph({ numbering: { reference: "first-numbered-list", level: 0 },
136
+ children: [new TextRun("First numbered item")] }),
137
+ new Paragraph({ numbering: { reference: "first-numbered-list", level: 0 },
138
+ children: [new TextRun("Second numbered item")] }),
139
+ // ⚠️ CRITICAL: Different reference = INDEPENDENT list that restarts at 1
140
+ // Same reference = CONTINUES previous numbering
141
+ new Paragraph({ numbering: { reference: "second-numbered-list", level: 0 },
142
+ children: [new TextRun("Starts at 1 again (because different reference)")] })
143
+ ]
144
+ }]
145
+ });
146
+
147
+ // ⚠️ CRITICAL NUMBERING RULE: Each reference creates an INDEPENDENT numbered list
148
+ // - Same reference = continues numbering (1, 2, 3... then 4, 5, 6...)
149
+ // - Different reference = restarts at 1 (1, 2, 3... then 1, 2, 3...)
150
+ // Use unique reference names for each separate numbered section!
151
+
152
+ // ⚠️ CRITICAL: NEVER use unicode bullets - they create fake lists that don't work properly
153
+ // new TextRun("• Item") // WRONG
154
+ // new SymbolRun({ char: "2022" }) // WRONG
155
+ // ✅ ALWAYS use numbering config with LevelFormat.BULLET for real Word lists
156
+ ```
157
+
158
+ ## Tables
159
+ ```javascript
160
+ // Complete table with margins, borders, headers, and bullet points
161
+ const tableBorder = { style: BorderStyle.SINGLE, size: 1, color: "CCCCCC" };
162
+ const cellBorders = { top: tableBorder, bottom: tableBorder, left: tableBorder, right: tableBorder };
163
+
164
+ new Table({
165
+ columnWidths: [4680, 4680], // ⚠️ CRITICAL: Set column widths at table level - values in DXA (twentieths of a point)
166
+ margins: { top: 100, bottom: 100, left: 180, right: 180 }, // Set once for all cells
167
+ rows: [
168
+ new TableRow({
169
+ tableHeader: true,
170
+ children: [
171
+ new TableCell({
172
+ borders: cellBorders,
173
+ width: { size: 4680, type: WidthType.DXA }, // ALSO set width on each cell
174
+ // ⚠️ CRITICAL: Always use ShadingType.CLEAR to prevent black backgrounds in Word.
175
+ shading: { fill: "D5E8F0", type: ShadingType.CLEAR },
176
+ verticalAlign: VerticalAlign.CENTER,
177
+ children: [new Paragraph({
178
+ alignment: AlignmentType.CENTER,
179
+ children: [new TextRun({ text: "Header", bold: true, size: 22 })]
180
+ })]
181
+ }),
182
+ new TableCell({
183
+ borders: cellBorders,
184
+ width: { size: 4680, type: WidthType.DXA }, // ALSO set width on each cell
185
+ shading: { fill: "D5E8F0", type: ShadingType.CLEAR },
186
+ children: [new Paragraph({
187
+ alignment: AlignmentType.CENTER,
188
+ children: [new TextRun({ text: "Bullet Points", bold: true, size: 22 })]
189
+ })]
190
+ })
191
+ ]
192
+ }),
193
+ new TableRow({
194
+ children: [
195
+ new TableCell({
196
+ borders: cellBorders,
197
+ width: { size: 4680, type: WidthType.DXA }, // ALSO set width on each cell
198
+ children: [new Paragraph({ children: [new TextRun("Regular data")] })]
199
+ }),
200
+ new TableCell({
201
+ borders: cellBorders,
202
+ width: { size: 4680, type: WidthType.DXA }, // ALSO set width on each cell
203
+ children: [
204
+ new Paragraph({
205
+ numbering: { reference: "bullet-list", level: 0 },
206
+ children: [new TextRun("First bullet point")]
207
+ }),
208
+ new Paragraph({
209
+ numbering: { reference: "bullet-list", level: 0 },
210
+ children: [new TextRun("Second bullet point")]
211
+ })
212
+ ]
213
+ })
214
+ ]
215
+ })
216
+ ]
217
+ })
218
+ ```
219
+
220
+ **IMPORTANT: Table Width & Borders**
221
+ - Use BOTH `columnWidths: [width1, width2, ...]` array AND `width: { size: X, type: WidthType.DXA }` on each cell
222
+ - Values in DXA (twentieths of a point): 1440 = 1 inch, Letter usable width = 9360 DXA (with 1" margins)
223
+ - Apply borders to individual `TableCell` elements, NOT the `Table` itself
224
+
225
+ **Precomputed Column Widths (Letter size with 1" margins = 9360 DXA total):**
226
+ - **2 columns:** `columnWidths: [4680, 4680]` (equal width)
227
+ - **3 columns:** `columnWidths: [3120, 3120, 3120]` (equal width)
228
+
229
+ ## Links & Navigation
230
+ ```javascript
231
+ // TOC (requires headings) - CRITICAL: Use HeadingLevel only, NOT custom styles
232
+ // ❌ WRONG: new Paragraph({ heading: HeadingLevel.HEADING_1, style: "customHeader", children: [new TextRun("Title")] })
233
+ // ✅ CORRECT: new Paragraph({ heading: HeadingLevel.HEADING_1, children: [new TextRun("Title")] })
234
+ new TableOfContents("Table of Contents", { hyperlink: true, headingStyleRange: "1-3" }),
235
+
236
+ // External link
237
+ new Paragraph({
238
+ children: [new ExternalHyperlink({
239
+ children: [new TextRun({ text: "Google", style: "Hyperlink" })],
240
+ link: "https://www.google.com"
241
+ })]
242
+ }),
243
+
244
+ // Internal link & bookmark
245
+ new Paragraph({
246
+ children: [new InternalHyperlink({
247
+ children: [new TextRun({ text: "Go to Section", style: "Hyperlink" })],
248
+ anchor: "section1"
249
+ })]
250
+ }),
251
+ new Paragraph({
252
+ children: [new TextRun("Section Content")],
253
+ bookmark: { id: "section1", name: "section1" }
254
+ }),
255
+ ```
256
+
257
+ ## Images & Media
258
+ ```javascript
259
+ // Basic image with sizing & positioning
260
+ // CRITICAL: Always specify 'type' parameter - it's REQUIRED for ImageRun
261
+ new Paragraph({
262
+ alignment: AlignmentType.CENTER,
263
+ children: [new ImageRun({
264
+ type: "png", // NEW REQUIREMENT: Must specify image type (png, jpg, jpeg, gif, bmp, svg)
265
+ data: fs.readFileSync("image.png"),
266
+ transformation: { width: 200, height: 150, rotation: 0 }, // rotation in degrees
267
+ altText: { title: "Logo", description: "Company logo", name: "Name" } // IMPORTANT: All three fields are required
268
+ })]
269
+ })
270
+ ```
271
+
272
+ ## Page Breaks
273
+ ```javascript
274
+ // Manual page break
275
+ new Paragraph({ children: [new PageBreak()] }),
276
+
277
+ // Page break before paragraph
278
+ new Paragraph({
279
+ pageBreakBefore: true,
280
+ children: [new TextRun("This starts on a new page")]
281
+ })
282
+
283
+ // ⚠️ CRITICAL: NEVER use PageBreak standalone - it will create invalid XML that Word cannot open
284
+ // ❌ WRONG: new PageBreak()
285
+ // ✅ CORRECT: new Paragraph({ children: [new PageBreak()] })
286
+ ```
287
+
288
+ ## Headers/Footers & Page Setup
289
+ ```javascript
290
+ const doc = new Document({
291
+ sections: [{
292
+ properties: {
293
+ page: {
294
+ margin: { top: 1440, right: 1440, bottom: 1440, left: 1440 }, // 1440 = 1 inch
295
+ size: { orientation: PageOrientation.LANDSCAPE },
296
+ pageNumbers: { start: 1, formatType: "decimal" } // "upperRoman", "lowerRoman", "upperLetter", "lowerLetter"
297
+ }
298
+ },
299
+ headers: {
300
+ default: new Header({ children: [new Paragraph({
301
+ alignment: AlignmentType.RIGHT,
302
+ children: [new TextRun("Header Text")]
303
+ })] })
304
+ },
305
+ footers: {
306
+ default: new Footer({ children: [new Paragraph({
307
+ alignment: AlignmentType.CENTER,
308
+ children: [new TextRun("Page "), new TextRun({ children: [PageNumber.CURRENT] }), new TextRun(" of "), new TextRun({ children: [PageNumber.TOTAL_PAGES] })]
309
+ })] })
310
+ },
311
+ children: [/* content */]
312
+ }]
313
+ });
314
+ ```
315
+
316
+ ## Tabs
317
+ ```javascript
318
+ new Paragraph({
319
+ tabStops: [
320
+ { type: TabStopType.LEFT, position: TabStopPosition.MAX / 4 },
321
+ { type: TabStopType.CENTER, position: TabStopPosition.MAX / 2 },
322
+ { type: TabStopType.RIGHT, position: TabStopPosition.MAX * 3 / 4 }
323
+ ],
324
+ children: [new TextRun("Left\tCenter\tRight")]
325
+ })
326
+ ```
327
+
328
+ ## Constants & Quick Reference
329
+ - **Underlines:** `SINGLE`, `DOUBLE`, `WAVY`, `DASH`
330
+ - **Borders:** `SINGLE`, `DOUBLE`, `DASHED`, `DOTTED`
331
+ - **Numbering:** `DECIMAL` (1,2,3), `UPPER_ROMAN` (I,II,III), `LOWER_LETTER` (a,b,c)
332
+ - **Tabs:** `LEFT`, `CENTER`, `RIGHT`, `DECIMAL`
333
+ - **Symbols:** `"2022"` (•), `"00A9"` (©), `"00AE"` (®), `"2122"` (™), `"00B0"` (°), `"F070"` (✓), `"F0FC"` (✗)
334
+
335
+ ## Critical Issues & Common Mistakes
336
+ - **CRITICAL: PageBreak must ALWAYS be inside a Paragraph** - standalone PageBreak creates invalid XML that Word cannot open
337
+ - **ALWAYS use ShadingType.CLEAR for table cell shading** - Never use ShadingType.SOLID (causes black background).
338
+ - Measurements in DXA (1440 = 1 inch) | Each table cell needs ≥1 Paragraph | TOC requires HeadingLevel styles only
339
+ - **ALWAYS use custom styles** with Arial font for professional appearance and proper visual hierarchy
340
+ - **ALWAYS set a default font** using `styles.default.document.run.font` - Arial recommended
341
+ - **ALWAYS use columnWidths array for tables** + individual cell widths for compatibility
342
+ - **NEVER use unicode symbols for bullets** - always use proper numbering configuration with `LevelFormat.BULLET` constant (NOT the string "bullet")
343
+ - **NEVER use \n for line breaks anywhere** - always use separate Paragraph elements for each line
344
+ - **ALWAYS use TextRun objects within Paragraph children** - never use text property directly on Paragraph
345
+ - **CRITICAL for images**: ImageRun REQUIRES `type` parameter - always specify "png", "jpg", "jpeg", "gif", "bmp", or "svg"
346
+ - **CRITICAL for bullets**: Must use `LevelFormat.BULLET` constant, not string "bullet", and include `text: "•"` for the bullet character
347
+ - **CRITICAL for numbering**: Each numbering reference creates an INDEPENDENT list. Same reference = continues numbering (1,2,3 then 4,5,6). Different reference = restarts at 1 (1,2,3 then 1,2,3). Use unique reference names for each separate numbered section!
348
+ - **CRITICAL for TOC**: When using TableOfContents, headings must use HeadingLevel ONLY - do NOT add custom styles to heading paragraphs or TOC will break
349
+ - **Tables**: Set `columnWidths` array + individual cell widths, apply borders to cells not table
350
+ - **Set table margins at TABLE level** for consistent cell padding (avoids repetition per cell)