/daloopa-investing:fix-debug-audit [RANGE] [instructions]from daloopa-investing
Diagnoses and fixes issues in existing Excel financial models — balance breaks, audit findings, restatements, and targeted edits. Localizes problems without rebuilding the model.
Ships in daloopa-investing. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Diagnose an existing, user-built Excel model as requested by the user: $ARGUMENTS
Before starting, read ../data-access.md for data access methods, ../modeling-conventions.md for how to read the user's conventions and the linkage a model should follow, and references/model-checks.md (in this skill's directory) for the integrity checks and how to read a failure.
The deliverable is a finding (and, when asked, a fix) — not a new model. You are handed an unknown workbook and must localize the problem, not re-derive the model.
Both inputs are optional. Everything else is detected (Step 0).
| Input | Form | Default |
|---|---|---|
RANGE | Sheet!A1:Z99, 'My Sheet'!B10:M80, or a sheet name | The main model sheet's used range — or, for a balance break, the rows around the off check |
instructions | Free text after the range | Audit, report only |
Examples: /fix-debug-audit · /fix-debug-audit Model!B10:M80 fix it · /fix-debug-audit why doesn't the balance sheet balance? · /fix-debug-audit IS!C5:N60 convert INR crore to million
A workbook path (.xlsx/.xlsm) in the instructions overrides workbook detection. A ticker in the instructions overrides ticker detection.
Workbook. A path in $ARGUMENTS; otherwise the most recently modified .xlsx/.xlsm in reports/, then the working directory — skipping files this toolkit generated (names ending _audit_YYYYMMDD, _port_YYYYMMDD, _model, _comp_sheet). If none is found, ask for the path.
Sheets. python infra/workbook_tools.py tabs WORKBOOK. The main model sheet is the one named in the range, else the sheet with the most formula cells. If tabs returns a warning (charts, pivots, external links), carry it into the reply.
Task — inferred from the instructions; exactly one of:
| Task | Triggered by | Section |
|---|---|---|
balance-break | "doesn't balance", "doesn't tie", "check is off", "balance check" | Task A |
restatement | "restated", "resegmented", "recast", "new segment structure" | Task C |
edit | a concrete transformation: convert units, re-base, wrap in IFERROR, flip signs, rename labels | Task D |
audit | everything else ("audit", "review", "check", "find errors", nothing at all) | Task B |
A balance break found during an audit is localized with Task A as part of the audit.
Fix or report. Fix only when the instructions ask for it ("fix", "correct", "repair", or any edit task). "Don't change anything" / "just review" means report only — write nothing. Default: report only. Fixes always go to a copy, never the original.
Ticker (needed for the source check and restatements). In order: a ticker in the instructions → Daloopa links in the sheet (daloopa_id from read, resolved in Task B) → the file or tab name → a company name in the sheet's header rows. Confirm with discover_companies. If none resolves and the task needs one, ask.
Announce in one line before any analysis, e.g.:
Workbook
HGV_model.xlsx· sheetModel· rangeB10:M80· task: audit · mode: fix (writes to a copy) · ticker HGV
Report-only: continue immediately. Fix mode: wait for the user to confirm the line before writing anything.
python infra/workbook_tools.py read WORKBOOK "Sheet!RANGE" on the audited range, plus the same rows' neighbouring columns and the header rows that name each column's period. It returns, per cell: kind (formula / input / text), formula and cached value, number format, font, fill, link, and daloopa_id when the cell links to daloopa.com/src/{id}.python infra/workbook_tools.py refs WORKBOOK "Sheet!RANGE", then read only what those formulas reference — never the whole workbook.cached is the last value Excel calculated. It is null for a file last saved by a script; note that instead of treating it as zero.../modeling-conventions.md Section 2).When the balance check (or any tie) is off, localize it rather than re-deriving the model:
references/model-checks.md:
references/model-checks.md before a systematic pass.refs, then read) to the offending input. Never plug the difference — report the broken link and its fix.Run the checks below on every cell of the range before writing anything. In fix mode, fix what they find in that range only, in this order. A cell that passes every check stays as it is.
format change. Never re-apply what already matches, and never use copy_format_from for an audit fix — it brings every attribute of the source, including link styling or a column highlight the cell never had.Also look for:
#REF!/#VALUE!/#DIV/0!/#NAME?, broken cross-sheet references, links to other workbooks.Check every remaining typed number in a reported (actual) column of the range against Daloopa. Estimate and forecast columns, and formula cells, are not checked.
discover_companies(keywords=["TICKER"]) → company_id, latest_calendar_quarter, latest_fiscal_quarter. Map each audited column header to a calendar quarter using the fiscal↔calendar offset between those two fields (../data-access.md Section 1.5 — the API takes calendar quarters only).discover_company_series(company_id, keywords=[every audited row label, plus parenthetical and singular/plural variants], calendar_periods=[...]). Take a series only where it matches a label unambiguously (../modeling-conventions.md Section 3).get_company_fundamentals(company_id, calendar_periods=[audited periods], series_ids=[every candidate series]).daloopa_id, the series is the one whose returned datapoint id equals it. If no fetched datapoint matches, the row is "not checked — link not resolved", never guessed. Unlinked rows use the label match from step 2; a row with no match is "not checked — no series".value change — keep the format, and add no link unless the cell already had one (an existing link is kept automatically). Never fix by copying a neighbour, back-solving from a total, changing the total, or changing a formula to make a total tie.When the company restated (resegmentation, asset sale, new segment structure), prior periods must be recast:
search_documents over the recent 2-4 quarters (calendar_quarters), one call per term — "restated", "recast", "segment" — since keywords in a single call are ANDed, and pull the restated series with discover_company_series + get_company_fundamentals.Apply precisely to the requested range only — these are the requests most likely to damage neighbouring work if the range creeps.
=IFERROR(<existing formula>, ""), or 0 where the row feeds a sum.reports/.tmp/{workbook_stem}_audit_changes.json — a JSON array, one entry per change ({"cell": "Model!C14", "value": 1234.5}, {"cell": "Model!F30", "formula": "=F28-F29"}, {"cell": "Model!F30", "format": {"font_color": "FF000000"}}). The full schema is in the docstring of infra/workbook_tools.py.python infra/workbook_tools.py apply WORKBOOK reports/.tmp/{stem}_audit_changes.json --label audit — saves reports/{stem}_audit_{YYYYMMDD}.xlsx. The original is never touched. For follow-up passes on that copy, use --in-place.apply returns a warning, include it in the reply.Always, in fix mode or not:
python infra/workbook_tools.py recalc reports/{stem}_audit_{YYYYMMDD}.xlsx --cells "Model!F95:M95" for those check cells.
recalculated: true → compare with your expected values. A mismatch means a fix was wrong or a link was missed — investigate before reporting.recalculated: false (LibreOffice not installed) → say the values recalculate when the file is opened in Excel, and that the user should confirm the expected values there.Reply in the terminal with:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub daloopa/investing2 --plugin daloopa-investing42 skills in this plugin
/activismActivist vulnerability assessment — performance gaps, likely activist playbook, and defense analysis/bomInteractive product bill-of-materials dashboard with an exploded view, mapping components, suppliers, unit costs, and gross margin sensitivity/build-modelBuild a multi-tab Excel financial model/bull-bearBull/bear/base case scenario framework for a given company/buyer-universePotential acquirer screen with capacity to pay, strategic fit, and likelihood tiers/call-diffQuarter-over-quarter diff of management language, disclosures, and tone, cross-checked against the numbers