@nguyenphp/antigravity-marketing 1.0.18 → 1.0.19

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 (127) hide show
  1. package/README.md +186 -78
  2. package/package.json +4 -3
  3. package/templates/.agent/skills/marketing-report-expert/SKILL.md +70 -0
  4. package/templates/.agent/skills/minimax-docx/LICENSE +21 -0
  5. package/templates/.agent/skills/minimax-docx/SKILL.md +274 -0
  6. package/templates/.agent/skills/minimax-docx/assets/styles/academic_styles.xml +250 -0
  7. package/templates/.agent/skills/minimax-docx/assets/styles/corporate_styles.xml +284 -0
  8. package/templates/.agent/skills/minimax-docx/assets/styles/default_styles.xml +449 -0
  9. package/templates/.agent/skills/minimax-docx/assets/xsd/aesthetic-rules.xsd +470 -0
  10. package/templates/.agent/skills/minimax-docx/assets/xsd/business-rules.xsd +130 -0
  11. package/templates/.agent/skills/minimax-docx/assets/xsd/common-types.xsd +159 -0
  12. package/templates/.agent/skills/minimax-docx/assets/xsd/wml-subset.xsd +589 -0
  13. package/templates/.agent/skills/minimax-docx/references/cjk_typography.md +357 -0
  14. package/templates/.agent/skills/minimax-docx/references/cjk_university_template_guide.md +184 -0
  15. package/templates/.agent/skills/minimax-docx/references/comments_guide.md +191 -0
  16. package/templates/.agent/skills/minimax-docx/references/design_good_bad_examples.md +829 -0
  17. package/templates/.agent/skills/minimax-docx/references/design_principles.md +819 -0
  18. package/templates/.agent/skills/minimax-docx/references/openxml_element_order.md +308 -0
  19. package/templates/.agent/skills/minimax-docx/references/openxml_encyclopedia_part1.md +4061 -0
  20. package/templates/.agent/skills/minimax-docx/references/openxml_encyclopedia_part2.md +2820 -0
  21. package/templates/.agent/skills/minimax-docx/references/openxml_encyclopedia_part3.md +3381 -0
  22. package/templates/.agent/skills/minimax-docx/references/openxml_namespaces.md +82 -0
  23. package/templates/.agent/skills/minimax-docx/references/openxml_units.md +72 -0
  24. package/templates/.agent/skills/minimax-docx/references/scenario_a_create.md +284 -0
  25. package/templates/.agent/skills/minimax-docx/references/scenario_b_edit_content.md +295 -0
  26. package/templates/.agent/skills/minimax-docx/references/scenario_c_apply_template.md +456 -0
  27. package/templates/.agent/skills/minimax-docx/references/track_changes_guide.md +200 -0
  28. package/templates/.agent/skills/minimax-docx/references/troubleshooting.md +506 -0
  29. package/templates/.agent/skills/minimax-docx/references/typography_guide.md +294 -0
  30. package/templates/.agent/skills/minimax-docx/references/xsd_validation_guide.md +158 -0
  31. package/templates/.agent/skills/minimax-docx/scripts/doc_to_docx.sh +40 -0
  32. package/templates/.agent/skills/minimax-docx/scripts/docx_preview.sh +37 -0
  33. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Cli/MiniMaxAIDocx.Cli.csproj +19 -0
  34. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Cli/Program.cs +18 -0
  35. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/AnalyzeCommand.cs +147 -0
  36. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/ApplyTemplateCommand.cs +322 -0
  37. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/CreateCommand.cs +324 -0
  38. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/DiffCommand.cs +155 -0
  39. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/EditContentCommand.cs +487 -0
  40. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/FixOrderCommand.cs +108 -0
  41. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/MergeRunsCommand.cs +122 -0
  42. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Commands/ValidateCommand.cs +107 -0
  43. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/MiniMaxAIDocx.Core.csproj +15 -0
  44. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/CommentSynchronizer.cs +169 -0
  45. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/ElementOrder.cs +80 -0
  46. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/NamespaceConstants.cs +42 -0
  47. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/RunMerger.cs +81 -0
  48. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/StyleAnalyzer.cs +81 -0
  49. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/TrackChangesHelper.cs +99 -0
  50. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/UnitConverter.cs +23 -0
  51. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples.cs +1832 -0
  52. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch1.cs +910 -0
  53. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch2.cs +999 -0
  54. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch3.cs +1048 -0
  55. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch4.cs +1038 -0
  56. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/CharacterFormattingSamples.cs +1020 -0
  57. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/DocumentCreationSamples.cs +1121 -0
  58. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/FieldAndTocSamples.cs +624 -0
  59. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/FootnoteAndCommentSamples.cs +675 -0
  60. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/HeaderFooterSamples.cs +838 -0
  61. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/ImageSamples.cs +917 -0
  62. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/ListAndNumberingSamples.cs +826 -0
  63. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/ParagraphFormattingSamples.cs +1199 -0
  64. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/StyleSystemSamples.cs +1487 -0
  65. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/TableSamples.cs +1163 -0
  66. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Samples/TrackChangesSamples.cs +595 -0
  67. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Typography/CjkHelper.cs +39 -0
  68. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Typography/FontDefaults.cs +24 -0
  69. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Typography/PageSizes.cs +20 -0
  70. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Validation/BusinessRuleValidator.cs +224 -0
  71. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Validation/GateCheckValidator.cs +148 -0
  72. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Validation/ValidationResult.cs +23 -0
  73. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.Core/Validation/XsdValidator.cs +69 -0
  74. package/templates/.agent/skills/minimax-docx/scripts/dotnet/MiniMaxAIDocx.slnx +4 -0
  75. package/templates/.agent/skills/minimax-docx/scripts/env_check.sh +196 -0
  76. package/templates/.agent/skills/minimax-docx/scripts/setup.ps1 +274 -0
  77. package/templates/.agent/skills/minimax-docx/scripts/setup.sh +504 -0
  78. package/templates/.agent/skills/minimax-multimodal-toolkit/SKILL.md +359 -0
  79. package/templates/.agent/skills/minimax-pdf/README.md +222 -0
  80. package/templates/.agent/skills/minimax-pdf/SKILL.md +201 -0
  81. package/templates/.agent/skills/minimax-pdf/design/design.md +381 -0
  82. package/templates/.agent/skills/minimax-pdf/scripts/cover.py +1579 -0
  83. package/templates/.agent/skills/minimax-pdf/scripts/fill_inspect.py +200 -0
  84. package/templates/.agent/skills/minimax-pdf/scripts/fill_write.py +242 -0
  85. package/templates/.agent/skills/minimax-pdf/scripts/make.sh +491 -0
  86. package/templates/.agent/skills/minimax-pdf/scripts/merge.py +112 -0
  87. package/templates/.agent/skills/minimax-pdf/scripts/palette.py +559 -0
  88. package/templates/.agent/skills/minimax-pdf/scripts/reformat_parse.py +374 -0
  89. package/templates/.agent/skills/minimax-pdf/scripts/render_body.py +1055 -0
  90. package/templates/.agent/skills/minimax-pdf/scripts/render_cover.cjs +111 -0
  91. package/templates/.agent/skills/minimax-xlsx/SKILL.md +138 -0
  92. package/templates/.agent/skills/minimax-xlsx/references/create.md +691 -0
  93. package/templates/.agent/skills/minimax-xlsx/references/edit.md +684 -0
  94. package/templates/.agent/skills/minimax-xlsx/references/fix.md +37 -0
  95. package/templates/.agent/skills/minimax-xlsx/references/format.md +768 -0
  96. package/templates/.agent/skills/minimax-xlsx/references/ooxml-cheatsheet.md +231 -0
  97. package/templates/.agent/skills/minimax-xlsx/references/read-analyze.md +97 -0
  98. package/templates/.agent/skills/minimax-xlsx/references/validate.md +772 -0
  99. package/templates/.agent/skills/minimax-xlsx/scripts/formula_check.py +422 -0
  100. package/templates/.agent/skills/minimax-xlsx/scripts/libreoffice_recalc.py +248 -0
  101. package/templates/.agent/skills/minimax-xlsx/scripts/shared_strings_builder.py +163 -0
  102. package/templates/.agent/skills/minimax-xlsx/scripts/style_audit.py +575 -0
  103. package/templates/.agent/skills/minimax-xlsx/scripts/xlsx_add_column.py +395 -0
  104. package/templates/.agent/skills/minimax-xlsx/scripts/xlsx_insert_row.py +274 -0
  105. package/templates/.agent/skills/minimax-xlsx/scripts/xlsx_pack.py +87 -0
  106. package/templates/.agent/skills/minimax-xlsx/scripts/xlsx_reader.py +362 -0
  107. package/templates/.agent/skills/minimax-xlsx/scripts/xlsx_shift_rows.py +396 -0
  108. package/templates/.agent/skills/minimax-xlsx/scripts/xlsx_unpack.py +130 -0
  109. package/templates/.agent/skills/minimax-xlsx/templates/minimal_xlsx/[Content_Types].xml +9 -0
  110. package/templates/.agent/skills/minimax-xlsx/templates/minimal_xlsx/_rels/.rels +6 -0
  111. package/templates/.agent/skills/minimax-xlsx/templates/minimal_xlsx/xl/_rels/workbook.xml.rels +19 -0
  112. package/templates/.agent/skills/minimax-xlsx/templates/minimal_xlsx/xl/sharedStrings.xml +33 -0
  113. package/templates/.agent/skills/minimax-xlsx/templates/minimal_xlsx/xl/styles.xml +160 -0
  114. package/templates/.agent/skills/minimax-xlsx/templates/minimal_xlsx/xl/workbook.xml +30 -0
  115. package/templates/.agent/skills/minimax-xlsx/templates/minimal_xlsx/xl/worksheets/sheet1.xml +70 -0
  116. package/templates/.agent/skills/pptx-generator/SKILL.md +249 -0
  117. package/templates/.agent/skills/pptx-generator/references/design-system.md +392 -0
  118. package/templates/.agent/skills/pptx-generator/references/editing.md +162 -0
  119. package/templates/.agent/skills/pptx-generator/references/pitfalls.md +112 -0
  120. package/templates/.agent/skills/pptx-generator/references/pptxgenjs.md +420 -0
  121. package/templates/.agent/skills/pptx-generator/references/slide-types.md +413 -0
  122. package/templates/.agent/skills/tutorial-video-expert/SKILL.md +88 -0
  123. package/templates/.agent/skills/ui-ux-pro-max/SKILL.md +170 -585
  124. package/templates/.agent/skills/vision-analysis/SKILL.md +174 -0
  125. package/templates/.agent/workflows/analyze.md +3 -0
  126. package/templates/.agent/workflows/brand-report.md +44 -0
  127. package/templates/.agent/workflows/report.md +49 -0
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * render_cover.js — Render cover.html → cover.pdf via Playwright.
4
+ *
5
+ * Usage:
6
+ * node render_cover.js --input cover.html --out cover.pdf
7
+ * node render_cover.js --input cover.html --out cover.pdf --wait 1200
8
+ *
9
+ * Exit codes: 0 success, 1 bad args, 2 dependency missing, 3 render error
10
+ */
11
+
12
+ const path = require("path");
13
+ const fs = require("fs");
14
+
15
+ function usage() {
16
+ console.error("Usage: node render_cover.js --input <file.html> --out <file.pdf> [--wait <ms>]");
17
+ process.exit(1);
18
+ }
19
+
20
+ // ── Arg parsing ────────────────────────────────────────────────────────────────
21
+ const args = process.argv.slice(2);
22
+ let inputFile = null, outFile = null, waitMs = 800;
23
+
24
+ for (let i = 0; i < args.length; i++) {
25
+ if (args[i] === "--input" && args[i + 1]) { inputFile = args[++i]; }
26
+ else if (args[i] === "--out" && args[i + 1]) { outFile = args[++i]; }
27
+ else if (args[i] === "--wait" && args[i + 1]) { waitMs = parseInt(args[++i], 10); }
28
+ }
29
+
30
+ if (!inputFile || !outFile) usage();
31
+ if (!fs.existsSync(inputFile)) {
32
+ console.error(JSON.stringify({ status: "error", error: `File not found: ${inputFile}` }));
33
+ process.exit(1);
34
+ }
35
+
36
+ // ── Playwright loader (tolerates global npm installs) ─────────────────────────
37
+ function loadPlaywright() {
38
+ const { execSync } = require("child_process");
39
+ try { return require("playwright"); } catch (_) {}
40
+ try {
41
+ const root = execSync("npm root -g", { stdio: ["ignore","pipe","ignore"] }).toString().trim();
42
+ return require(path.join(root, "playwright"));
43
+ } catch (_) {}
44
+ console.error(JSON.stringify({
45
+ status: "error",
46
+ error: "playwright not found",
47
+ hint: "Run: npm install -g playwright && npx playwright install chromium"
48
+ }));
49
+ process.exit(2);
50
+ }
51
+
52
+ // ── Main ───────────────────────────────────────────────────────────────────────
53
+ (async () => {
54
+ const { chromium } = loadPlaywright();
55
+
56
+ let browser;
57
+ try {
58
+ browser = await chromium.launch();
59
+ } catch (e) {
60
+ // Chromium binary missing — try installing
61
+ const { spawnSync } = require("child_process");
62
+ const r = spawnSync("npx", ["playwright", "install", "chromium"], { stdio: "inherit", shell: true });
63
+ if (r.status !== 0) {
64
+ console.error(JSON.stringify({
65
+ status: "error",
66
+ error: "Chromium not installed and auto-install failed",
67
+ hint: "Run: npx playwright install chromium"
68
+ }));
69
+ process.exit(2);
70
+ }
71
+ browser = await chromium.launch();
72
+ }
73
+
74
+ try {
75
+ const page = await browser.newPage();
76
+ const fileUrl = "file://" + path.resolve(inputFile);
77
+ await page.goto(fileUrl);
78
+ await page.waitForTimeout(waitMs); // let CSS + any JS settle
79
+
80
+ await page.pdf({
81
+ path: outFile,
82
+ width: "794px",
83
+ height: "1123px",
84
+ printBackground: true,
85
+ });
86
+
87
+ await browser.close();
88
+
89
+ // Basic sanity: output file must exist and be > 5 KB
90
+ const stat = fs.statSync(outFile);
91
+ if (stat.size < 5000) {
92
+ console.error(JSON.stringify({
93
+ status: "error",
94
+ error: "Output PDF is suspiciously small — cover may be blank",
95
+ hint: "Check cover.html for render errors"
96
+ }));
97
+ process.exit(3);
98
+ }
99
+
100
+ console.log(JSON.stringify({
101
+ status: "ok",
102
+ out: outFile,
103
+ size_kb: Math.round(stat.size / 1024),
104
+ }));
105
+
106
+ } catch (e) {
107
+ if (browser) await browser.close().catch(() => {});
108
+ console.error(JSON.stringify({ status: "error", error: String(e) }));
109
+ process.exit(3);
110
+ }
111
+ })();
@@ -0,0 +1,138 @@
1
+ ---
2
+ name: minimax-xlsx
3
+ description: "Open, create, read, analyze, edit, or validate Excel/spreadsheet files (.xlsx, .xlsm, .csv, .tsv). Use when the user asks to create, build, modify, analyze, read, validate, or format any Excel spreadsheet, financial model, pivot table, or tabular data file. Covers: creating new xlsx from scratch, reading and analyzing existing files, editing existing xlsx with zero format loss, formula recalculation and validation, and applying professional financial formatting standards. Triggers on 'spreadsheet', 'Excel', '.xlsx', '.csv', 'pivot table', 'financial model', 'formula', or any request to produce tabular data in Excel format."
4
+ license: MIT
5
+ metadata:
6
+ version: "1.0"
7
+ category: productivity
8
+ sources:
9
+ - ECMA-376 Office Open XML File Formats
10
+ - Microsoft Open XML SDK documentation
11
+ ---
12
+
13
+ # MiniMax XLSX Skill
14
+
15
+ Handle the request directly. Do NOT spawn sub-agents. Always write the output file the user requests.
16
+
17
+ ## Task Routing
18
+
19
+ | Task | Method | Guide |
20
+ |------|--------|-------|
21
+ | **READ** — analyze existing data | `xlsx_reader.py` + pandas | `references/read-analyze.md` |
22
+ | **CREATE** — new xlsx from scratch | XML template | `references/create.md` + `references/format.md` |
23
+ | **EDIT** — modify existing xlsx | XML unpack→edit→pack | `references/edit.md` (+ `format.md` if styling needed) |
24
+ | **FIX** — repair broken formulas in existing xlsx | XML unpack→fix `<f>` nodes→pack | `references/fix.md` |
25
+ | **VALIDATE** — check formulas | `formula_check.py` | `references/validate.md` |
26
+
27
+ ## READ — Analyze data (read `references/read-analyze.md` first)
28
+
29
+ Start with `xlsx_reader.py` for structure discovery, then pandas for custom analysis. Never modify the source file.
30
+
31
+ **Formatting rule**: When the user specifies decimal places (e.g. "2 decimal places"), apply that format to ALL numeric values — use `f'{v:.2f}'` on every number. Never output `12875` when `12875.00` is required.
32
+
33
+ **Aggregation rule**: Always compute sums/means/counts directly from the DataFrame column — e.g. `df['Revenue'].sum()`. Never re-derive column values before aggregation.
34
+
35
+ ## CREATE — XML template (read `references/create.md` + `references/format.md`)
36
+
37
+ Copy `templates/minimal_xlsx/` → edit XML directly → pack with `xlsx_pack.py`. Every derived value MUST be an Excel formula (`<f>SUM(B2:B9)</f>`), never a hardcoded number. Apply font colors per `format.md`.
38
+
39
+ ## EDIT — XML direct-edit (read `references/edit.md` first)
40
+
41
+ **CRITICAL — EDIT INTEGRITY RULES:**
42
+ 1. **NEVER create a new `Workbook()`** for edit tasks. Always load the original file.
43
+ 2. The output MUST contain the **same sheets** as the input (same names, same data).
44
+ 3. Only modify the specific cells the task asks for — everything else must be untouched.
45
+ 4. **After saving output.xlsx, verify it**: open with `xlsx_reader.py` or `pandas` and confirm the original sheet names and a sample of original data are present. If verification fails, you wrote the wrong file — fix it before delivering.
46
+
47
+ Never use openpyxl round-trip on existing files (corrupts VBA, pivots, sparklines). Instead: unpack → use helper scripts → repack.
48
+
49
+ **"Fill cells" / "Add formulas to existing cells" = EDIT task.** If the input file already exists and you are told to fill, update, or add formulas to specific cells, you MUST use the XML edit path. Never create a new `Workbook()`. Example — fill B3 with a cross-sheet SUM formula:
50
+ ```bash
51
+ python3 SKILL_DIR/scripts/xlsx_unpack.py input.xlsx /tmp/xlsx_work/
52
+ # Find the target sheet's XML via xl/workbook.xml → xl/_rels/workbook.xml.rels
53
+ # Then use the Edit tool to add <f> inside the target <c> element:
54
+ # <c r="B3"><f>SUM('Sales Data'!D2:D13)</f><v></v></c>
55
+ python3 SKILL_DIR/scripts/xlsx_pack.py /tmp/xlsx_work/ output.xlsx
56
+ ```
57
+
58
+ **Add a column** (formulas, numfmt, styles auto-copied from adjacent column):
59
+ ```bash
60
+ python3 SKILL_DIR/scripts/xlsx_unpack.py input.xlsx /tmp/xlsx_work/
61
+ python3 SKILL_DIR/scripts/xlsx_add_column.py /tmp/xlsx_work/ --col G \
62
+ --sheet "Sheet1" --header "% of Total" \
63
+ --formula '=F{row}/$F$10' --formula-rows 2:9 \
64
+ --total-row 10 --total-formula '=SUM(G2:G9)' --numfmt '0.0%' \
65
+ --border-row 10 --border-style medium
66
+ python3 SKILL_DIR/scripts/xlsx_pack.py /tmp/xlsx_work/ output.xlsx
67
+ ```
68
+ The `--border-row` flag applies a top border to ALL cells in that row (not just the new column). Use it when the task requires accounting-style borders on total rows.
69
+
70
+ **Insert a row** (shifts existing rows, updates SUM formulas, fixes circular refs):
71
+ ```bash
72
+ python3 SKILL_DIR/scripts/xlsx_unpack.py input.xlsx /tmp/xlsx_work/
73
+ # IMPORTANT: Find the correct --at row by searching for the label text
74
+ # in the worksheet XML, NOT by using the row number from the prompt.
75
+ # The prompt may say "row 5 (Office Rent)" but Office Rent might actually
76
+ # be at row 4. Always locate the row by its text label first.
77
+ python3 SKILL_DIR/scripts/xlsx_insert_row.py /tmp/xlsx_work/ --at 5 \
78
+ --sheet "Budget FY2025" --text A=Utilities \
79
+ --values B=3000 C=3000 D=3500 E=3500 \
80
+ --formula 'F=SUM(B{row}:E{row})' --copy-style-from 4
81
+ python3 SKILL_DIR/scripts/xlsx_pack.py /tmp/xlsx_work/ output.xlsx
82
+ ```
83
+ **Row lookup rule**: When the task says "after row N (Label)", always find the row by searching for "Label" in the worksheet XML (`grep -n "Label" /tmp/xlsx_work/xl/worksheets/sheet*.xml` or check sharedStrings.xml). Use the actual row number + 1 for `--at`. Do NOT call `xlsx_shift_rows.py` separately — `xlsx_insert_row.py` calls it internally.
84
+
85
+ **Apply row-wide borders** (e.g. accounting line on a TOTAL row):
86
+ After running helper scripts, apply borders to ALL cells in the target row, not just newly added cells. In `xl/styles.xml`, append a new `<border>` with the desired style, then append a new `<xf>` in `<cellXfs>` that clones each cell's existing `<xf>` but sets the new `borderId`. Apply the new style index to every `<c>` in the row via the `s` attribute:
87
+ ```xml
88
+ <!-- In xl/styles.xml, append to <borders>: -->
89
+ <border>
90
+ <left/><right/><top style="medium"/><bottom/><diagonal/>
91
+ </border>
92
+ <!-- Then append to <cellXfs> an xf clone with the new borderId for each existing style -->
93
+ ```
94
+ **Key rule**: When a task says "add a border to row N", iterate over ALL cells A through the last column, not just newly added cells.
95
+
96
+ **Manual XML edit** (for anything the helper scripts don't cover):
97
+ ```bash
98
+ python3 SKILL_DIR/scripts/xlsx_unpack.py input.xlsx /tmp/xlsx_work/
99
+ # ... edit XML with the Edit tool ...
100
+ python3 SKILL_DIR/scripts/xlsx_pack.py /tmp/xlsx_work/ output.xlsx
101
+ ```
102
+
103
+ ## FIX — Repair broken formulas (read `references/fix.md` first)
104
+
105
+ This is an EDIT task. Unpack → fix broken `<f>` nodes → pack. Preserve all original sheets and data.
106
+
107
+ ## VALIDATE — Check formulas (read `references/validate.md` first)
108
+
109
+ Run `formula_check.py` for static validation. Use `libreoffice_recalc.py` for dynamic recalculation when available.
110
+
111
+ ## Financial Color Standard
112
+
113
+ | Cell Role | Font Color | Hex Code |
114
+ |-----------|-----------|----------|
115
+ | Hard-coded input / assumption | Blue | `0000FF` |
116
+ | Formula / computed result | Black | `000000` |
117
+ | Cross-sheet reference formula | Green | `00B050` |
118
+
119
+ ## Key Rules
120
+
121
+ 1. **Formula-First**: Every calculated cell MUST use an Excel formula, not a hardcoded number
122
+ 2. **CREATE → XML template**: Copy minimal template, edit XML directly, pack with `xlsx_pack.py`
123
+ 3. **EDIT → XML**: Never openpyxl round-trip. Use unpack/edit/pack scripts
124
+ 4. **Always produce the output file** — this is the #1 priority
125
+ 5. **Validate before delivery**: `formula_check.py` exit code 0 = safe
126
+
127
+ ## Utility Scripts
128
+
129
+ ```bash
130
+ python3 SKILL_DIR/scripts/xlsx_reader.py input.xlsx # structure discovery
131
+ python3 SKILL_DIR/scripts/formula_check.py file.xlsx --json # formula validation
132
+ python3 SKILL_DIR/scripts/formula_check.py file.xlsx --report # standardized report
133
+ python3 SKILL_DIR/scripts/xlsx_unpack.py in.xlsx /tmp/work/ # unpack for XML editing
134
+ python3 SKILL_DIR/scripts/xlsx_pack.py /tmp/work/ out.xlsx # repack after editing
135
+ python3 SKILL_DIR/scripts/xlsx_shift_rows.py /tmp/work/ insert 5 1 # shift rows for insertion
136
+ python3 SKILL_DIR/scripts/xlsx_add_column.py /tmp/work/ --col G ... # add column with formulas
137
+ python3 SKILL_DIR/scripts/xlsx_insert_row.py /tmp/work/ --at 6 ... # insert row with data
138
+ ```