Agent skill

Excel Subtotal Audit

by HKUDS in HKUDS/OpenSpace

Audit generated Excel reports by enumerating populated output rows, exposing formulas, and checking that each subtotal range includes all visible detail rows.

MITAuto-check passedDocuments & Office

Install Excel Subtotal Audit

skills CLI
$ npx skills add HKUDS/OpenSpace --skill excel-subtotal-audit -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install HKUDS/OpenSpace excel-subtotal-audit --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/HKUDS/OpenSpace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/benchmarks/gdpval/skills/excel-subtotal-audit .claude/skills/excel-subtotal-audit && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
excel-subtotal-audit
GitHub stars
7.8k
Token cost
~3.5k tokens
SKILL.md length
1,751 words
Files
2
Skills in repo
199
Repo updated
First seen
Licence
MIT

At a glance

Audit generated Excel reports by enumerating populated output rows, exposing formulas, and checking that each subtotal range includes all visible detail rows.

  • Works in 7 steps: Save the workbook, then reopen it for… → Enumerate every populated row in the… → Locate subtotal rows explicitly → …
  • Tasks that involve Excel spreadsheets
  • SKILL.md covers When to use, Goal, Workflow and 1. Save the workbook, then…, plus 21 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Excel Subtotal Audit is an agent skill from HKUDS/OpenSpace. Audit generated Excel reports by enumerating populated output rows, exposing formulas, and checking that each subtotal range includes all visible detail rows.

Its SKILL.md is about 3.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file.

It sits in Documents & Office, covering Excel spreadsheets. It works with Microsoft Excel. The repository describes itself as: "OpenSpace: The Skill Management Layer for AI Agents" -- https://open-space.cloud/. The licence is MIT.

When your agent uses it

  • Tasks that involve Excel spreadsheets

Example prompts

  • “/excel-subtotal-audit”

Requirements

  • Python 3

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Save the workbook, then reopen it for audit
  2. Enumerate every populated row in the output region
  3. Locate subtotal rows explicitly
  4. Independently derive expected detail coverage
  5. Compare expected detail rows to formula references
  6. Fail loudly on any mismatch
  7. Keep the audit output in the execution log

What it can do on your machine

Read from SKILL.md and the folder at commit 3827781. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Excel Subtotal Audit loads about 3.5k tokens when it runs. Until then it costs about 45 tokens; SKILL.md has 1,751 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~45
When it runs · the whole SKILL.md, loaded when a task matches
~3.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from HKUDS/OpenSpace at commit 3827781, republished under its MIT licence (© HKUDS). 1,751 words, ~3,467 tokens.

Download SKILL.mdSave it as .claude/skills/excel-subtotal-audit/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
excel-subtotal-audit
description
Audit generated Excel reports by enumerating populated output rows, exposing formulas, and checking that each subtotal range includes all visible detail rows.

Excel Subtotal Audit

Use this workflow after generating or modifying an Excel report to catch silent spreadsheet defects that simple file-exists or sheet-exists checks will miss.

The core idea is:

  1. Read back the finished workbook.
  2. Print every populated output row, including formulas.
  3. Identify section subtotal rows.
  4. Independently verify that each subtotal formula includes all visible detail rows intended for that section.
  5. Treat any mismatch as a report defect, even if the workbook opens successfully and looks formatted correctly.

This is especially useful for generated financial statements, operational summaries, rollups, grouped exports, and any worksheet where formulas summarize nearby detail rows.

When to use

Use this skill when:

  • You generate Excel workbooks programmatically.
  • The workbook contains subtotal, total, or rollup formulas.
  • Sections may contain blank rows, hidden rows, filtered rows, or varying detail lengths.
  • A mistake in a formula range would produce a plausible but wrong spreadsheet.
  • Basic validation only checks whether the file was created, whether sheets exist, or whether formulas are present.

Goal

Do not stop at "the report was written successfully."

Instead, prove that:

  • every expected output row is present,
  • formulas were written into the intended cells,
  • each subtotal references the correct detail range,
  • no visible detail rows are omitted from the subtotal span.

Workflow

1. Save the workbook, then reopen it for audit

Always audit the workbook after writing it, using a fresh read from disk if possible. This verifies the actual persisted artifact rather than in-memory assumptions.

Checklist:

  • Save workbook.
  • Reopen workbook from disk.
  • Select the target worksheet.
  • Use formula view or raw formulas, not only calculated values.

Why: a writer may have inserted the wrong range, overwritten cells, or shifted rows during formatting.

2. Enumerate every populated row in the output region

Print a row-by-row audit log of all populated rows in the report area.

For each row, print:

  • row number,
  • displayed labels or key identifiers,
  • numeric cells,
  • raw formulas for formula cells,
  • whether the row is hidden, if your library exposes that,
  • any grouping/outline level if relevant.

This creates a human- and machine-inspectable trace of what the generator actually produced.

Minimum row audit format

A useful printed line looks like:

  • Row 12: ["Revenue", 1250, "=SUM(B8:B11)"]
  • Row 13: hidden ["Adjustment", 25, ""]
  • Row 14: ["Total Revenue", "", "=SUM(B8:B13)"]

The exact format does not matter as much as consistency and inclusion of formulas.

What counts as populated

A row is populated if at least one relevant output cell contains:

  • a value,
  • a string label,
  • a formula,
  • formatting that corresponds to a semantic output row you need to validate.

Prefer auditing a defined report column range rather than the entire sheet.

3. Locate subtotal rows explicitly

Identify rows that represent subtotals, totals, or section summaries.

Common signals:

  • a label like "Subtotal", "Total", "Net", "Gross", "Section Total",
  • a formula in a numeric column,
  • bold or styled summary rows,
  • known report structure from the generator.

For each subtotal row, capture:

  • section name or identifier,
  • subtotal row number,
  • subtotal formula text,
  • the expected detail row span according to neighboring visible rows and section boundaries.

Do not assume the formula is correct just because a subtotal row exists.

4. Independently derive expected detail coverage

This is the key step.

For each section, determine which visible detail rows should contribute to the subtotal without using the subtotal formula itself as the source of truth.

Possible ways to derive the expected rows:

  • rows between the section header and the subtotal row,
  • rows until the next section header,
  • rows matching a known indentation or outline level,
  • rows with detail labels but excluding headers and subtotal labels,
  • rows included by the source data mapping used to build the section.

The important rule:

The expected detail set must be computed independently from the formula being checked.

Otherwise, the audit only repeats the original mistake.

Include only visible detail rows when visibility matters

If the report hides rows, collapses groups, or applies filters, inspect whether the subtotal is supposed to summarize:

  • all underlying rows, or
  • only currently visible detail rows.

This skill specifically targets the case where you want to ensure the subtotal includes all visible detail rows in the section.

If your report semantics differ, state them explicitly and audit against those rules.

5. Compare expected detail rows to formula references

Parse each subtotal formula and compare its referenced range against the independently derived detail rows.

Look for defects such as:

  • formula starts too late,
  • formula ends too early,
  • skipped first or last detail row,
  • blank spacer row included instead of a detail row,
  • hidden visible-boundary mistakes,
  • formula copied from another section without updating range,
  • subtotal includes prior section rows,
  • subtotal excludes detail rows added later.
Typical failure pattern

A generated subtotal like:

=SUM(B8:B11)

may look valid, but if the section's visible detail rows are actually 8 through 12, row 12 has been silently omitted.

This is exactly the kind of defect this audit should catch.

6. Fail loudly on any mismatch

If the independently derived detail rows and formula-covered rows do not match, treat it as a generation failure.

Report:

  • sheet name,
  • subtotal row number,
  • subtotal label,
  • formula text,
  • expected contributing rows,
  • actual referenced rows,
  • specific missing or extra rows.

Example failure message:

Subtotal audit failed on sheet "P&L", row 24 ("Total Operating Expenses"): formula =SUM(C18:C22) but visible detail rows are 18-23; missing row 23.

Do not soften these findings into warnings if correctness matters.

7. Keep the audit output in the execution log

Preserve the printed populated-row trace and subtotal comparison results in logs or artifacts.

This helps with:

  • debugging row-shift defects,
  • reviewing generator behavior,
  • comparing versions of a report writer,
  • proving report correctness in automated runs.

Practical procedure

A. Build a row inventory

For the target columns, collect for each row:

  • row index,
  • cell values,
  • cell formulas,
  • hidden status,
  • semantic classification:
    • section header,
    • detail,
    • subtotal,
    • blank/spacer,
    • other.

If classification is ambiguous, use explicit report rules rather than guessing.

Show full SKILL.md (627 more words)Show less

B. For each subtotal row

  1. Find the section it belongs to.
  2. Determine visible detail rows in that section.
  3. Extract rows referenced by the subtotal formula in the subtotal column.
  4. Compare expected vs actual rows.
  5. Emit PASS or FAIL.

C. Review all populated rows manually if needed

Even with automated checks, print the full row trace so a reviewer can spot:

  • duplicated rows,
  • unexpected blank rows,
  • data in wrong section,
  • subtotal formula in wrong column,
  • labels not aligned with formulas.

Implementation guidance

You can implement this in any language with an Excel reader. The audit logic matters more than the library.

Useful capabilities:

  • read cell values,
  • read raw formulas,
  • inspect hidden rows,
  • iterate row-by-row,
  • parse formula references, at least for simple SUM ranges.

If formulas are complex, start by auditing common subtotal patterns first, such as:

  • =SUM(B8:B12)
  • =SUBTOTAL(9,B8:B12)

Then extend as needed.

Example audit logic

Pseudocode:

  1. Open workbook.
  2. For each row in report range:
    • collect values and formulas,
    • print row audit line,
    • classify row.
  3. For each subtotal row:
    • derive expected visible detail rows from section structure,
    • parse formula references,
    • compare expected rows with referenced rows,
    • fail if mismatch.

Example pseudocode

function audit_sheet(sheet): rows = collect_rows(sheet) print_populated_rows(rows)

subtotals = [r for r in rows if r.type == "subtotal"]

for subtotal in subtotals: expected_rows = derive_visible_detail_rows(rows, subtotal.section) actual_rows = rows_referenced_by_formula(subtotal.formula, subtotal.value_column)

  if expected_rows != actual_rows:
      raise Error(
          "Subtotal mismatch at row "
          + subtotal.row_number
          + ": expected "
          + repr(expected_rows)
          + " but formula covers "
          + repr(actual_rows)
      )

Example Python sketch

This example is intentionally generic and should be adapted to your workbook structure.

from openpyxl import load_workbook import re

def is_populated(cells): for cell in cells: if cell.value not in (None, ""): return True return False

def formula_text(cell): return cell.value if isinstance(cell.value, str) and cell.value.startswith("=") else None

def parse_simple_sum_rows(formula, target_col_letter): if not formula: return [] m = re.fullmatch(rf"=SUM({target_col_letter}(\d+):{target_col_letter}(\d+))", formula.replace("$", "")) if not m: return None start, end = map(int, m.groups()) return list(range(start, end + 1))

def audit_sheet(path, sheet_name, start_row, end_row, cols, label_col_idx, value_col_letter): wb = load_workbook(path, data_only=False) ws = wb[sheet_name]

inventory = []
for r in range(start_row, end_row + 1):
    cells = [ws[f"{col}{r}"] for col in cols]
    if not is_populated(cells):
        continue

    hidden = ws.row_dimensions[r].hidden is True
    values = [c.value for c in cells]
    formulas = [formula_text(c) for c in cells]
    print(f"Row {r} hidden={hidden} values={values} formulas={formulas}")

    label = ws[f"{cols[label_col_idx]}{r}"].value
    value_formula = formula_text(ws[f"{value_col_letter}{r}"])

    row_type = "detail"
    label_text = str(label).strip().lower() if label is not None else ""

    if "total" in label_text or "subtotal" in label_text:
        row_type = "subtotal"

    inventory.append({
        "row": r,
        "hidden": hidden,
        "label": label,
        "row_type": row_type,
        "value_formula": value_formula,
    })

current_section = []
for i, row in enumerate(inventory):
    if row["row_type"] != "subtotal":
        current_section.append(row)
        continue

    expected_rows = [x["row"] for x in current_section if x["row_type"] == "detail" and not x["hidden"]]
    actual_rows = parse_simple_sum_rows(row["value_formula"], value_col_letter)

    if actual_rows is None:
        raise ValueError(f"Unsupported formula at row {row['row']}: {row['value_formula']}")

    if expected_rows != actual_rows:
        raise AssertionError(
            f"Subtotal mismatch at row {row['row']} label={row['label']!r}: "
            f"expected visible detail rows {expected_rows}, formula covers {actual_rows}"
        )

    current_section = []

This sketch is deliberately simple. In real use, strengthen row classification and section detection.

Design rules

Never trust generated subtotal formulas without independent verification

A formula can be syntactically valid and still semantically wrong.

Print formulas, not just calculated values

A subtotal value might look plausible even when the range is wrong.

Verify row coverage, not just subtotal existence

Checking "there is a total row" is insufficient.

Use independent section logic

The audit should derive expected detail membership from report structure or source mapping, not from the formula under test.

Prefer deterministic checks over visual inspection

Manual workbook opening can miss subtle omissions.

Keep the audit close to generation

Run it immediately after writing the workbook so defects are caught before delivery.

Common pitfalls

  • Auditing only workbook creation success.
  • Checking formula presence but not range correctness.
  • Comparing displayed totals without checking omitted rows.
  • Ignoring hidden rows when report semantics depend on visibility.
  • Using the generator's intended row list rather than the actual written rows.
  • Parsing only labels and never inspecting formulas.
  • Assuming contiguous sections when blank rows or headers interrupt them.

Minimum acceptance criteria

A generated report passes this skill only if:

  • all populated output rows are enumerated in the audit log,
  • subtotal rows are explicitly identified,
  • each subtotal formula is inspected,
  • expected contributing detail rows are derived independently,
  • every subtotal range is confirmed to include all intended visible detail rows,
  • mismatches fail the run.

Adaptation notes

Adjust the workflow for:

  • multiple subtotal columns,
  • nested section totals,
  • filtered reports using SUBTOTAL,
  • non-contiguous formula references,
  • worksheets with merged labels or outline groups.

Even when full formula parsing is hard, the row-by-row printed audit remains valuable and should still be kept.

Definition of done

The audit is complete when you can answer, for every subtotal row:

  • Which visible detail rows belong to this section?
  • Which rows does the written formula actually reference?
  • Do those sets match exactly?

If not, the report is not verified.

© HKUDS, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in benchmarks/gdpval/skills/excel-subtotal-audit of HKUDS/OpenSpace.

  • SKILL.md
  • .skill_id

Open the folder on GitHubat commit 3827781

Compare with similar skills

Excel Subtotal Audit next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Excel Subtotal Audit compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Excel Subtotal Audit this skillHKUDS/OpenSpace7.8k—~3.5kAutomated safety check: PassMIT
MarkitdownImCa0/just-laws78214 repos~3.2kAutomated safety check: NotesMIT
Data Table Managern8n-io/n8n207k—~2.3kAutomated safety check: PassCustom licence
Docx4jplutext/docx4j2.4k—~2.5kAutomated safety check: PassNone
Instrument Data To Allotropeaws-samples/amazon-bedrock-agents-healthcare-lifesciences2742 repos~2.7kAutomated safety check: PassApache-2.0
Cyber Pptcrazyykhllc-bit/CyberPPT1.8k—~10kAutomated safety check: PassMIT

Similar skills

  • Markitdown

    ImCa0/just-laws

    Convert files and office documents to Markdown. An agent skill from ImCa0/just-laws.

    782 GitHub starsUsed in 14 repos~3.2k tokens
    Documents & OfficeAuto-check: notes
  • Official

    Load before calling data-tables or parse-file. An agent skill from n8n-io/n8n.

    207k GitHub stars~2.3k tokensUpdated today
    Documents & OfficeAuto-check passed
  • Docx4j

    plutext/docx4j

    A skill your agent uses when writing Java code that creates, reads or edits Word (.docx), PowerPoint (.pptx) or Excel (.xlsx) files with docx4j — including generating documents, editing existing…

    2.4k GitHub stars~2.5k tokensUpdated yesterday
    Documents & OfficeAuto-check passed
  • Instrument Data To Allotrope

    aws-samples/amazon-bedrock-agents-healthcare-lifesciences

    Official

    Convert laboratory instrument output files (PDF, CSV, Excel, TXT) to Allotrope Simple Model (ASM) JSON format or flattened 2D CSV.

    274 GitHub starsUsed in 2 repos~2.7k tokens
    Documents & OfficeAuto-check passed
  • Cyber Ppt

    crazyykhllc-bit/CyberPPT

    当用户需要把 DOCX、PDF、TXT、XLSX、研究报告、业务材料或原始数据转成高密度、可编辑、咨询风格 PPTX 时使用;也适用于需要 SCR 论证、视觉风格探索、详细图表和渲染质检的 PPT。

    1.8k GitHub stars~10k tokensUpdated 2 mo ago
    Documents & OfficeAuto-check passed
  • Jev SEO

    AgriciDaniel/jev-seo

    Full live SEO audit of any website from its homepage URL, powered by Jev (TypeSafe's System One model).

    539 GitHub stars~2.5k tokensUpdated 18 days ago
    Documents & OfficeAuto-check: notes

More from HKUDS/OpenSpace

All 199 skills in this repo
  • Walks through producing a master audio track plus stems in Python, from checking a reference file and timing sections by BPM to effects, a zip archive and final verification.

    7.8k GitHub stars~2.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Handle cascading data retrieval tool failures by falling back to embedded knowledge generation

    7.8k GitHub stars~765 tokensUpdated 1 mo ago
    Auto-check passed
  • Gives an agent a workaround when its code-execution sandbox keeps failing: save the Python script to a file and run it through the shell instead.

    7.8k GitHub stars~588 tokensUpdated 1 mo ago
    Auto-check passed
  • A recovery routine for agents whose sandboxed code runner keeps failing: save the Python script to disk, then run it through the shell and read the output.

    7.8k GitHub stars~652 tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback ladder for failed sandboxed code runs, plus the habit of fixing the working directory first so generated files land in the right place.

    7.8k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Fallback workflow for executing Python code when executecodesandbox fails repeatedly

    7.8k GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Questions about Excel Subtotal Audit

What does Excel Subtotal Audit do?

Audit generated Excel reports by enumerating populated output rows, exposing formulas, and checking that each subtotal range includes all visible detail rows. Excel Subtotal Audit is an agent skill from HKUDS/OpenSpace. Audit generated Excel reports by enumerating populated output rows, exposing formulas, and checking that each subtotal range includes all visible detail rows.

When should I use Excel Subtotal Audit?

Excel Subtotal Audit fits situations like: tasks that involve Excel spreadsheets.

How do I install Excel Subtotal Audit in Claude Code?

Run `npx skills add HKUDS/OpenSpace --skill excel-subtotal-audit -a claude-code`. Or copy the skill folder (benchmarks/gdpval/skills/excel-subtotal-audit in HKUDS/OpenSpace) into .claude/skills/excel-subtotal-audit in your project. Claude Code loads it when a task matches its description.

How do I install Excel Subtotal Audit in Codex?

Run `npx skills add HKUDS/OpenSpace --skill excel-subtotal-audit -a codex`. Or copy the skill folder (benchmarks/gdpval/skills/excel-subtotal-audit in HKUDS/OpenSpace) into .agents/skills/excel-subtotal-audit in your project. Codex loads it when a task matches its description.

Can I use Excel Subtotal Audit in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add HKUDS/OpenSpace --skill excel-subtotal-audit -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/excel-subtotal-audit, .gemini/skills/excel-subtotal-audit, .github/skills/excel-subtotal-audit and .opencode/skills/excel-subtotal-audit in your project.

What does Excel Subtotal Audit need to run?

SKILL.md names no scripts, command-line tools or credentials: Excel Subtotal Audit is instructions for the agent only. Our summary lists: Python 3.

Does Excel Subtotal Audit access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Excel Subtotal Audit safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Excel Subtotal Audit use?

Excel Subtotal Audit is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Excel Subtotal Audit use?

About 3.5k tokens (SKILL.md is roughly 14k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Excel Subtotal Audit?

Skills that share tags, products or a category with Excel Subtotal Audit: Markitdown (ImCa0/just-laws, 782 stars), Data Table Manager (n8n-io/n8n, 207k stars), Docx4j (plutext/docx4j, 2.4k stars) and Instrument Data To Allotrope (aws-samples/amazon-bedrock-agents-healthcare-lifesciences, 274 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Excel Subtotal Audit?

HKUDS (a GitHub organization) maintains it in HKUDS/OpenSpace, which has 7,750 GitHub stars. The repository holds 199 skills in this directory. The repository was last updated on August 12, 2026.

Source: HKUDS/OpenSpace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.