Using Univer CLI
This is the entry skill for workbook and spreadsheet tasks. If the task touches workbook files,
sheets, cells, ranges, formulas, formatting, charts, previews, or SaC workbook behavior, load this
skill before choosing tools or writing code.
IF THIS SKILL APPLIES, DO NOT CHOOSE A SPREADSHEET LIBRARY FIRST. USE THE UNIVER CLI PATH FIRST.
The Rule
Decide the workflow before touching workbook content.
digraph using_univer_cli {
"Workbook task received" [shape=doublecircle];
"Ordinary workbook-visible work?" [shape=diamond];
"Load univer-cli" [shape=box];
"Use workbook-visible verification" [shape=box];
"SaC source or complex behavior?" [shape=diamond];
"Load writing-univer-plans" [shape=box];
"Success criteria then plan" [shape=box];
"Load executing-univer-plans" [shape=box];
"Execute the plan" [shape=box];
"Load test-driven-univer-development" [shape=box];
"TDD each pack from the plan" [shape=box];
"Implement only after the assertion gate exists" [shape=box];
"Verify and repair" [shape=box];
"Workbook task received" -> "Ordinary workbook-visible work?";
"Ordinary workbook-visible work?" -> "Load univer-cli" [label="yes"];
"Load univer-cli" -> "Use workbook-visible verification";
"Ordinary workbook-visible work?" -> "SaC source or complex behavior?" [label="no"];
"SaC source or complex behavior?" -> "Load writing-univer-plans" [label="yes"];
"Load writing-univer-plans" -> "Success criteria then plan";
"Success criteria then plan" -> "Load executing-univer-plans";
"Load executing-univer-plans" -> "Execute the plan";
"Execute the plan" -> "Load test-driven-univer-development";
"Load test-driven-univer-development" -> "TDD each pack from the plan";
"TDD each pack from the plan" -> "Implement only after the assertion gate exists";
"Implement only after the assertion gate exists" -> "Verify and repair";
}
SaC source authoring MUST follow this order:
- Success criteria then plan: load
writing-univer-plans, write or update
<package.univer>/project/success-criteria/<topic>.md, inspect enough workbook-visible evidence,
and write or update <package.univer>/project/plans/<topic>.md.
- Execute the plan: load
executing-univer-plans, review the plan critically, and execute one
Migration Pack at a time.
- TDD each pack from the plan: load
test-driven-univer-development, derive
assertions.ts coverage from the plan, and watch the assertion fail for the intended
workbook-visible reason.
- Implement only after the assertion gate exists: edit Migration Packs only after the plan and
plan-derived assertions exist.
- Verify and repair: use
univer sac verify <package.univer> --json and the verify report to drive
repairs before claiming completion.
Do not write the plan before the success criteria checklist.
Do not write assertions.ts before the plan.
Do not edit Migration Packs before plan-derived assertions.
If you already did any step out of order, stop, write the missing success criteria and plan from
current evidence, then restart the TDD loop from that plan.
Hard Gate
Do not treat workbook work as a generic file parsing job. Use the Univer skill stack and univer
CLI as the workbook engine.
- Do not import or install spreadsheet libraries such as
exceljs, xlsx, pandas, or
LibreOffice automation as a substitute for Univer CLI.
- Do not read or patch
.univer package internals.
- Do not parse
.xlsx files directly when the task can be handled through univer import,
univer inspect, univer pipe, univer run, univer export, or SaC workflows.
- Shell tools are fine for text or JSON streams produced by
univer, such as pipe out output or
command JSON. They are not a replacement workbook engine.
- Only consider a non-Univer fallback after the relevant Univer skill has been loaded, the CLI path
is proven insufficient, and the user agrees to the fallback.
Red Flags
These thoughts mean STOP and route through Univer CLI:
| Thought |
Reality |
"This is just an Excel file; I'll use exceljs." |
Workbook files are Univer CLI tasks first. |
| "I only need to inspect a few cells." |
Use univer inspect, search, pipe out, or readonly run. |
| "I'll unzip or patch the workbook package directly." |
Package internals are not the editing surface. |
| "I'll verify with package metadata or command success." |
Verify workbook-visible state. |
| "SaC apply passed, so the behavior is done." |
SaC completion needs test-driven Univer assertion evidence. |
First Moves
- Identify the workbook artifact and target outcome.
- Route to the owning Univer skill before touching workbook content.
- Use path-first
univer commands or SaC source workflows; avoid workbook package internals.
- Verify with workbook-visible evidence before claiming completion.
Route Details
| Task shape |
Load |
| Harness-provided workbook task with its own local contract, prepared package, or required handoff artifact |
Follow the task-local harness contract first, then use univer-cli plus the appropriate workbook or SaC route below |
| Ordinary workbook-visible inspection, search, import, export, pipe, bounded edit, formula review, preview, comments, commit, pull, or sync |
univer-cli |
SaC source authoring, Facade Migration Pack work, assertions.ts, univer sac, or complex workbook behavior development |
writing-univer-plans, executing-univer-plans, then test-driven-univer-development |
| Existing or legacy workbook with no SaC source, where the user wants behavior converted into SaC source |
univer-cli for readonly baseline probes, then writing-univer-plans, executing-univer-plans, and test-driven-univer-development |
Ordinary workbook-visible work should not enter the SaC TDD workflow unless the user asks to author SaC source or durable workbook behavior.
For ordinary workbook-visible tasks, load univer-cli and stay with workbook-visible verification.
SaC TDD Route
For SaC source authoring or complex workbook behavior:
- Load
writing-univer-plans before editing migration source.
- Write or update package-local success criteria under
<package.univer>/project/success-criteria/,
then the plan under <package.univer>/project/plans/.
- Load
executing-univer-plans to review and execute the plan pack-by-pack.
- Load
test-driven-univer-development for assertion coverage, apply/verify, repair,
and handoff gates.
In short: load writing-univer-plans to define success criteria and plan workbook behavior,
executing-univer-plans to execute the plan, and test-driven-univer-development to implement and
verify each pack.
Do not skip writing-univer-plans for complex SaC behavior. The plan is the place where range
roles, pack boundaries, and assertion gates become explicit.
Legacy Workbook Bootstrap
When a user provides a legacy workbook without SaC source, use univer-cli for readonly baseline probes such as inspect, search, pipe out, or readonly run scripts. Capture useful facts into the SaC plan, migration source, or assertions before continuing.
Readonly baseline probes are not completion evidence. SaC TDD completion evidence comes from
test-driven-univer-development: changed packs need assertion coverage and a relevant
passed univer sac verify <package.univer> --json run.
Completion Evidence
- Ordinary workbook work needs workbook-visible verification through
univer-cli, such as
inspect, search, pipe out, bounded run, preview, comments, or export/import checks.
- SaC TDD work needs
test-driven-univer-development evidence: assertion coverage plus
a relevant passed univer sac verify <package.univer> --json run.
- Do not treat command summaries, package metadata,
univer sac apply success, or readonly probes as
final SaC TDD proof.
- If the task type is unclear, ask whether the user wants an ordinary workbook edit or durable SaC
source behavior.
1---2name: using-univer-cli3description: Use when any task involves spreadsheets, workbook files, Excel-compatible files, .xlsx/.csv/.univer packages, sheets, cells, ranges, formulas, charts, formatting, workbook previews, or SaC workbook behavior.4---5
6# Using Univer CLI
7
8This is the entry skill for workbook and spreadsheet tasks. If the task touches workbook files,
9sheets, cells, ranges, formulas, formatting, charts, previews, or SaC workbook behavior, load this
10skill before choosing tools or writing code.
11
12<EXTREMELY-IMPORTANT>
13If there is even a 1% chance the task is about a workbook, spreadsheet, Excel file, sheet, cell,
14range, formula, chart, formatting, preview, or SaC workbook behavior, you MUST use this skill first.
15
16IF THIS SKILL APPLIES, DO NOT CHOOSE A SPREADSHEET LIBRARY FIRST. USE THE UNIVER CLI PATH FIRST.
17</EXTREMELY-IMPORTANT>
18
19## The Rule
20
21Decide the workflow before touching workbook content.
22
23```dot
24digraph using_univer_cli {
25 "Workbook task received" [shape=doublecircle];
26 "Ordinary workbook-visible work?" [shape=diamond];
27 "Load univer-cli" [shape=box];
28 "Use workbook-visible verification" [shape=box];
29 "SaC source or complex behavior?" [shape=diamond];
30 "Load writing-univer-plans" [shape=box];
31 "Success criteria then plan" [shape=box];
32 "Load executing-univer-plans" [shape=box];
33 "Execute the plan" [shape=box];
34 "Load test-driven-univer-development" [shape=box];
35 "TDD each pack from the plan" [shape=box];
36 "Implement only after the assertion gate exists" [shape=box];
37 "Verify and repair" [shape=box];
38
39 "Workbook task received" -> "Ordinary workbook-visible work?";
40 "Ordinary workbook-visible work?" -> "Load univer-cli" [label="yes"];
41 "Load univer-cli" -> "Use workbook-visible verification";
42 "Ordinary workbook-visible work?" -> "SaC source or complex behavior?" [label="no"];
43 "SaC source or complex behavior?" -> "Load writing-univer-plans" [label="yes"];
44 "Load writing-univer-plans" -> "Success criteria then plan";
45 "Success criteria then plan" -> "Load executing-univer-plans";
46 "Load executing-univer-plans" -> "Execute the plan";
47 "Execute the plan" -> "Load test-driven-univer-development";
48 "Load test-driven-univer-development" -> "TDD each pack from the plan";
49 "TDD each pack from the plan" -> "Implement only after the assertion gate exists";
50 "Implement only after the assertion gate exists" -> "Verify and repair";
51}
52```
53
54SaC source authoring MUST follow this order:
55
561. **Success criteria then plan**: load `writing-univer-plans`, write or update
57 `<package.univer>/project/success-criteria/<topic>.md`, inspect enough workbook-visible evidence,
58 and write or update `<package.univer>/project/plans/<topic>.md`.
592. **Execute the plan**: load `executing-univer-plans`, review the plan critically, and execute one
60 Migration Pack at a time.
613. **TDD each pack from the plan**: load `test-driven-univer-development`, derive
62 `assertions.ts` coverage from the plan, and watch the assertion fail for the intended
63 workbook-visible reason.
644. **Implement only after the assertion gate exists**: edit Migration Packs only after the plan and
65 plan-derived assertions exist.
665. **Verify and repair**: use `univer sac verify <package.univer> --json` and the verify report to drive
67 repairs before claiming completion.
68
69Do not write the plan before the success criteria checklist.
70Do not write `assertions.ts` before the plan.
71Do not edit Migration Packs before plan-derived assertions.
72If you already did any step out of order, stop, write the missing success criteria and plan from
73current evidence, then restart the TDD loop from that plan.
74
75## Hard Gate
76
77Do not treat workbook work as a generic file parsing job. Use the Univer skill stack and `univer`
78CLI as the workbook engine.
79
80- Do not import or install spreadsheet libraries such as `exceljs`, `xlsx`, pandas, or
81 LibreOffice automation as a substitute for Univer CLI.
82- Do not read or patch `.univer` package internals.
83- Do not parse `.xlsx` files directly when the task can be handled through `univer import`,
84 `univer inspect`, `univer pipe`, `univer run`, `univer export`, or SaC workflows.
85- Shell tools are fine for text or JSON streams produced by `univer`, such as `pipe out` output or
86 command JSON. They are not a replacement workbook engine.
87- Only consider a non-Univer fallback after the relevant Univer skill has been loaded, the CLI path
88 is proven insufficient, and the user agrees to the fallback.
89
90## Red Flags
91
92These thoughts mean STOP and route through Univer CLI:
93
94| Thought | Reality |
95| --- | --- |
96| "This is just an Excel file; I'll use `exceljs`." | Workbook files are Univer CLI tasks first. |
97| "I only need to inspect a few cells." | Use `univer inspect`, `search`, `pipe out`, or readonly `run`. |
98| "I'll unzip or patch the workbook package directly." | Package internals are not the editing surface. |
99| "I'll verify with package metadata or command success." | Verify workbook-visible state. |
100| "SaC apply passed, so the behavior is done." | SaC completion needs test-driven Univer assertion evidence. |
101
102## First Moves
103
1041. Identify the workbook artifact and target outcome.
1052. Route to the owning Univer skill before touching workbook content.
1063. Use path-first `univer` commands or SaC source workflows; avoid workbook package internals.
1074. Verify with workbook-visible evidence before claiming completion.
108
109## Route Details
110
111| Task shape | Load |
112| --- | --- |
113| Harness-provided workbook task with its own local contract, prepared package, or required handoff artifact | Follow the task-local harness contract first, then use `univer-cli` plus the appropriate workbook or SaC route below |
114| Ordinary workbook-visible inspection, search, import, export, pipe, bounded edit, formula review, preview, comments, commit, pull, or sync | `univer-cli` |
115| SaC source authoring, Facade Migration Pack work, `assertions.ts`, `univer sac`, or complex workbook behavior development | `writing-univer-plans`, `executing-univer-plans`, then `test-driven-univer-development` |
116| Existing or legacy workbook with no SaC source, where the user wants behavior converted into SaC source | `univer-cli` for readonly baseline probes, then `writing-univer-plans`, `executing-univer-plans`, and `test-driven-univer-development` |
117
118Ordinary workbook-visible work should not enter the SaC TDD workflow unless the user asks to author SaC source or durable workbook behavior.
119
120For ordinary workbook-visible tasks, load `univer-cli` and stay with workbook-visible verification.
121
122## SaC TDD Route
123
124For SaC source authoring or complex workbook behavior:
125
1261. Load `writing-univer-plans` before editing migration source.
1272. Write or update package-local success criteria under `<package.univer>/project/success-criteria/`,
128 then the plan under `<package.univer>/project/plans/`.
1293. Load `executing-univer-plans` to review and execute the plan pack-by-pack.
1304. Load `test-driven-univer-development` for assertion coverage, apply/verify, repair,
131 and handoff gates.
132
133In short: load `writing-univer-plans` to define success criteria and plan workbook behavior,
134`executing-univer-plans` to execute the plan, and `test-driven-univer-development` to implement and
135verify each pack.
136
137Do not skip `writing-univer-plans` for complex SaC behavior. The plan is the place where range
138roles, pack boundaries, and assertion gates become explicit.
139
140## Legacy Workbook Bootstrap
141
142When a user provides a legacy workbook without SaC source, use `univer-cli` for readonly baseline probes such as inspect, search, pipe out, or readonly run scripts. Capture useful facts into the SaC plan, migration source, or assertions before continuing.
143
144Readonly baseline probes are not completion evidence. SaC TDD completion evidence comes from
145`test-driven-univer-development`: changed packs need assertion coverage and a relevant
146passed `univer sac verify <package.univer> --json` run.
147
148## Completion Evidence
149
150- Ordinary workbook work needs workbook-visible verification through `univer-cli`, such as
151 `inspect`, `search`, `pipe out`, bounded `run`, preview, comments, or export/import checks.
152- SaC TDD work needs `test-driven-univer-development` evidence: assertion coverage plus
153 a relevant passed `univer sac verify <package.univer> --json` run.
154- Do not treat command summaries, package metadata, `univer sac apply` success, or readonly probes as
155 final SaC TDD proof.
156- If the task type is unclear, ask whether the user wants an ordinary workbook edit or durable SaC
157 source behavior.