Spreadsheets
Handle tabular data with exact values, minimal diffs, local privacy, atomic writes, and structural validation.
Invariants
- Keep precision-sensitive amounts as strings and compute with or DuckDB , never
binary floats.
- Touch only requested rows, columns, formulas, and formatting. Existing file conventions override house defaults.
- For newly authored text tables, prefer TSV, UTF-8 without BOM, LF, one trailing newline, lowercase
headers, ISO dates, decimals, and nulls.
- Read unknown text tables with BOM-tolerant UTF-8; never write a BOM.
- Write in place atomically through a sibling temporary file, validate it, then replace the target.
- Escape external cells beginning with , , or ; a bare null is exempt. Formula-prefix cells in trusted
authored data are observations, not proof of injection.
- Keep transaction, bank, exchange, and tax data local. Redact samples unless raw rows were explicitly requested.
Factual Profiling
Resolve helper paths from this
. Profile unknown data before choosing a transformation tool:
sh
uv run "<skill-dir>/scripts/profile.py" <file> --redact-samples
The JSON output has
. It reports structural facts, header quality, cardinality/statistics when qsv is
available, frequency facts, formula-prefix cells, workbook metadata, and local tool availability. It contains no tool
recommendations and does not infer identifiers from uniqueness. Choose the tool from the requested transformation,
provenance, output format, and preservation requirements.
Use
only when the cells came from an external or otherwise untrusted source and will be written to a
formula-capable consumer. With that flag, formula-prefix cells affect
; without it, legitimate formulas such as
remain factual observations and do not fail the profile.
Tool Routing
| Need | Tool |
|---|
| Fast structural preview/validation | uv run scripts/peek.py <file> --redact-samples
|
| Factual local quality profile | uv run scripts/profile.py <file> --redact-samples
|
| Counts, stats, frequencies, select, dedupe | |
| Joins, pivots, aggregation, conversion | DuckDB with |
| Exact custom transforms | Python, stdlib , |
| Any / input or output | Read first |
| Exact transformation/validation recipes | Read only when needed |
Prefer
where supported. When qsv stdout must remain TSV, use
; stdout otherwise
defaults to CSV.
Workflow
- Inspect with ; add when cardinality, formula prefixes, metadata, or available
tooling matters. For a no-shape-change edit, save the peek JSON. For intentional row/schema changes, record the
expected width and invariants.
- Decide whether formula-prefix cells are dangerous from provenance and output context. Decide the smallest tool that
preserves values and formatting. Avoid pandas unless necessary; if used, load every column as strings.
- Apply the transformation atomically. For idempotent appends with legitimate duplicate rows, use multiset difference
rather than set deduplication.
- Validate:
- unchanged shape:
peek.py --strict --expect-like <before-report>
;
- changed shape:
peek.py --strict --expect-columns <n>
plus task-specific counts/keys;
- authored house TSV: add ;
- formulas:
uv run scripts/recalc.py <file.xlsx>
and require success.
- Report paths, row/column effects, validation, and any workbook features that could not be preserved.
For human output, lead with
### 📊 Spreadsheet — ✅ updated
only after the write and required validation pass, or
### 📊 Spreadsheet — 🔎 inspected, no files written
for read-only work. On required validation failure, use
### 📊 Spreadsheet — ⛔ not deliverable
. Do not paste private profile JSON or decorate cells, headers, formulas,
paths, commands, or diagnostics.
prb-finance
Never hand-edit generated
,
, or Markdown reports. After source edits, run
,
then
. Cap private output to counts and file references unless raw rows were requested.
Completion requires the requested artifact, an intentional diff, atomic replacement where applicable, and structural
plus domain validation evidence.