Skip to content

gave explanation pages a fixed structure and sized the quiz to the change - #22

Open
malav2110 wants to merge 6 commits into
issue-4-two-modesfrom
issue-4-length-rules
Open

malav2110 wants to merge 6 commits into
issue-4-two-modesfrom
issue-4-length-rules

Conversation

@malav2110

@malav2110 malav2110 commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Part of #4. Every page now has a one-sentence lead, a heading per core edit, an "Also changed" table, and a quiz sized to the change. Six of the nine regenerated samples came out shorter, and three came out longer.

Before merge

What a page looks like now

The skill writes the lead first: the page's purpose in one sentence. Then it sorts every changed file into one of three groups:

  • Core: an edit that carries the change's purpose. It gets its own heading, an h3.core-step, in the Code walkthrough.
  • Brief: an edit the reader needs that carries none of the purpose. It gets a sentence or two inside its core step, or a short paragraph and a snippet when a quiz question depends on it.
  • Table: every other file, one row each in the "Also changed" table.

For a change over 2,000 changed lines, the skill groups the core edits by theme. Each theme becomes the h3.core-step, and each core edit inside it an h4.core-edit.

The quiz has three questions when the page has at most two core steps, and five otherwise. On a themed page the same cutoff applies to its core edits. When a change has too few testable decisions for that count, the page asks fewer questions and says why.

Background covers only what the core edits need, and runs no longer than the Code walkthrough. When Background has to run longer, the skill's closing report to the user says by how much and why.

Validator checks

This PR adds its checks to src/validate-output.ts, the TypeScript validator that replaced validate-output.sh on main. A page now fails when:

  • it never names a changed file
  • its quiz count does not match its core steps
  • its lead or a table reason runs longer than one sentence
  • its table caption miscounts the files
  • its longest option is the correct one too often

The validator also prints the words in each section, and an advisory when Background runs past Code. When a check still fails after the skill's own fix pass, the page carries a banner that names it. No sample carries one.

Samples

A fresh run of the skill on this branch regenerated each sample, and every page passes validate-samples.sh. Words are totals across sections, as the validator counts them, without code blocks:

Sample Words before → after Change Background before → after Code after Core steps, questions
TanStack PR 11305 2,257 → 1,881 −16.7% 420 → 592 632 2, 3
TanStack PR 11242 2,327 → 1,912 −17.8% 405 → 577 501 2, 3
fastapi PR 16102 2,977 → 2,360 −20.7% 404 → 627 881 3, 5
fastapi PR 16013 2,958 → 2,635 −10.9% 417 → 752 728 3, 5
fastapi PR 15800 2,412 → 3,574 +48.2% 506 → 919 1,536 5, 5
jsdom v30.1.0 2,663 → 5,489 +106.1% 454 → 866 3,462 9 edits in 7 themes, 5
uPortal PR 2924 3,220 → 2,221 −31.0% 505 → 886 720 2, 3
uPortal PR 2945 2,298 → 1,728 −24.8% 809 → 634 452 2, 3
uPortal PR 2983 2,520 → 3,230 +28.2% 412 → 749 1,362 5, 5

"Before" is the sample on main, written by earlier versions of the skill. Each row compares two single runs.

On the six shorter pages, both Intuition and the Code walkthrough shrank. The three longer pages cover the most core edits. jsdom v30.1.0 has 9, and fastapi PR 15800 and uPortal PR 2983 have 5 each. The other pages have 2 or 3.

Background grew on eight of the nine pages. It runs past Code on four: fastapi PR 16013, TanStack PR 11242, uPortal PR 2924, and uPortal PR 2945. The runs that explained it traced it to the rule that Background defines every name the walkthrough uses. On a small diff the walkthrough is short. Those definitions then outweigh it.

Some rule changes in this PR came after the sample runs. One lets the walkthrough define a name the diff creates where the name first appears. That change targets the Background overshoot, and the samples do not reflect it yet. The other later changes loosen rules or put existing behavior into words. Every page still passes them.

Testing

On Node 24.22.2, npm run check is clean and 108 of 108 tests pass. A fresh build leaves the bundle unchanged, and validate-samples.sh passes all nine pages.

# Conflicts:
#	skills/explain-diff-html/SKILL.md
#	skills/explain-diff-html/references/validation.md
#	skills/explain-diff-html/scripts/validate-output.sh
Part of #4.

The main branch replaced validate-output.sh with src/validate-output.ts,
so the shell checks this branch added move into it.
Part of #4.

The skill pins the a/ and b/ diff prefixes, so diff.noprefix cannot
break the coverage check. Where a sample run could not follow a rule as
written, the rule now says what the run did, such as defining a name
the diff creates at its first use.
Part of #4.

A fresh run of this branch's SKILL.md wrote each page, and every page
passes validate-samples.sh.
@malav2110 malav2110 changed the title shortened explanation pages and sized the quiz to the change gave explanation pages a fixed structure and sized the quiz to the change Nov 23, 2026
@malav2110
malav2110 marked this pull request as ready for review November 23, 2026 17:59
Part of #4.

The coverage check still ignores a file named only in the failure
banner, but no test page covers that rule now.
@malav2110

Copy link
Copy Markdown
Owner Author

@andyhorn @Aaqibhafeezkhan @AndreIsraelAO @ChristianMurphy @Shachi95

Hi all, would you be up for reviewing this one? It builds on work you each did here.

The PR gives every explanation page the same structure and regenerates the samples. SKILL.md and a couple of the samples are a good place to start. Feedback of any size is welcome, and there's no rush. Thanks!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant