{"id":88067,"plugin_id":"plugin_asdk_app_6abcebba386c81918f046d4b6af3c4d0","kind":"skill","collection_source":"plugin_package","comparison_source":null,"observed_at":"2026-11-10T00:09:03.676Z","digest":"f691c61bc375fcadbdf51298aa2847c91bc55a94701ec59af2ea8b1d0cb05cf6","against":null,"payload":{"description":"Review and fix a Layerz model: a check fails, the balance sheet does not balance, \"the numbers are wrong\", a model is not computable, verify that a refactor changed nothing, compare two versions or an imported model with its source workbook, undo or restore, \"what changed since yesterday\". Reads health by branch, finds the cycle or the typed number, previews a patch before applying it, and uses history, diff and versions to prove or undo a change.","included_files":[{"relative_path":"references/10-checks-health-and-broken-dags.md","size_in_bytes":1267},{"relative_path":"references/11-versions.md","size_in_bytes":1139}],"name":"review-and-fix","skill_md_contents":"---\nname: review-and-fix\ndescription: \"Review and fix a Layerz model: a check fails, the balance sheet does not balance, \\\"the numbers are wrong\\\", a model is not computable, verify that a refactor changed nothing, compare two versions or an imported model with its source workbook, undo or restore, \\\"what changed since yesterday\\\". Reads health by branch, finds the cycle or the typed number, previews a patch before applying it, and uses history, diff and versions to prove or undo a change.\"\nlicense: MIT\nmetadata:\n  layerz_version: \"1.1.0\"\n  generated_by: \"layerzlabs/layerz scripts/build-plugin-skills.ts, from the modeling guide\"\n---\n\n# Layerz: Review and fix\n\n**Instruction priority.** Explicit instructions from the user in the conversation come first. Then the model's FINANCE.md and the workspace conventions: both come back as `conventions` in the results of `layerz_get_model`, `layerz_create_model`, `layerz_build_from_blueprint`, an unfiltered `layerz_read` and `layerz_get_conventions`. They describe this workspace and this model (currency, units, signs, depth, structure, who reads it) and override the defaults below. Your own skills and instructions keep their priority on how you work. This skill describes how the Layerz tools work and in which order; it states no fact about any business.\n\n## When this applies\n\nA check fails, the balance sheet does not balance, \"the numbers are wrong\", `computable: false`, verify that a refactor changed nothing, compare two versions, undo, restore, \"what changed\".\n\n## Sequence\n\n1. `layerz_read { model_id, health: true }` (add `branch_id` to judge the branch the user looks at; `health.by_branch` on a multi-branch model). Each violation names the line and the periods.\n2. `computable: false` or `health.status: \"unknown\"`: `layerz_validate_model` returns the cycle or the broken reference path. Fix the graph before reasoning on any value; every series is zero-filled until then.\n3. A failing check: read the line and its sources (`layerz_dependencies { uid }`), look for the typed number, the wrong sign, the missing callup (a `balance` without callup children stays flat), the formula that sums a stock. Fix with `layerz_patch` (`replace` keeps the UID and the presentation), then read health again.\n4. Before a structural change on a working model: `layerz_patch { dry_run: true, compare_values: true }` previews the cells that move on checks, totals and the `uids` named. A refactor is neutral when nothing moves.\n5. What changed: `layerz_history { model_id, uid }` (one item's changes, or the versions without `uid`) and `layerz_diff { from, to, values: true }` (omit `to` for the live model). On an imported model, `layerz_diff { model_id, source: { set, refs } }` (top level, in place of `from`) compares the live model with its source workbook as Layerz recalculates it: per line, `first_gaps` and `summary.score`; `set` overrides cells (`\"Sheet!C6\": 0.4`) to compare a scenario.\n6. Undo: `layerz_manage_version { op: \"restore\", version }` after reading the history and the diff (the live state is backed up first); `op: \"pin\"` keeps a version past the retention window. A patch retried after a timeout re-applies its `create` ops: read the history first.\n7. Report in words: what was wrong, what was changed, what the checks say now.\n\nFinance judgement (is the plan credible, what to challenge, what a lender looks at) is not in this plugin: the Layerz cookbook (github.com/layerzlabs/cookbook) has skills for that, which the user installs and adapts.\n\n## References\n\nFrom the Layerz modeling guide (version 1.1.0; the whole guide: `layerz_get_conventions { include_guide: true }` or the `modeling-guide://reference` resource):\n\n- [10. Checks, health and broken DAGs](references/10-checks-health-and-broken-dags.md)\n- [11. Versions](references/11-versions.md)\n"},"changes":[],"summary":"First saved snapshot. No earlier version is available for comparison.","summary_kind":"deterministic","summary_metadata":{}}