dsh-office-kit 0.4.2 → 0.4.4
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/assets/skills/excel-live-control/SKILL.md +119 -152
- package/assets/skills/excel-live-control/domain_guidance/financial_models.md +42 -58
- package/assets/skills/excel-live-control/domain_guidance/healthcare.md +36 -42
- package/assets/skills/excel-live-control/domain_guidance/marketing_advertising.md +33 -34
- package/assets/skills/excel-live-control/domain_guidance/scientific_research.md +34 -36
- package/assets/skills/excel-live-control/references/office-automation.md +127 -153
- package/assets/skills/excel-live-control/references/read_only_qna.md +40 -45
- package/assets/skills/excel-live-control/style_guidelines.md +56 -64
- package/assets/skills/excel-live-control/workflows/create_workflows.md +40 -47
- package/assets/skills/excel-live-control/workflows/edit_workflows.md +37 -45
- package/assets/skills/office-documents/SKILL.md +24 -60
- package/assets/skills/office-documents/examples/end_to_end_smoke_test.md +5 -5
- package/assets/skills/office-documents/ooxml/comments.md +8 -8
- package/assets/skills/office-documents/ooxml/hyperlinks_and_fields.md +10 -10
- package/assets/skills/office-documents/ooxml/rels_and_content_types.md +7 -7
- package/assets/skills/office-documents/ooxml/tracked_changes.md +12 -12
- package/assets/skills/office-documents/references/docx-structure.md +11 -13
- package/assets/skills/office-documents/references/template-elicitation.md +11 -13
- package/assets/skills/office-documents/references/writing-quality.md +20 -20
- package/assets/skills/office-documents/scripts/add_tracked_replacements.py +4 -3
- package/assets/skills/office-documents/scripts/docx_kit.py +68 -27
- package/assets/skills/office-documents/scripts/heading_audit.py +3 -4
- package/assets/skills/office-documents/scripts/internal_nav.py +3 -1
- package/assets/skills/office-documents/scripts/merge_docx_append.py +104 -0
- package/assets/skills/office-documents/scripts/table_geometry.py +13 -3
- package/assets/skills/office-documents/scripts/watermark_add.py +6 -5
- package/assets/skills/office-documents/scripts/watermark_audit_remove.py +6 -4
- package/assets/skills/office-documents/tasks/accessibility_a11y.md +16 -22
- package/assets/skills/office-documents/tasks/captions_crossrefs.md +23 -26
- package/assets/skills/office-documents/tasks/clean_tracked_changes.md +17 -22
- package/assets/skills/office-documents/tasks/comments_manage.md +9 -11
- package/assets/skills/office-documents/tasks/compare_diff.md +10 -16
- package/assets/skills/office-documents/tasks/create_edit.md +14 -16
- package/assets/skills/office-documents/tasks/equations.md +17 -28
- package/assets/skills/office-documents/tasks/fields_update.md +14 -16
- package/assets/skills/office-documents/tasks/fixtures_edge_cases.md +19 -33
- package/assets/skills/office-documents/tasks/footnotes_endnotes.md +12 -14
- package/assets/skills/office-documents/tasks/forms_content_controls.md +16 -20
- package/assets/skills/office-documents/tasks/headings_numbering.md +17 -22
- package/assets/skills/office-documents/tasks/images_figures.md +15 -25
- package/assets/skills/office-documents/tasks/multi_doc_merge.md +13 -23
- package/assets/skills/office-documents/tasks/navigation_internal_links.md +18 -21
- package/assets/skills/office-documents/tasks/privacy_scrub_metadata.md +16 -22
- package/assets/skills/office-documents/tasks/protection_restrict_editing.md +19 -21
- package/assets/skills/office-documents/tasks/read_review.md +9 -20
- package/assets/skills/office-documents/tasks/redaction_anonymization.md +17 -18
- package/assets/skills/office-documents/tasks/sections_layout.md +16 -23
- package/assets/skills/office-documents/tasks/style_lint_normalize.md +18 -22
- package/assets/skills/office-documents/tasks/tables_spreadsheets.md +21 -31
- package/assets/skills/office-documents/tasks/templates_style_packs.md +17 -21
- package/assets/skills/office-documents/tasks/toc_workflow.md +10 -14
- package/assets/skills/office-documents/tasks/verify_render.md +11 -23
- package/assets/skills/office-documents/tasks/watermarks_background.md +10 -14
- package/assets/skills/office-documents/troubleshooting/libreoffice_headless.md +6 -6
- package/assets/skills/office-documents/troubleshooting/run_splitting.md +12 -12
- package/assets/skills/office-pdf/SKILL.md +36 -51
- package/assets/skills/office-pdf/references/form-fields.md +20 -20
- package/assets/skills/office-pdf/references/geometry.md +10 -10
- package/assets/skills/office-pdf/references/layout-quality.md +13 -13
- package/assets/skills/office-pdf/references/limits.md +12 -56
- package/assets/skills/office-pdf/tasks/annotations.md +5 -5
- package/assets/skills/office-pdf/tasks/create.md +6 -9
- package/assets/skills/office-pdf/tasks/edit-pages.md +14 -14
- package/assets/skills/office-pdf/tasks/forms.md +15 -15
- package/assets/skills/office-pdf/tasks/read.md +9 -9
- package/assets/skills/office-pdf/tasks/redact.md +18 -18
- package/assets/skills/office-pdf/tasks/stamp.md +10 -10
- package/assets/skills/office-presentations/SKILL.md +71 -91
- package/assets/skills/office-presentations/container_tools/preview_render.py +4 -1
- package/assets/skills/office-presentations/container_tools/render_slides.py +1 -1
- package/assets/skills/office-presentations/domain_guidance/finance.md +16 -16
- package/assets/skills/office-presentations/recipes/README.md +24 -35
- package/assets/skills/office-presentations/recipes/autolayout.md +12 -13
- package/assets/skills/office-presentations/recipes/connectors.md +11 -12
- package/assets/skills/office-presentations/recipes/images.md +11 -12
- package/assets/skills/office-presentations/recipes/master-and-layouts.md +18 -18
- package/assets/skills/office-presentations/recipes/native-charts.md +8 -8
- package/assets/skills/office-presentations/recipes/rich-text-runs.md +13 -13
- package/assets/skills/office-presentations/recipes/speaker-notes.md +7 -7
- package/assets/skills/office-presentations/recipes/tables.md +14 -14
- package/assets/skills/office-presentations/recipes/textbox-at-coordinate.md +9 -9
- package/assets/skills/office-presentations/recipes/theme-tokens.md +7 -8
- package/assets/skills/office-presentations/references/authoring-workflow.md +38 -43
- package/assets/skills/office-presentations/references/finalization.md +10 -12
- package/assets/skills/office-presentations/references/native-bullets.md +14 -18
- package/assets/skills/office-presentations/references/native-evidence.md +18 -32
- package/assets/skills/office-presentations/references/style-guidelines.md +27 -32
- package/assets/skills/office-presentations/references/templates.md +31 -60
- package/assets/skills/office-presentations/routing/google_slides.md +4 -4
- package/assets/skills/office-presentations/tasks/apply-annotations.md +17 -17
- package/assets/skills/office-presentations/tasks/charts-tables-notes.md +20 -23
- package/assets/skills/office-presentations/tasks/create-deck.md +19 -19
- package/assets/skills/office-presentations/tasks/edit-deck.md +14 -16
- package/assets/skills/office-presentations/tasks/inspect-and-verify.md +31 -34
- package/assets/skills/office-presentations/tasks/template-following.md +23 -28
- package/assets/skills/office-spreadsheets/SKILL.md +32 -39
- package/assets/skills/office-spreadsheets/recipes/charts.md +8 -26
- package/assets/skills/office-spreadsheets/recipes/conditional-formats.md +9 -26
- package/assets/skills/office-spreadsheets/recipes/data-tables.md +7 -23
- package/assets/skills/office-spreadsheets/recipes/named-ranges.md +8 -21
- package/assets/skills/office-spreadsheets/recipes/number-formats.md +7 -23
- package/assets/skills/office-spreadsheets/recipes/sparklines.md +7 -20
- package/assets/skills/office-spreadsheets/references/charts.md +15 -34
- package/assets/skills/office-spreadsheets/references/domain/financial-models.md +10 -25
- package/assets/skills/office-spreadsheets/references/domain/healthcare.md +8 -19
- package/assets/skills/office-spreadsheets/references/domain/marketing.md +8 -22
- package/assets/skills/office-spreadsheets/references/domain/research.md +8 -19
- package/assets/skills/office-spreadsheets/references/formula-patterns.md +20 -50
- package/assets/skills/office-spreadsheets/references/style-guidelines.md +19 -44
- package/assets/skills/office-spreadsheets/references/workbook-structure.md +12 -35
- package/assets/skills/office-spreadsheets/routing/google-sheets.md +11 -26
- package/assets/skills/office-spreadsheets/tasks/analyze-workbook.md +10 -25
- package/assets/skills/office-spreadsheets/tasks/annotations.md +12 -30
- package/assets/skills/office-spreadsheets/tasks/create-workbook.md +5 -5
- package/assets/skills/office-spreadsheets/tasks/diff-workbooks.md +2 -2
- package/assets/skills/office-spreadsheets/tasks/edit-workbook.md +5 -5
- package/assets/skills/office-spreadsheets/tasks/inspect-workbook.md +9 -9
- package/assets/skills/office-spreadsheets/tasks/recalc-and-check.md +10 -30
- package/assets/skills/shared/annotation-recipes.md +98 -120
- package/assets/skills/shared/common-workflow.md +70 -80
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/python/office_cli.py +38 -4
|
@@ -1,51 +1,42 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Drive a workbook that is already open in Excel or WPS Spreadsheets over COM
|
|
2
|
+
description: 'Drive a workbook that is already open in Excel or WPS Spreadsheets on Windows over COM: read cells, write values and formulas, style ranges, add charts and tables, recalculate, save, and report the exact ranges touched.'
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Live spreadsheets (Excel / WPS)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
Windows only. Drives an open Excel or WPS Spreadsheets window through COM with Windows
|
|
8
|
+
PowerShell 5.1 (`Marshal.GetActiveObject`; PowerShell 7 dropped it). On macOS and Linux
|
|
9
|
+
every command exits `3` with `stage: "powershell"` and a remedy; use the file-based `xlsx`
|
|
10
|
+
verbs there.
|
|
11
11
|
|
|
12
12
|
## What "live" means here
|
|
13
13
|
|
|
14
|
-
The workbook is open
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
the user is staring at update while they watch, and saving is a separate decision.
|
|
14
|
+
The workbook is open and the user is watching. The disk file may lag the window, not exist
|
|
15
|
+
yet, or hold unsaved edits. A live call changes the open document; saving is a separate
|
|
16
|
+
decision.
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
it landed. Read before retrying; never replay a half-applied batch.
|
|
25
|
-
- The disk file is not the deliverable. What the user sees in the window is. Saving is
|
|
26
|
-
an explicit act you announce.
|
|
18
|
+
- Address the open state, not a path: workbook name, sheet name, A1 range. Never "the
|
|
19
|
+
active sheet" or "the selection".
|
|
20
|
+
- Nothing is transactional. A failed call leaves what landed. Read before retrying; never
|
|
21
|
+
replay a half-applied batch.
|
|
22
|
+
- What the user sees matters, not the file on disk.
|
|
27
23
|
|
|
28
24
|
## Live or file editing?
|
|
29
25
|
|
|
30
26
|
| Situation | Route |
|
|
31
27
|
| --- | --- |
|
|
32
28
|
| The user says the file is open, or asks for "the sheet I'm looking at" | this skill |
|
|
33
|
-
| They want to watch cells change, iterate on a model
|
|
34
|
-
|
|
|
35
|
-
| Bulk generation, batch jobs, CI, or work that outlives the session | `../office-spreadsheets/SKILL.md` |
|
|
36
|
-
| Reading a file to answer a question, with no app open | `../office-spreadsheets/SKILL.md` |
|
|
29
|
+
| They want to watch cells change, iterate on a model, or add a chart to the visible sheet | this skill |
|
|
30
|
+
| Nothing is running, or the job is bulk/CI work, outlives the session, or is a question about a file | `../office-spreadsheets/SKILL.md` — edit the file, then tell them to reopen it |
|
|
37
31
|
|
|
38
|
-
Never force the live path. If nothing is running,
|
|
39
|
-
|
|
40
|
-
route and say so.
|
|
32
|
+
Never force the live path. If nothing is running, say the workbook must be open, or switch
|
|
33
|
+
to the file route and say so. Do not launch an application.
|
|
41
34
|
|
|
42
35
|
## Before you touch anything
|
|
43
36
|
|
|
44
|
-
1. Call
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
quote every path; this pack's directory is `<skill>/../excel-live-control`, which is
|
|
48
|
-
what `<skill>` below means.
|
|
37
|
+
1. Call `office_status`. The runtime block in `../office-spreadsheets/SKILL.md` holds the
|
|
38
|
+
verified paths: `python` runs these scripts, and its `skill` value is the
|
|
39
|
+
office-spreadsheets directory, so this pack is `<skill>/../excel-live-control`. Quote every path.
|
|
49
40
|
2. Run `"<python>" "<skill>/container_tools/live_excel.py" --help` once per session.
|
|
50
41
|
3. Attach and look before writing:
|
|
51
42
|
|
|
@@ -53,76 +44,64 @@ route and say so.
|
|
|
53
44
|
"<python>" "<skill>/container_tools/live_excel.py" info
|
|
54
45
|
```
|
|
55
46
|
|
|
56
|
-
`info` lists
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
Attachment uses `[Runtime.InteropServices.Marshal]::GetActiveObject` from Windows
|
|
70
|
-
PowerShell 5.1, trying `Excel.Application` then `Ket.Application` (WPS Spreadsheets).
|
|
71
|
-
WPS registers `Excel.Application` as an alias, so the reported application name is not
|
|
72
|
-
proof of which product is running; the JSON's `engine.vendor` is derived from
|
|
73
|
-
`Application.Path`. Mechanics and the COM object model: `references/office-automation.md`.
|
|
47
|
+
`info` lists open workbooks, the target workbook, its sheets, and per sheet the used
|
|
48
|
+
range, charts, tables, pivots and protection.
|
|
49
|
+
4. Attach failure returns a `remediation` string. Relay it as written: open the workbook in
|
|
50
|
+
Excel or WPS and keep it open, then retry. Never start an application for the user.
|
|
51
|
+
5. Several workbooks open: the tool refuses to guess. Pass `--workbook` with a file name
|
|
52
|
+
(`Budget FY26.xlsx`) or an unambiguous path fragment.
|
|
53
|
+
6. Attach works but calls fail, or name and vendor disagree: run `--diagnose` for the
|
|
54
|
+
attach mechanism, application, workbooks and sheets, with no mutation.
|
|
55
|
+
|
|
56
|
+
Attachment tries `Excel.Application` then `Ket.Application` (WPS). WPS registers
|
|
57
|
+
`Excel.Application` as an alias, so the app name proves nothing; `engine.vendor` comes from
|
|
58
|
+
`Application.Path`. COM object model: `references/office-automation.md`.
|
|
74
59
|
|
|
75
60
|
## The edit contract
|
|
76
61
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
- **Touch only what was asked for
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
- **
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
- **
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
autofit whole columns, do not add a header row the user did not ask for.
|
|
99
|
-
|
|
100
|
-
If a call fails partway, `read_range` the block you were writing and continue from what
|
|
101
|
-
actually landed. Retrying the identical call is how duplicate rows and reversed edits
|
|
102
|
-
happen.
|
|
62
|
+
Every mutating call must satisfy these.
|
|
63
|
+
|
|
64
|
+
- **Touch only what was asked for** — the named sheet and ranges.
|
|
65
|
+
- **Read before you write.** `read_range` the target: value, formula or merged fragment,
|
|
66
|
+
and whether user edits are unsaved.
|
|
67
|
+
- **Never destroy structure you did not create**: formulas (never flatten to values), named
|
|
68
|
+
ranges, conditional formats, shared formulas, data validation, pivots and sources, chart
|
|
69
|
+
series, filters, hidden rows, freeze panes, protection.
|
|
70
|
+
- **Never clear more than you can name.** `write_range --clear` clears an explicit range's
|
|
71
|
+
contents; charts, tables and formats survive. Never clear a used range to "start clean".
|
|
72
|
+
- **Batch small writes.** One call per logical block; rectangular only. A 6 × 2 range takes
|
|
73
|
+
6 rows of 2 values.
|
|
74
|
+
- **Report exactly what you touched.** Every mutating op returns workbook name and path,
|
|
75
|
+
sheet, address, row/column/cell counts and `warnings`. Quote it — "wrote
|
|
76
|
+
`Assumptions!C4:D8` (10 cells)" — not "updated the assumptions".
|
|
77
|
+
- **Saving is separate and announced.** See Delivery.
|
|
78
|
+
- **No decorative edits without a request.** No restyling, whole-column autofit, or
|
|
79
|
+
unrequested header row.
|
|
80
|
+
|
|
81
|
+
If a call fails partway, `read_range` the block and continue from what landed; retrying
|
|
82
|
+
the identical call duplicates rows and reverses edits.
|
|
103
83
|
|
|
104
84
|
## The tool
|
|
105
85
|
|
|
106
|
-
`"<skill>/container_tools/live_excel.py"`
|
|
107
|
-
|
|
108
|
-
Excel interop assemblies are neither used nor needed.
|
|
86
|
+
`"<skill>/container_tools/live_excel.py"` runs one command per operation, prints one JSON
|
|
87
|
+
object, and exits non-zero on failure. It shells out to `powershell.exe`; pywin32, comtypes
|
|
88
|
+
and Excel interop assemblies are neither used nor needed.
|
|
109
89
|
|
|
110
90
|
| Op | Does | Key options |
|
|
111
91
|
| --- | --- | --- |
|
|
112
|
-
| `info` | workbooks, target
|
|
113
|
-
| `read_range` | typed values
|
|
114
|
-
| `write_range` |
|
|
115
|
-
| `set_formula` |
|
|
92
|
+
| `info` | workbooks, target, sheet inventory | `--workbook` |
|
|
93
|
+
| `read_range` | typed values; optional formulas, display text | `--sheet --range`, `--formulas`, `--display`, `--max-cells` |
|
|
94
|
+
| `write_range` | a rectangular block of values | `--sheet --range --data`/`--data-file`, `--clear` |
|
|
95
|
+
| `set_formula` | one formula filled across a range, or a cell→formula map | `--range --formula`, or `--cells '{"C1":"=A1+B1"}'`/`--cells-file`, `--r1c1` |
|
|
116
96
|
| `style_range` | font, fill, number format, alignment, borders, width, merge | `--style` JSON or `--style-file`, `--merge` |
|
|
117
97
|
| `add_table` | native table (ListObject) over a range | `--name`, `--style TableStyleMedium2`, `--no-headers` |
|
|
118
|
-
| `add_chart` | embedded chart
|
|
98
|
+
| `add_chart` | embedded chart at an anchor, over a source range | `--type`, `--data`, `--anchor`, `--title`, `--width`, `--height` |
|
|
119
99
|
| `recalc` | `CalculateFull` on every open workbook | — |
|
|
120
|
-
| `save` |
|
|
121
|
-
| `close` | close the workbook, optionally quit the
|
|
100
|
+
| `save` | in place, or `SaveAs` a copy | `--path` |
|
|
101
|
+
| `close` | close the workbook, optionally quit the app | `--save`, `--discard`, `--quit-app` |
|
|
122
102
|
|
|
123
|
-
Global options on every op: `--workbook NAME|PATH`, `--timeout SECONDS` (default 180
|
|
124
|
-
|
|
125
|
-
starts a hidden application, which is wrong for any user-facing edit).
|
|
103
|
+
Global options on every op: `--workbook NAME|PATH`, `--timeout SECONDS` (default 180) and
|
|
104
|
+
`--launch-hidden` (**self-tests only** — a hidden app is wrong for user edits).
|
|
126
105
|
|
|
127
106
|
Style keys: `font_name`, `font_size`, `bold`, `italic`, `color`, `fill` (hex RGB, e.g.
|
|
128
107
|
`#FFF2CC`), `number_format`, `h_align` (`left|center|right|general|justify`), `v_align`
|
|
@@ -143,96 +122,84 @@ Typical first calls:
|
|
|
143
122
|
```
|
|
144
123
|
|
|
145
124
|
Failures print `{"ok": false, "stage": "...", "error": "...", "remediation": "..."}` and
|
|
146
|
-
exit 1 (2
|
|
147
|
-
|
|
148
|
-
|
|
125
|
+
exit `1` (operation failure), `2` (usage) or `3` (PowerShell unavailable, timed out, or
|
|
126
|
+
non-Windows). Stages: `attach` (nothing running), `com` (application refused the call),
|
|
127
|
+
`timeout` (dialog or oversized batch), `powershell` (no usable PowerShell), `usage` (bad
|
|
128
|
+
arguments). Read the message before changing approach.
|
|
149
129
|
|
|
150
|
-
The CLI is the fast path, not the ceiling.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
130
|
+
The CLI is the fast path, not the ceiling. For a COM call it does not wrap (a sheet tab,
|
|
131
|
+
freeze panes, a pivot, data validation, shape geometry), extend the script or drive the app
|
|
132
|
+
from a short PowerShell snippet, keeping the reporting and verification rules. Object
|
|
133
|
+
model: `references/office-automation.md`.
|
|
154
134
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
135
|
+
The tool does not create, rename, delete or reorder sheets; delete ranges or objects; run
|
|
136
|
+
macros; or open a file. Such a job asks the user for it, or uses the file route in
|
|
137
|
+
`../office-spreadsheets/SKILL.md`.
|
|
158
138
|
|
|
159
139
|
## Verification
|
|
160
140
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
1. **Read it back.** `read_range`
|
|
164
|
-
|
|
165
|
-
2. **No error cells.**
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
matters.
|
|
179
|
-
6. **Structure.** If the sheet had tables, pivots or charts before you started, `info`
|
|
180
|
-
after the edit proves they are still there.
|
|
181
|
-
7. **Report.** Name the workbook, the sheet, every range, and the cell counts.
|
|
141
|
+
After every batch, in order, before reporting done:
|
|
142
|
+
|
|
143
|
+
1. **Read it back.** `read_range` every range you wrote, `--formulas` when you wrote
|
|
144
|
+
formulas; compare cell by cell.
|
|
145
|
+
2. **No error cells.** `errors` lists every live error cell (`#DIV/0!`, `#VALUE!`, `#REF!`,
|
|
146
|
+
`#NAME?`, `#N/A`, …) with formula and address. An edit that leaves an error is
|
|
147
|
+
unfinished. Report a pre-existing error; do not silently fix it.
|
|
148
|
+
3. **Numbers.** `recalc` after formula changes, then re-read. An uncalculated formula tells
|
|
149
|
+
you nothing.
|
|
150
|
+
4. **Objects.** After adding a table or chart, `info` confirms it in the sheet inventory;
|
|
151
|
+
`add_chart`'s `source` confirms the source range.
|
|
152
|
+
5. **Appearance.** You cannot screenshot the user's window. `--display` shows up to 500
|
|
153
|
+
cells of rendered text and catches `###`, applied number formats and stray `#`; use it
|
|
154
|
+
when formatting matters. Otherwise the visual check is the user's — ask them to confirm.
|
|
155
|
+
6. **Structure.** `info` after the edit proves pre-existing tables, pivots and charts
|
|
156
|
+
survive.
|
|
157
|
+
7. **Report.** Workbook, sheet, every range, cell counts.
|
|
182
158
|
|
|
183
159
|
## Delivery
|
|
184
160
|
|
|
185
|
-
The workbook is the user's
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
- **
|
|
192
|
-
|
|
193
|
-
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
and never close their workbook. `close --quit-app` is for cleaning up a self-test
|
|
200
|
-
instance, not for tidying the user's desktop.
|
|
201
|
-
- If the edit failed partway and the document is dirty with a half-finished change, say
|
|
202
|
-
exactly which ranges landed, and offer either to finish them or to close without saving.
|
|
161
|
+
The workbook is the user's document; state what you did and its state. Never save quietly.
|
|
162
|
+
|
|
163
|
+
- **Default: modified and unsaved.** Say so, and that Ctrl+S keeps it. Never overwrite a
|
|
164
|
+
file they were editing by hand.
|
|
165
|
+
- **They asked to save**: `save` with no `--path` overwrites the workbook's file. Say
|
|
166
|
+
"saved `Budget FY26.xlsx`" with the full path from the reply.
|
|
167
|
+
- **Unsaved workbook, or an artifact is wanted**: `save --path <copy>.xlsx` writes a copy
|
|
168
|
+
and leaves the original dirty. `present` that copy.
|
|
169
|
+
- **`.xlsx` in chat**: a path alone is not delivery. `present` a saved file; state both
|
|
170
|
+
paths when original and copy differ.
|
|
171
|
+
- **Never** save over the user's file "to make sure" without telling them, and never close
|
|
172
|
+
their workbook. `close --quit-app` is for self-test cleanup, not the user's desktop.
|
|
173
|
+
- If the edit failed partway, say exactly which ranges landed and offer to finish them or
|
|
174
|
+
close without saving.
|
|
203
175
|
|
|
204
176
|
## What good content looks like
|
|
205
177
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
- **
|
|
211
|
-
Outputs on the left of the tab strip, builds in the middle, inputs on the right; a
|
|
212
|
-
terminal check/audit tab for models that need one. Do not restructure a workbook the
|
|
213
|
-
user already organised — `workflows/edit_workflows.md`.
|
|
214
|
-
- **Formulas that a reviewer can audit.** Anchored references (`$B$3`, `C$4`, `$A8`),
|
|
178
|
+
- **Structure by role, not tab count.** Inputs, assumptions, calculations, outputs. Outputs
|
|
179
|
+
at the left of the tab strip, builds in the middle, inputs on the right; a terminal
|
|
180
|
+
check/audit tab if the model needs one. Do not restructure a workbook the user already
|
|
181
|
+
organised — `workflows/edit_workflows.md`.
|
|
182
|
+
- **Formulas a reviewer can audit.** Anchored references (`$B$3`, `C$4`, `$A8`),
|
|
215
183
|
`SUMIFS`/`COUNTIFS`/`AVERAGEIFS` over hand-rolled sums, short `IF`, no blanket
|
|
216
184
|
`IFERROR(...,0)` (`#VALUE!` is information), no `LET`/`LAMBDA`/spill arrays.
|
|
217
|
-
`workflows/create_workflows.md` and `references/office-automation.md`
|
|
185
|
+
`workflows/create_workflows.md` and `references/office-automation.md` explain what COM
|
|
218
186
|
stores when you write these.
|
|
219
187
|
- **Typed values.** Numbers as numbers, dates as dates, one number format per column.
|
|
220
188
|
Invariant format codes (`#,##0`, `0.0%`, `"$"#,##0.00`) — never swap `.` and `,`.
|
|
221
189
|
- **Reading someone else's workbook is read-only.** `references/read_only_qna.md`.
|
|
222
|
-
- **Domain conventions** — finance, healthcare, marketing, scientific data —
|
|
223
|
-
|
|
224
|
-
that area.
|
|
190
|
+
- **Domain conventions** — finance, healthcare, marketing, scientific data — read the
|
|
191
|
+
matching `domain_guidance/` file before modelling.
|
|
225
192
|
- **Visual defaults** (headers, input fills, borders, tab colours, one font family):
|
|
226
193
|
`style_guidelines.md`.
|
|
227
|
-
- **Citations** for external data go next to the input table they support, not in a
|
|
228
|
-
|
|
194
|
+
- **Citations** for external data go next to the input table they support, not in a tab of
|
|
195
|
+
their own.
|
|
229
196
|
|
|
230
197
|
## Files in this skill
|
|
231
198
|
|
|
232
199
|
| File | Use it when |
|
|
233
200
|
| --- | --- |
|
|
234
|
-
| `references/office-automation.md` |
|
|
235
|
-
| `references/read_only_qna.md` | answering a question
|
|
201
|
+
| `references/office-automation.md` | COM object model: addressing, `Value2` vs `Formula`, colour, locale, latency |
|
|
202
|
+
| `references/read_only_qna.md` | answering a question without changing the workbook |
|
|
236
203
|
| `style_guidelines.md` | the request involves how the sheet looks |
|
|
237
204
|
| `workflows/create_workflows.md` | building a new sheet or workbook live |
|
|
238
205
|
| `workflows/edit_workflows.md` | changing cells in a workbook the user already built |
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# Financial models
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
right, and a live edit makes each of them visible to a user who is watching.
|
|
3
|
+
A live edit makes every modelling distinction visible to a watching user.
|
|
5
4
|
|
|
6
5
|
## The distinctions that matter
|
|
7
6
|
|
|
@@ -11,76 +10,61 @@ right, and a live edit makes each of them visible to a user who is watching.
|
|
|
11
10
|
| Payroll expense | Cash paid to employees — accruals, timing, employer costs |
|
|
12
11
|
| Capex | Depreciation / amortisation — cash out once, expense over life |
|
|
13
12
|
| Earnings | Cash flow — working capital, non-cash items, financing |
|
|
14
|
-
| Budget | Forecast —
|
|
13
|
+
| Budget | Forecast — a target vs an expectation; never mix them silently |
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Actuals and forecast must be visibly different (a divide, a label, a different fill). The
|
|
21
|
-
reader has to know where history stops.
|
|
15
|
+
Establish fiscal calendar, horizon (monthly / quarterly / annual) and grain (company,
|
|
16
|
+
segment, product) before typing a number; without all three it is not a model input. Show
|
|
17
|
+
actuals and forecast apart (divide, label or fill) so the reader sees where history stops.
|
|
22
18
|
|
|
23
19
|
## Schedules
|
|
24
20
|
|
|
25
|
-
Build a driver schedule per line, then a statement, then the output.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- **
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
|
|
36
|
-
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
A worked unit check, done in the cells: actual salary cost $60,000 across 10 paid FTE is
|
|
43
|
-
$6,000 per FTE; a forecast of $6,300 per FTE on 11 FTE gives $69,300 against $66,000 for
|
|
44
|
-
the prior per-FTE rate — the difference is rate *and* headcount, and both drivers belong
|
|
45
|
-
on separate rows. If either missing pay or zero FTE is in the source, the implied rate
|
|
46
|
-
cannot be established; mark it unavailable, do not divide by zero and call it 0.
|
|
21
|
+
Build a driver schedule per line, then a statement, then the output.
|
|
22
|
+
|
|
23
|
+
- **Revenue**: volume × price; mix for segments; recognition timing for multi-period
|
|
24
|
+
contracts. No straight growth percentage unless the user asked.
|
|
25
|
+
- **Payroll**: headcount, FTE and paid FTE are three numbers. Prorate hires and exits by
|
|
26
|
+
month; never divide an annual salary by 12 twice; state commission and employer-cost basis.
|
|
27
|
+
- **Opex**: units × rate, fixed, or one-time — say which. A growing line needs a driver, not
|
|
28
|
+
a percent of revenue, unless that is stated policy.
|
|
29
|
+
- **D&A**: cost, residual value, in-service date, useful life, convention; reconcile
|
|
30
|
+
gross-asset and accumulated-depreciation roll-forwards to the prior period.
|
|
31
|
+
- **Statements**: retained earnings = opening + net income − dividends; cash-flow ending
|
|
32
|
+
cash = balance-sheet cash. A mismatch is a plug: report it, do not fix it.
|
|
33
|
+
|
|
34
|
+
Worked unit check, in the cells: $60,000 of salary over 10 paid FTE is $6,000 per FTE;
|
|
35
|
+
$6,300 per FTE × 11 is $69,300 against $66,000 at the prior rate — rate and headcount both
|
|
36
|
+
moved, so both need a row. Missing pay or zero FTE: implied rate unavailable; never divide
|
|
37
|
+
by zero into 0.
|
|
47
38
|
|
|
48
39
|
## Refreshes and merges
|
|
49
40
|
|
|
50
|
-
|
|
51
|
-
a
|
|
52
|
-
complete, and never let a merge drop a dimension silently — report rows that did not match.
|
|
41
|
+
Merge complete periods on the business key (calendar date, master product code). Never append
|
|
42
|
+
a partial period as complete; never drop a dimension silently — report unmatched rows.
|
|
53
43
|
|
|
54
44
|
## Variances and audit
|
|
55
45
|
|
|
56
|
-
-
|
|
57
|
-
is unavailable — write `n.a.`, not `0%`.
|
|
46
|
+
- A variance needs an amount **and** a percent. Zero or missing base: write `n.a.`, not `0%`.
|
|
58
47
|
- Check totals: parts sum to the whole, schedules tie to statements, the bridge closes to
|
|
59
|
-
zero
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
passes. Missing or untested data is "unavailable", never "PASS".
|
|
48
|
+
zero; compare to two decimals including `0.00`; a check that passes at 0.01 is failing.
|
|
49
|
+
- Failed checks: `#FFC7CE` fill with bold `#9C0006` text; passes stay neutral. Missing or
|
|
50
|
+
untested data is "unavailable", never "PASS".
|
|
63
51
|
|
|
64
52
|
## Valuation, if it comes up
|
|
65
53
|
|
|
66
|
-
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
- Sensitivities the user asks for belong in a native what-if data table, not in a grid of
|
|
73
|
-
hand-typed scenarios that will drift.
|
|
54
|
+
- A DCF needs drivers, tax, D&A, capex, working capital, unlevered free cash flow, the
|
|
55
|
+
discounting convention, a terminal-value method and the enterprise-to-equity bridge;
|
|
56
|
+
skipping two is a wrong answer, not a shortcut.
|
|
57
|
+
- IRR/XIRR need valid signs and dates; with no sign change there is no IRR, and `#NUM!` is
|
|
58
|
+
the answer to report.
|
|
59
|
+
- Sensitivities belong in a native what-if data table, not a grid of hand-typed scenarios.
|
|
74
60
|
|
|
75
61
|
## Doing it live
|
|
76
62
|
|
|
77
|
-
- Read
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
- Never write a hard-coded total when a formula can tie it. And never "fix" an existing
|
|
86
|
-
`#REF!` — report it.
|
|
63
|
+
- Read first: `info` for tabs and objects; `read_range --formulas` over the rows you will
|
|
64
|
+
extend; match existing anchoring (`$C$4` rate, `C$9` period header) and `SUMIFS`
|
|
65
|
+
aggregation.
|
|
66
|
+
- One driver row at a time, each with a formula you can point at; verify after each block. A
|
|
67
|
+
200-cell scenario grid written blind is the expensive way to fail.
|
|
68
|
+
- Extend the check tab to cover new rows; on a small model with none, add one labelled
|
|
69
|
+
verification row beside the output.
|
|
70
|
+
- Never hard-code a total a formula can tie; never "fix" an existing `#REF!` — report it.
|
|
@@ -1,58 +1,52 @@
|
|
|
1
1
|
# Healthcare
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Health organisations run two workbook kinds:
|
|
4
4
|
|
|
5
|
-
- **Clinical and patient records
|
|
6
|
-
|
|
7
|
-
- **Administrative and financial work
|
|
8
|
-
|
|
5
|
+
- **Clinical and patient records** — appointments, encounters, observations, results. The
|
|
6
|
+
clinical system is the source of truth; a workbook holds an extract.
|
|
7
|
+
- **Administrative and financial work** — budgets, staffing, throughput, cost per case. Money
|
|
8
|
+
follows `financial_models.md`, hospitals included.
|
|
9
9
|
|
|
10
|
-
Most
|
|
11
|
-
extract and the analysis visibly separate.
|
|
10
|
+
Most tasks are the second kind built on the first. Keep extract and analysis visibly apart.
|
|
12
11
|
|
|
13
12
|
## Handling the raw extract
|
|
14
13
|
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
`
|
|
19
|
-
- Keep the source's definitions with the data:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- Preserve identifiers exactly
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
(bpm)`), not in the cells as text. A column of `"72 bpm"` strings cannot be averaged.
|
|
14
|
+
- Keep raw data untouched on its own sheet or block, as one table; compute beside it or in a
|
|
15
|
+
separate prepared block. Never overwrite a measurement.
|
|
16
|
+
- Name descriptively: `Appointments_RawData` beats `Sheet2`; `Clinic KPI Dashboard` beats
|
|
17
|
+
`Sheet5`.
|
|
18
|
+
- Keep the source's definitions with the data: period covered, extract date, source system,
|
|
19
|
+
denominator. Length of stay, readmission rate and utilisation are meaningless without them,
|
|
20
|
+
and systems define them differently.
|
|
21
|
+
- Preserve identifiers exactly (MRN formats vary); dates as dates, one format down the column.
|
|
22
|
+
- Units in the header (`Weight (kg)`, `Temperature (°C)`, `HbA1c (%)`, `Heart rate (bpm)`),
|
|
23
|
+
never cell text — `"72 bpm"` strings cannot be averaged.
|
|
26
24
|
|
|
27
25
|
## Building on it
|
|
28
26
|
|
|
29
|
-
- Highlight
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
measurement in place; the original and the correction are both evidence.
|
|
27
|
+
- Highlight fields staff must complete (amber fill); no unused placeholders.
|
|
28
|
+
- For a threshold-driven flag, name one cell (`BMI_threshold`) and reference it, so the
|
|
29
|
+
cut-off is visible and changeable.
|
|
30
|
+
- Flags only from a stated source or protocol threshold, with its severity (normal / elevated
|
|
31
|
+
/ high) and a sheet legend. Never invent clinical ranges; never round a borderline value
|
|
32
|
+
into a category.
|
|
33
|
+
- Codebook (code → meaning, units, abbreviations) beside coded data; legend for
|
|
34
|
+
abbreviations.
|
|
35
|
+
- `Corrected value` column or audit log; never edit the original measurement in place —
|
|
36
|
+
original and correction are both evidence.
|
|
40
37
|
|
|
41
38
|
## Consequences of getting it wrong
|
|
42
39
|
|
|
43
|
-
Clinical arithmetic
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
present a screening flag as a diagnosis.
|
|
40
|
+
Clinical arithmetic is not clinical judgement. Compute what the source supports; check a
|
|
41
|
+
critical calculation (dosing, risk score, threshold classification) against the authoritative
|
|
42
|
+
definition, and say when none exists rather than asserting the number. No clinical advice; a
|
|
43
|
+
screening flag is not a diagnosis.
|
|
48
44
|
|
|
49
45
|
## Doing it live
|
|
50
46
|
|
|
51
|
-
- The
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- After writing, verify with `read_range --formulas` and check the `errors` array — a
|
|
58
|
-
healthcare sheet with a `#DIV/0!` in a rate column is a report that will be misread.
|
|
47
|
+
- The extract may be open with the user's formatting. Read first: `info` for sheets and used
|
|
48
|
+
ranges; `read_range --formulas --display` for the block you will extend.
|
|
49
|
+
- Add derived columns right of the raw block with a clear header, or in a separate prepared
|
|
50
|
+
area; never insert a column into an extract that formulas or a pivot reference.
|
|
51
|
+
- After writing, verify with `read_range --formulas` and check `errors` — a `#DIV/0!` in a
|
|
52
|
+
rate column becomes a misread report.
|