{"data":{"slug":"discovered-cad26cd5327414654fc32b5868b7fce563eacf04c089c51a","title":"Hmml Extract","summary":"Generate a concise .hmml review delta from a branch's diff, showing changes to units, data, and tests for pre-merge review.","url":"https:\/\/skillshunter.net\/skills\/discovered-cad26cd5327414654fc32b5868b7fce563eacf04c089c51a","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-cad26cd5327414654fc32b5868b7fce563eacf04c089c51a","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-cad26cd5327414654fc32b5868b7fce563eacf04c089c51a.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-cad26cd5327414654fc32b5868b7fce563eacf04c089c51a\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before running, ensure the HMML grammar, `hobby-mml-parser`, `tree-extract`, and `lsp-mcp` dependencies are installed. The file is derived from the diff and rewritten on every run, so do not commit changes to the notes repo.","instructions":"---\ndescription: Read a branch's diff back as one concise .hmml review delta \u2014 the touched units' behaviour walks (systems with their schedule, observers with their event) with every changed step marked +\/-\/~ and linked to the diff, the data (with ECS roles) and public signatures it touches, and its tests in summary \u2014 for reading before merge\nargument-hint: '[--against <ref>] [<checkout>]'\nallowed-tools: Read, Grep, Glob, Write, Bash(ls:*), Bash(pwd:*), Bash(rg:*), Bash(wc:*), Bash(sed -n:*), Bash(rm -f:*), Bash(hobby-mml-parser:*), Bash(git -C * rev-parse:*), Bash(git rev-parse:*), Bash(git -C * diff:*), Bash(git -C * show:*), Bash(git -C * log:*), Bash(git -C * merge-base:*), Bash(git -C * branch:*), Bash(git -C * grep:*), Bash(git -C * remote:*), Bash(git -C * status:*), Bash(git -C * ls-files:*), Bash(gh pr view:*), mcp__tree-extract__list_modules, mcp__tree-extract__get_neighbors, mcp__tree-extract__call_path, mcp__tree-extract__impact_of, mcp__tree-extract__get_symbol, mcp__tree-extract__search_symbols, mcp__lsp-mcp__document_symbol, mcp__lsp-mcp__find_references, mcp__lsp-mcp__goto_definition, mcp__lsp-mcp__hover\n---\n\nRead one branch's diff back as a **review delta**: a single `.hmml` file that\ntells what the PR changes at the altitude I would narrate it to a colleague,\nwith every changed line pointing at the place in the diff that makes it. I read\nthe delta first and the hunks second.\n\nThe grammar is `~\/fun_repos\/hobby-tooling\/lsps\/hobby-mml-lsp\/grammar.md`\n(HMML v3). Read it before the first write in a session; the rules below assume\nit.\n\nThe delta is **derived, never maintained**. Every run rewrites the file from the\ndiff, without asking. Nothing is carried over from an earlier run.\n\n**The budget is the reader.** The delta exists because a diff is too big to hold\nin your head. The limits:\n\n- **A unit walk has at most 25 lines**, counting every step line at every depth\n  and leaving out `invariants:`. A walk over 25 is **lifted** until it fits:\n  - Merge sibling steps that serve one decision into one step, the way a person\n    would tell it. For example, \"if the purse is short, the item is sold out or\n    the shop is closed: shake the button\" replaces one `if` per case.\n  - Fold a step's nested detail into the step itself when the detail is not what\n    changed.\n  - A lifted step keeps the gutter of what it merged: `+` when all of it is new,\n    `~` or a `-`\/`+` pair when old and new are mixed. It also keeps one diff\n    link, to the first hunk.\n  - Never drop context steps to save lines; they are what the change is read\n    against.\n  - Never fold a scope, ordering, failure or persistence invariant into a step\n    (grammar \u00a77). Invariants do not count against the 25 lines.\n- **`## api`** holds only the signatures the grammar's \u00a79 lists.\n- **`## tests`** is a handful of grouped lines.\n\nWhen more units are touched than fit, keep the ones whose behaviour a player or\na caller sees, and report the rest.\n\n## Instructions\n\n01. **Pin down the change.**\n\n    - **Checkout**: the argument, else the current directory when it is a task\n      worktree (`~\/fun_worktrees\/{project}\/{topic}\/{task}`) or an aspect\n      worktree (`~\/fun_aspects\/{project}\/{topic}\/{task}\/{aspect}`). Never\n      `~\/fun_repos\/<repo>`.\n    - **`head`**: `worktree` when `git -C <checkout> status --porcelain` lists\n      anything \u2014 the change, or part of it, is not committed yet, which is how\n      `\/task:build` calls this skill. Otherwise\n      `git -C <checkout> rev-parse --short=10 HEAD`.\n    - **`branch`**: the checked-out branch.\n    - **`base`**: `--against <ref>` resolved to a commit, else\n      `git merge-base origin\/<default branch> HEAD`.\n    - **`pr`**: `gh pr view <branch> --json url,title,body`, run in the\n      checkout. Leave `pr` out when there is no PR yet.\n    - **`repo`**: `{project}`, the first path component under `~\/fun_worktrees`\n      or `~\/fun_aspects`.\n    - **Output**: the notes dir of the checkout,\n      `~\/fun_repos\/hobby-mimisbrunnr\/notes\/{project}\/{topic}\/{task}\/delta-<branch>.hmml`\n      for a task worktree and\n      `~\/fun_repos\/hobby-mimisbrunnr\/notes\/{project}\/{topic}\/{task}\/aspects\/{aspect}\/delta-<branch>.hmml`\n      for an aspect's, with `\/` in the branch replaced by `-`. When the file\n      exists, `rm -f` it without reading it; the Write tool would otherwise ask\n      you to read it first. Leave any older `<unit>.hmml` specs in the dir\n      alone: they are v2 notes, not inputs.\n    - **Linter**: `hobby-mml-parser --version` must print `hobby-mml-parser 3.`.\n      If it prints anything else, or the command is missing, it is the v2 linter\n      or none: `just -f ~\/fun_repos\/hobby-tooling\/justfile install-mml`.\n\n02. **Read the diff.**\n\n    - With a commit `head`: `git -C <checkout> diff --stat <base>...HEAD`,\n      then the full diff.\n    - With `head: worktree`: `git -C <checkout> diff --stat <base>` and the\n      full `git -C <checkout> diff <base>`, which cover committed and\n      uncommitted changes alike, plus every file\n      `git -C <checkout> ls-files --others --exclude-standard` lists, read\n      whole: an untracked file is new and no `git diff` shows it.\n    - Sort the changed files into three groups: source, tests, and the rest\n      (assets, config, shaders, docs, build).\n    - The rest shows up only through what it does to a unit. An asset, RON\n      table or shader change that changes behaviour becomes a step (grammar \u00a77).\n    - Note every changed file no line of the delta will cover, for the report.\n\n03. **Find the units** (grammar \u00a77).\n\n    - In a Bevy app a unit is what the `App` runs: a system (find its\n      `add_systems(<Schedule>, \u2026)` call), an observer (`add_observer` or\n      `.observe`, taking `On<E>`), or a `Plugin::build` whose registration\n      changes beyond the systems it adds. Walk up from the changed functions'\n      callers with `rg` until you reach one.\n    - A non-Bevy crate (a CLI, an LSP) keeps the classic entry points: a\n      command, a request handler, a queue consumer.\n    - `tree-extract` (`impact_of` \/ `call_path`) helps only when the checkout\n      already has a `.project-graph.json`. Never build one: `build_graph` writes\n      an untracked file into the checkout.\n    - `find_references` from `lsp-mcp` resolves where rust-analyzer is set up.\n    - Say in the report which way you went.\n    - Stop at the first entry point on each path, unless a collaborator's output\n      has a different consumer. Then it is a unit of its own.\n    - Name and order the units as \u00a77 says. A system unit writes\n      `in <Schedule>` and an observer `on <Event>` (\u00a77.1), read off the\n      registration as `head` leaves it.\n\n04. **Write each unit's walk as HEAD leaves it.** Read the system or observer\n    and its collaborators, and write the whole walk at mental-model altitude.\n\n    - Each step is a decision or an action a player or caller would notice.\n    - A step naming a local variable, a `Query` parameter or a language\n      construct is too low.\n    - A step that could describe ten implementations is too high.\n    - What a system reads and writes is told through its steps (\"credit the\n      bounty to the Purse\"), not listed.\n    - Unchanged steps stay as context (gutter ` `).\n\n05. **Mark the change from the diff, not from intent.** For every step, ask\n    whether the diff touches the code behind it:\n\n    - **The behaviour is new:** `+`, and so is everything nested under it.\n    - **The behaviour is gone:** `-`, written as it was at `base`\n      (`git show <base>:<path>`). Place it where it used to sit relative to its\n      surviving neighbours. Everything nested under it is `-` as well.\n    - **One clause changed:** a `~` line,\n      `<shared words> <old clause> \u2192 <new clause>`.\n      - Cut each side down to what differs.\n      - When the shared words would only come after the change, rephrase the\n        step so they lead.\n      - When the change only adds a clause, write the new side as\n        `\u2026 <added clause>`.\n      - When more than one clause changed, write a `-` line and a `+` line.\n    - **The step only moved:** context, at its `head` position (grammar \u00a77).\n    - **When it runs changed** \u2014 a new schedule, run condition or ordering\n      constraint on the registration: a step at the top of the walk linked to\n      the `add_systems` line (\u00a77.1).\n    - **Untouched:** context. A refactor that leaves the behaviour as it was is\n      context too; that is the point of the altitude.\n\n    Every `+`, `-` and `~` step gets a diff link, `@ <file>:<line>`.\n\n    - Use the shortest path suffix that names one file, usually the file name.\n      In a Bevy repo `mod.rs` and `plugin.rs` repeat, so these need their\n      directory: `waves\/mod.rs`.\n    - Use the first line of the expression that decides the behaviour: the\n      `head` side (the file on disk, for `head: worktree`), or the `base` side\n      for a `-`.\n    - A changed step without a link is a defect, because the link is what lets\n      me jump from the step to its hunk.\n\n    Then write the unit's `invariants:`. Read them off the code (a cap, an\n    ordering, a scope, an idempotency rule), not off intuition. Mark each one by\n    whether it holds at `base` and at `head`, including one whose truth changed\n    while the code behind it did not. An invariant that holds at both sides is\n    context, whatever enforces it now (grammar \u00a77).\n\n    Look for these in particular, and write every one the PR adds or changes:\n\n    - **scope:** which entities a query can reach, e.g. \"only enemies inside the\n      arena take splash damage\";\n    - **ordering:** what runs before what, e.g. \"the bounty is paid before the\n      enemy is despawned\";\n    - **failure:** what an error or a missing entity leaves behind;\n    - **persistence:** what outlives a state change or a despawn, and where.\n\n06. **`## data`** (grammar \u00a76). Fill it in after `## api`, though it stays\n    before the units in the file. List a type only when a unit step or an\n    `## api` signature of this delta names it, and one of these holds:\n\n    - its shape changed;\n    - the PR added or removed it;\n    - the reader needs its shape to follow a changed step.\n\n    - Give it its role off the derive (\u00a76.1): `#[derive(Component)]` \u2192\n      `component`, `Resource` \u2192 `resource`, `Event`\/`EntityEvent` \u2192 `event`,\n      `Message` \u2192 `message`, `States`\/`SubStates` \u2192 `state`, anything else none.\n    - A marker (`struct Boss;`) is `component struct Boss {}`.\n    - Write struct fields as context or marked lines, so a changed field reads\n      in place. Field names are written as the code writes them.\n    - Translate types into the subset: `&str`\/`String\u2192String`, `usize\u2192u64`,\n      `isize\u2192i64`, `HashMap<K,V>\/BTreeMap\u2192Map<K, V>`, `HashSet\u2192Set<T>`,\n      `(A, B)\u2192Tuple<A, B>`, `Box<T>`\/`Arc<T>`\/`&T\u2192T`, `Handle<T>` as written.\n      Bevy's `Entity Vec2 Vec3 Quat Color Timer Duration` stay as they are.\n    - Never list Bevy's own types (`Transform`, `Time`, `Children`, \u2026).\n\n07. **`## api`** (grammar \u00a79). Collect the public functions the unit steps do\n    their work in. End each such step with `@ api Module::fn`, listing several\n    functions with commas when the work spans them. Then add:\n\n    - every public function that exists at `base` and that the PR removes or\n      whose signature it changes, and every function the PR makes public or\n      private (`+` \/ `-`);\n    - a module line for each module the PR adds, even when none of its functions\n      is linked.\n\n    Leave out systems and observers (they are units), a function the PR adds\n    that no step links to, private helpers, constructors, and `Plugin` \/\n    `FromWorld` impls. Write signatures faithful to the code without the\n    receiver, with `@ <file>:<line>`.\n\n    - **Modules** are as grammar \u00a79 defines them: a Rust module, or a type with\n      an `impl`. A resource with methods is its own module.\n    - **A changed signature** is a `-`\/`+` pair, unless only its tail changed,\n      such as the return type.\n\n08. **`## tests`: a summary** (grammar \u00a710).\n\n    - Take the changed test files and `#[cfg(test)]` modules from the diff.\n    - Group the tests that change together for one reason into one\n      `tests <N> \u2014 <why>` line. N counts `#[test]` functions as written in the\n      source.\n    - Give a test its own `test <name> \u2014 \u2026` line only when it is the sole guard\n      of a changed step, or when its change needs saying on its own.\n    - Removed tests are `-` lines, and a reworked test is a `~` line.\n    - Every test line links to the first test it covers. A group whose tests sit\n      in several files is one line per file.\n    - When a line tests a changed step or invariant, put `^anchor` on that step\n      or invariant (snake_case, named after the behaviour). List the anchor in\n      the test line's `@ guards`.\n    - Anchor only lines a test points at, and leave unchanged tests out.\n\n09. **`## intent`.** One to three lines saying what the PR sets out to do for\n    the player or caller.\n\n    - Read it from the PR title and body, the commits, the task's `issue.md`,\n      and the done-when in `build-task.json` when there is one.\n    - Write it last, once the walks show what the change does.\n    - Where the stated intent and the diff disagree, the walks follow the diff,\n      and the report says so.\n\n10. **Write and lint.** Write the file (header, then sections in grammar order)\n    and run `hobby-mml-parser <path> --lint`. Fix every error and warning.\n    `unresolved-diff-link` means the suffix is ambiguous or the line is wrong:\n    find the real one, never drop the link.\n\n11. **Report and stop.** Report:\n\n    - the path and the line count;\n    - per unit, its trigger, its walk's line count and its `+`\/`-`\/`~` lines\n      (steps and invariants separately, every marked line counted);\n    - the `## data`, `## api` and `## tests` counts;\n    - how the units were found (`tree-extract`, `lsp-mcp`, or `rg`);\n    - the units left out for budget, and the units you lifted;\n    - every changed file no line of the delta covers, and why: no behaviour,\n      docs only, or build only;\n    - any disagreement between the stated intent and the diff.\n\n    Do not iterate on the file, and never `git add` or `git commit` in the notes\n    repo.\n","use_cases":["Generate a review delta for a branch before merging","Analyze changes to units, data, and tests in a diff","Create a structured HMML file for documentation and review"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/julianbieber\/hobby-tooling\/blob\/420f1f68d0f92201d2a7a51a0c463784e1e49405\/skills\/hmml-extract\/skill.md","source_commit":"420f1f68d0f92201d2a7a51a0c463784e1e49405","license":null,"version":null,"listing_approved_at":"2026-11-30","created_at":"2026-11-29T11:13:16.000000Z","updated_at":"2026-11-30T06:52:26.000000Z","seo_title":"Hmml Extract - Generate HMML Review Deltas from Git Diffs","seo_description":"Extract a branch's diff into a structured .hmml review delta, highlighting changes to units, data, and tests for pre-merge review.","seo_keywords":["hmml extract","git diff to hmml","review delta","hobby-mml-parser","pre-merge review","unit behavior analysis"]}}