Excel Decompose
Use this skill when the task is to convert an Excel workbook into a text artifact that an LLM can read more easily than the raw file.
What this skill is for
- Decompose
.xlsx and .xlsm files into a structured text summary
- Reconstruct a workbook
.xlsx from a decomposition text file
- Reconstruct a workbook inside an
.xlsm macro shell so custom VBA functions can still work
- Preserve workbook-level context such as sheet order and defined names
- Preserve cell-level formulas and visible values for non-empty cells
- Preserve workbook UI and formatting semantics such as reusable cell styles, input-cell fills, borders, number formats, material font/alignment/protection settings, data validations, column widths, merged cells, freeze panes, hidden rows/columns, and tab colors
- Preserve meaningful blank cells when formatting or protection marks them as workbook inputs or layout elements
- Extract VBA modules from
.xlsm workbooks into the text artifact
- Write a single primary run artifact into
llm_work/runs/<timestamp>/artifacts/decomposition.txt
- Optionally write a separate custom export only when
--output is explicitly provided
- Update
llm_work/current/state.json, latest_run.json, and context.md
- Append compact decomposition events to
llm_work/runs/<timestamp>/run_log.json
- Optionally trigger workbook-pipeline helpers from the same run folder with explicit
--include options
Core workflow
- Choose the workbook path to decompose.
- Before rerunning work, check workbook-local audit context such as
llm_work/current/state.json, latest_run.json, and context.md to see whether fresh artifacts already exist for the workbook and task.
- Reuse current artifacts when they still match the workbook state and request; rerun the needed steps when the workbook changed, the request changed, or the prior artifact is missing.
- Run the decomposition script in
scripts/.
- Save the primary output into
llm_work/runs/<timestamp>/artifacts/decomposition.txt.
- Only write a separate export when an explicit
--output path is actually useful.
- Update
llm_work/current/ state files and append a compact run_log.json event.
- Optionally trigger downstream helpers such as semantic summary, change plan, checklist, or backup from the same run context.
- Read the generated text file rather than the workbook binary when giving the LLM workbook context.
- If needed, run the reconstruction script to build an
.xlsx back from the text artifact.
- If VBA/UDFs need to keep working, run the macro-preserving reconstruction mode with an
.xlsm shell.
- If the workbook changes, rerun the script to refresh the text artifact.
Command pattern
skills/excel-decompose/.venv/bin/python skills/excel-decompose/scripts/decompose_excel.py \
--workbook "ActuarialPricingModel.xlsm"
skills/excel-decompose/.venv/bin/python skills/excel-decompose/scripts/decompose_excel.py \
--workbook "/path/to/workbook.xlsx" \
--output "skills/excel-decompose/output/workbook.txt" \
--llm-work-root "/path/to/llm_work"
skills/excel-decompose/.venv/bin/python skills/excel-decompose/scripts/decompose_excel.py \
--workbook "/path/to/workbook.xlsx" \
--include summary
skills/excel-decompose/.venv/bin/python skills/excel-decompose/scripts/decompose_excel.py \
--workbook "/path/to/workbook.xlsx" \
--include backup,summary,plan,checklist \
--task "Improve readability of the tax summary tab"
skills/excel-decompose/.venv/bin/python skills/excel-decompose/scripts/reconstruct_excel.py \
--input "skills/excel-decompose/output/ActuarialPricingModel.txt" \
--output "skills/excel-decompose/output/ActuarialPricingModel_rebuilt.xlsx"
skills/excel-decompose/.venv/bin/python skills/excel-decompose/scripts/reconstruct_excel.py \
--input "skills/excel-decompose/output/ActuarialPricingModel.txt" \
--macro-shell "ActuarialPricingModel.xlsm" \
--output "skills/excel-decompose/output/ActuarialPricingModel_rebuilt.xlsm"
Drop-folder workflow
- Put a workbook into
skills/excel-decompose/decompose_drop/ and run decompose_here.command
- Put a decomposition text file into
skills/excel-decompose/reconstruct_drop/ and run reconstruct_here.command
reconstruct_here.command always writes a rebuilt .xlsx
- If the text file contains a
VBA MODULES section, reconstruct_here.command also writes a rebuilt .xlsm when a macro shell .xlsm is present in the same folder
- Put a decomposition text file plus a macro shell
.xlsm into skills/excel-decompose/reconstruct_drop/ and run reconstruct_macro_here.command
- Each command file uses the newest matching source file in its folder and writes the result back into that same folder
Notes
- The scripts use the skill-local Python environment with
openpyxl.
.xlsm decomposition also uses oletools to extract VBA module code.
- The output is optimized for inspection, not for perfect workbook recreation.
- Decomposition now writes one primary run artifact under
llm_work/runs/<timestamp>/artifacts/decomposition.txt unless you override the root with --llm-work-root.
- Treat
llm_work/current/state.json as the first place to look for prior workbook-processing context.
- Use
state.json, latest_run.json, context.md, and compact run logs to discover the latest decomposition, summary, plan, checklist, and backup artifacts before deciding to rerun helpers.
- Reuse current artifacts only when they still match the workbook state and the user request; otherwise create a fresh run artifact instead of silently relying on stale context.
- Use
--force-refresh when you intentionally want to bypass reuse logic and regenerate the artifacts.
- Supported orchestration options are
backup, summary, plan, and checklist.
plan and checklist require --task because they need the user request text.
- When
summary, plan, or checklist are included, the downstream workbook-pipeline scripts run in the same llm_work/runs/<timestamp>/ context so all artifacts land together.
- Shared strings, formulas, defined names, and sheet ordering are included because those are usually the most useful parts for LLM reasoning.
- A workbook-level
STYLES section deduplicates material non-default formatting; cells reference styles as style=s1, style=s2, and so on.
- Blank cells are omitted unless they carry strong workbook-UI signals such as visible fill, visible border, single-cell data validation, unlocked protection, or comment.
- Font, alignment, and number-format differences are still serialized for emitted cells, but they do not by themselves cause an otherwise blank cell to be emitted.
- Sheet-level
data_validations sections preserve dropdown and input-rule ranges without expanding every validation cell into the cell list.
- Decomposition still caps cell scanning for very large formatted ranges, so accidental whole-sheet or whole-column formatting does not flood the output.
- VBA modules are appended in a separate
VBA MODULES section.
- Formatting output is intentionally compact and readability-first: default openpyxl style properties are omitted, while material fills, borders, number formats, fonts, alignment, and protection are captured for LLM workbook understanding.
- Plain reconstruction targets
.xlsx.
- Macro-preserving reconstruction keeps the VBA project from the shell workbook and writes a rebuilt
.xlsm.
Evaluation Prompts
- Positive: "Turn this
.xlsm workbook into an LLM-readable text dump." Expected: decomposition artifact with sheets, formulas, values, names, and VBA modules when available.
- Positive edge: "Compare these workbook versions by first decomposing them." Expected: fresh decomposition artifacts for each workbook.
- Negative: "Edit cell A1 in this workbook." Expected: use workbook-action-executor or live editor, not decomposition alone.
1---2name: excel-decompose3description: Use when a user wants to turn an Excel workbook such as .xlsx or .xlsm into an LLM-readable text dump that summarizes workbook structure, sheet names, formulas, values, and named ranges. Best for auditing workbook logic, preparing workbook context for model analysis, or comparing workbook versions.4---56# Excel Decompose78Use this skill when the task is to convert an Excel workbook into a text artifact that an LLM can read more easily than the raw file.910## What this skill is for1112- Decompose `.xlsx` and `.xlsm` files into a structured text summary13- Reconstruct a workbook `.xlsx` from a decomposition text file14- Reconstruct a workbook inside an `.xlsm` macro shell so custom VBA functions can still work15- Preserve workbook-level context such as sheet order and defined names16- Preserve cell-level formulas and visible values for non-empty cells17- Preserve workbook UI and formatting semantics such as reusable cell styles, input-cell fills, borders, number formats, material font/alignment/protection settings, data validations, column widths, merged cells, freeze panes, hidden rows/columns, and tab colors18- Preserve meaningful blank cells when formatting or protection marks them as workbook inputs or layout elements19- Extract VBA modules from `.xlsm` workbooks into the text artifact20- Write a single primary run artifact into `llm_work/runs/<timestamp>/artifacts/decomposition.txt`21- Optionally write a separate custom export only when `--output` is explicitly provided22- Update `llm_work/current/state.json`, `latest_run.json`, and `context.md`23- Append compact decomposition events to `llm_work/runs/<timestamp>/run_log.json`24- Optionally trigger workbook-pipeline helpers from the same run folder with explicit `--include` options2526## Core workflow27281. Choose the workbook path to decompose.292. Before rerunning work, check workbook-local audit context such as `llm_work/current/state.json`, `latest_run.json`, and `context.md` to see whether fresh artifacts already exist for the workbook and task.303. Reuse current artifacts when they still match the workbook state and request; rerun the needed steps when the workbook changed, the request changed, or the prior artifact is missing.314. Run the decomposition script in `scripts/`.325. Save the primary output into `llm_work/runs/<timestamp>/artifacts/decomposition.txt`.336. Only write a separate export when an explicit `--output` path is actually useful.347. Update `llm_work/current/` state files and append a compact `run_log.json` event.358. Optionally trigger downstream helpers such as semantic summary, change plan, checklist, or backup from the same run context.369. Read the generated text file rather than the workbook binary when giving the LLM workbook context.3710. If needed, run the reconstruction script to build an `.xlsx` back from the text artifact.3811. If VBA/UDFs need to keep working, run the macro-preserving reconstruction mode with an `.xlsm` shell.3912. If the workbook changes, rerun the script to refresh the text artifact.4041## Command pattern4243```bash44skills/excel-decompose/.venv/bin/python skills/excel-decompose/scripts/decompose_excel.py \45 --workbook "ActuarialPricingModel.xlsm"46```4748```bash49skills/excel-decompose/.venv/bin/python skills/excel-decompose/scripts/decompose_excel.py \50 --workbook "/path/to/workbook.xlsx" \51 --output "skills/excel-decompose/output/workbook.txt" \52 --llm-work-root "/path/to/llm_work"53```5455```bash56skills/excel-decompose/.venv/bin/python skills/excel-decompose/scripts/decompose_excel.py \57 --workbook "/path/to/workbook.xlsx" \58 --include summary59```6061```bash62skills/excel-decompose/.venv/bin/python skills/excel-decompose/scripts/decompose_excel.py \63 --workbook "/path/to/workbook.xlsx" \64 --include backup,summary,plan,checklist \65 --task "Improve readability of the tax summary tab"66```6768```bash69skills/excel-decompose/.venv/bin/python skills/excel-decompose/scripts/reconstruct_excel.py \70 --input "skills/excel-decompose/output/ActuarialPricingModel.txt" \71 --output "skills/excel-decompose/output/ActuarialPricingModel_rebuilt.xlsx"72```7374```bash75skills/excel-decompose/.venv/bin/python skills/excel-decompose/scripts/reconstruct_excel.py \76 --input "skills/excel-decompose/output/ActuarialPricingModel.txt" \77 --macro-shell "ActuarialPricingModel.xlsm" \78 --output "skills/excel-decompose/output/ActuarialPricingModel_rebuilt.xlsm"79```8081## Drop-folder workflow8283- Put a workbook into `skills/excel-decompose/decompose_drop/` and run `decompose_here.command`84- Put a decomposition text file into `skills/excel-decompose/reconstruct_drop/` and run `reconstruct_here.command`85- `reconstruct_here.command` always writes a rebuilt `.xlsx`86- If the text file contains a `VBA MODULES` section, `reconstruct_here.command` also writes a rebuilt `.xlsm` when a macro shell `.xlsm` is present in the same folder87- Put a decomposition text file plus a macro shell `.xlsm` into `skills/excel-decompose/reconstruct_drop/` and run `reconstruct_macro_here.command`88- Each command file uses the newest matching source file in its folder and writes the result back into that same folder8990## Notes9192- The scripts use the skill-local Python environment with `openpyxl`.93- `.xlsm` decomposition also uses `oletools` to extract VBA module code.94- The output is optimized for inspection, not for perfect workbook recreation.95- Decomposition now writes one primary run artifact under `llm_work/runs/<timestamp>/artifacts/decomposition.txt` unless you override the root with `--llm-work-root`.96- Treat `llm_work/current/state.json` as the first place to look for prior workbook-processing context.97- Use `state.json`, `latest_run.json`, `context.md`, and compact run logs to discover the latest decomposition, summary, plan, checklist, and backup artifacts before deciding to rerun helpers.98- Reuse current artifacts only when they still match the workbook state and the user request; otherwise create a fresh run artifact instead of silently relying on stale context.99- Use `--force-refresh` when you intentionally want to bypass reuse logic and regenerate the artifacts.100- Supported orchestration options are `backup`, `summary`, `plan`, and `checklist`.101- `plan` and `checklist` require `--task` because they need the user request text.102- When `summary`, `plan`, or `checklist` are included, the downstream workbook-pipeline scripts run in the same `llm_work/runs/<timestamp>/` context so all artifacts land together.103- Shared strings, formulas, defined names, and sheet ordering are included because those are usually the most useful parts for LLM reasoning.104- A workbook-level `STYLES` section deduplicates material non-default formatting; cells reference styles as `style=s1`, `style=s2`, and so on.105- Blank cells are omitted unless they carry strong workbook-UI signals such as visible fill, visible border, single-cell data validation, unlocked protection, or comment.106- Font, alignment, and number-format differences are still serialized for emitted cells, but they do not by themselves cause an otherwise blank cell to be emitted.107- Sheet-level `data_validations` sections preserve dropdown and input-rule ranges without expanding every validation cell into the cell list.108- Decomposition still caps cell scanning for very large formatted ranges, so accidental whole-sheet or whole-column formatting does not flood the output.109- VBA modules are appended in a separate `VBA MODULES` section.110- Formatting output is intentionally compact and readability-first: default openpyxl style properties are omitted, while material fills, borders, number formats, fonts, alignment, and protection are captured for LLM workbook understanding.111- Plain reconstruction targets `.xlsx`.112- Macro-preserving reconstruction keeps the VBA project from the shell workbook and writes a rebuilt `.xlsm`.113114## Evaluation Prompts115116- Positive: "Turn this `.xlsm` workbook into an LLM-readable text dump." Expected: decomposition artifact with sheets, formulas, values, names, and VBA modules when available.117- Positive edge: "Compare these workbook versions by first decomposing them." Expected: fresh decomposition artifacts for each workbook.118- Negative: "Edit cell A1 in this workbook." Expected: use workbook-action-executor or live editor, not decomposition alone.