/wip-skillz:nick-walkthroughfrom wip-skillz
Generates an interactive HTML walkthrough of a GitLab merge request, explaining changes point-by-point with explicit code context. Designed for Nick to review instead of reading the diff.
Ships in wip-skillz. 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.
Read when SKILL.md points to them.
Use this skill to write a walkthrough of a merge request for Nick to read instead of the diff. The walkthrough explains the change in detail, point by point. A point is one thing about the change that a reviewer needs to know. Under each point, the walkthrough shows the code that the point is about.
Nick will comment on the parts of the page that aren't clear. He'll then paste his feedback into a session so that the walkthrough can be updated.
nick-review is the companion skill. It looks for defects, whereas this skill
explains the change.
A context is one part of the codebase that has a separate package and domain model. The billing context and the exports context are examples. Each piece of the page shows its context explicitly, because a reviewer of a merge request that touches several contexts is mostly checking what depends on what. This matters more than anything else in this file.
If a reviewer has to guess the context of a piece of code, they'll often guess wrong or have to go hunting for the context. A wrong guess can mean that a dependency between 2 contexts is approved even though the reviewer hasn't seen the dependency.
A passage is a ### title and all the paragraphs and code blocks under the
title, up to the next ### or ## heading. The page shows each passage as a separate slide. A piece is a sentence, a
code block, a line of code or a row of a table.
Nick needs to be able to tell the context of any piece from that piece alone. He doesn't need to scroll or open another point. He doesn't need to remember what an earlier passage described either.
The source is the markdown file that you write in step 4. The renderer is the script that turns the source into the HTML page in step 5. Both of them help to show the context of each piece:
The source's front matter has one context: line per context. Each line
starts with the folder of that context. A folder: line names a folder that
isn't a context, such as docs. If a code block shows a file that isn't in
any of those folders, the renderer fails.
The renderer draws the name of the context as a coloured badge on every code block. It also marks every line that imports from another context's package.
Write the name of a context in the text exactly as it is in its
context: line. The renderer then draws the name in the colour of that
context so a context looks the same everywhere on the page. "The billing
context" is drawn in that colour, but "billing" on its own isn't.
In each passage, write the context of a thing at its first mention. The details are in "A thing mentioned without its context".
When the rows of a table or a list are in different contexts, write the context in each row, either as a column or as the first words of the item.
When the code calls another context, announce the call in the text above the code block. The details are in "A code block that calls another context without the text announcing the call".
Usually you only need to write a thing's context once per passage, rather than in front of every noun in every sentence.
A walkthrough's source has at least one context: line, even for a merge
request that only touches one context.
Run node "$skill/prepare-walkthrough.mjs" <iid> from the repository of the
merge request. $skill is the base directory of this skill, which is the
folder that the harness prints when it loads the skill. The script makes the
folder of the walkthrough, writes the front matter of walkthrough.md and
prints every context: line and folder: line. It reads the merge request
from GitLab.
Check the label of each context line, such as "app" for an app. Add a
context: line for each context that the merge request calls but doesn't
change. For a stacked merge request with a conflict, prepare-walkthrough.mjs
also prints the list of git cherry. Read that list before you use the base,
because a commit of the merge request underneath can also have a +. The
script finds a context through its package.json. In a repository without
package.json files, prepare-walkthrough.mjs writes a folder: line for
each top folder.
Write the context: lines by hand and delete the folder: line of each top
folder that you write as a context.
Read a file at the head with git show <head>:<path> rather than checking
anything out.
If anything in the walkthrough would benefit from reading the plan, read the plan. For example, if a piece of code seems unused, the plan might explain why or show it being used in the next task. If you don't have the plan, ask where to find it.
In most merge requests, the points follow one request through the code, such as an HTTP request or a command. A merge request that only changes docs or config still has points, but they don't follow a request. A merge request usually has 4 to 8 points.
To follow a request, describe it from the outside in. Start with what a caller sees, such as a route or a screen. A command is another example.
Then follow the code down through each layer. The usual layers are a controller and a use case, followed by a port and an adapter. The domain model is the last layer.
While you follow the code, write down every call to another context, because a reviewer nearly always wants to know about a call like that. An example would be a use case in one context that calls a port whose adapter calls another context. Announce each call like that in the passage that first shows the call as described in "A code block that calls another context without the text announcing the call". If the call is new, also add it to the Architecture tab, which is the tab for changes between contexts (see "The tabs").
If Nick hasn't seen the list of points yet, show it to him in the chat first. It's quicker for him to correct a list than a page.
A walkthrough only contains facts. So check each sentence against the code. A test or the output of a command can be used as evidence too. The details, including what to do if you can't establish a fact, are in "A sentence that isn't proved by the code".
The source is one markdown file, in the format described in "The source format" below. Write the rest of it in the walkthrough.md that prepare-walkthrough.mjs wrote in step 1.
Run the rewrite-like-nick skill on walkthrough.md and ask it to check the
file. It runs the prose scripts and fixes each hit. Render the page only once
the scripts don't print any hits.
Run the renderer from the merge request's repository. The renderer is in the base directory of this skill, which is the folder that the harness prints when it loads the skill:
dir=<the folder that prepare-walkthrough.mjs wrote>
skill=<the base directory of this skill>
node "$skill/render-walkthrough.mjs" "$dir/walkthrough.md" "$dir/walkthrough.html" --check
open "$dir/walkthrough.html"
With --check, the renderer opens every slide in headless Chrome. It prints
each block, such as a table or an image, that runs past the right edge of its
column. Fix each one in the source. If a change to the source doesn't fix the
block, tell Nick which slide the block is on.
The renderer checks every code block against the file in git. The file is
read at the head of the merge request, or at the merge base if the block has
@base. The renderer fails on a line that isn't in that file. It prints each
line like that.
The renderer prints a notice when a code block shows a file that the merge request changes, without the line that changes. The reader sees that the file changed and can't see what changed on the page. Show the line that changes, or say in the text why the block shows the lines around the change.
Fix the source until the page renders. Never loosen the check.
Tell Nick the page's path rather than repeating the walkthrough in the chat.
While Nick reads the page, he selects any text that he wants to comment on, such as a sentence or a few lines of code. A Comment button then appears next to the selection. Nick writes his comment in the card that opens. The text that he selected stays highlighted on the page.
Each comment is saved in his browser. He can click a highlight to edit or delete its comment. The Comments tab lists every comment on the page:
At the end, he'll click Collect all my feedback on the page and paste the result into a session.
This is often a different session from the one where the walkthrough was written. That's why the text he pastes includes everything the session needs:
Source is the path of the markdown file.Page is the path of the HTML file.Repository is the folder to run the renderer from.An entry looks like this:
### t1p3.b2: 2. `UploadRetryPolicy` stops a 4th upload, under "The export job stops after 3 failed uploads"
The selected text:
> return new UploadRetriesExhausted()
Nick's comment:
> Which caller reads this error?
The heading of the entry is the id of the passage that contains the selected
text, followed by the passage's title. The id can also point at a whole point,
such as t1p3, or at a > ⚠️ block, such as t1p3.w1. The selected text
shows the sentence or the line of code that the comment is about.
A passage id such as t1p3.b2 points at the 2nd ### passage under the 3rd
## heading in the 1st # heading. The ids are described in "The source
format".
For each comment:
Then render the page again to the same path and tell Nick to reload the page. His comments are stored in his browser for each render so the new page starts without any comments.
A source looks like this:
---
iid: 412
title: feat(exports): the export job retries a failed upload
url: https://gitlab.com/<group>/<project>/-/merge_requests/412
author: someone
context: modules/exports = exports context = @shop/exports
context: modules/billing = billing context = @shop/billing
folder: docs
base: <full sha of the merge base>
head: <full sha of the head>
---
# The change
One sentence about why the merge request exists, which the page draws as the
heading of the overview.
- POST /api/exports starts an export of the invoices of a shop.
- GET /api/exports/<id> reads the state of an export.
## The export route returns a 503 after the last retry {503 after retries}
A paragraph or a list that introduces the point.
### The export job stops after the 3rd failed upload
A paragraph, with `Names` in backticks.
- A list item.
| A | table |
|---|---|
| a | row |
> ⚠️ **A short title** A block that needs Nick's attention.
A context: line is <path prefix> = <name of the context> = <name of its package>. The path prefix is the folder of the context. The package's name is
what you'd write in an import in another context to use this one. Leave the
package out for a folder that isn't imported by name, such as an app or a
tooling folder.
A folder: line is folder: <path prefix>, as in folder: docs. Each file
under that folder that isn't under a context: line belongs to the folder.
The renderer draws the folder in grey rather than as a context.
prepare-walkthrough.mjs writes these lines.
Each passage in a ## point starts with a ### line, which is the
passage's title. In a point that has a request block, the title ends with a
short name in braces, as in ### <title> {Sign-in cookie}. The card of the
passage contains the short name. In a point that has a table of contents, the
card contains the label of the item instead. Everything under the title up to
the next ### or ## heading belongs to the passage. The page shows each
passage as one slide, which has the title as its heading. The passages of each
point are numbered from 1.
The title is a heading rather than the first sentence of a paragraph. So the paragraph under the title doesn't continue from the title. It starts its context again, as described in "Each point is built to be read on its own".
Before the first ### title, a point only has an intro. The intro contains
the paragraphs and the lists that introduce the point, a request block or a
table of contents and any > ⚠️ blocks. The renderer fails on any other block that
isn't under a ### title.
The intro paragraphs are shown on the overview slide of the point. The overview slide is described in "The page".
The page doesn't show a table of contents as a list. The description of each item is shown in the panel that drops down from the timeline. For a passage without an item, the page shows the title of the passage and the first sentence of its first paragraph instead. The links at the bottom of a slide contain the number of the point and the number of the passage, as in "Next: 1.2". Hovering over a link shows the title of that passage.
A > ⚠️ block isn't a passage. It isn't numbered or listed in the
table of contents. A > ⚠️ block also ends the passage above
the block. That's why the next line after a > ⚠️ block in the middle of a
point is always a ### title.
A > ⚠️ block starts with a short title in bold. The title describes the
problem that a reviewer needs to know about in a few words. The text after the
title explains the problem:
> ⚠️ **`UploadRetryPolicy` doesn't have a test** The 3 new branches of
> `UploadRetryPolicy.isExhausted` aren't run by any test in the exports context.
The page shows the title as the heading of the block. The overview lists the
title of every > ⚠️ block as a section that is closed at first. A click on
the title opens the section, which shows the text and a link to the block. The
renderer fails on a > ⚠️ block without a title.
A > ⚠️ block in the intro is shown on the overview slide of the point. A
> ⚠️ block under a passage is shown at the end of the text of that passage.
The overview slide of the point then links to the block.
Each passage has an id, which is used in links and in Nick's comments:
| Id | What the id points at |
|---|---|
t1p0 | the overview of the 1st tab, which is the text before the first ## heading |
t1p3 | the 3rd ## point of the 1st # tab |
t1p3.b2 | the 2nd ### passage of that point |
Only the ### titles are counted. That's why a paragraph or a code block
that's added inside a passage doesn't change the id of any passage. To link
to a passage, write the passage's id after #, as in
[2 new SPI ports](#t1p3.b2).
A code block starts with the language and the file's path. To show the file as
it is at the merge base rather than at the head, write @base after the path:
```ts modules/exports/src/application/export-invoice.handler.ts
const policy = UploadRetryPolicy.fromAttempts(command.attempts)
…
return new UploadRetriesExhausted() //~ `UploadRetriesExhausted` is the error from point 3
```
Copy each line from the file exactly. The renderer finds the number of each line, links the path to GitLab and marks the lines that the merge request adds.
A line with only … on it is a gap between 2 parts of the file.
//~ at the end of a line starts a note on that line, as described in
"Notes on lines of code" below.
A code block without a path isn't checked. Use one for an example of a request or a response.
A flow block before the first ## heading is drawn as a sequence
diagram. Each line is
<from> -> <to>: <label> @<number of the point>.<number of the passage>.
Write --> for an error or a response. Tag a response with the passage of
the call that it belongs to.
The lines that are tagged with the number of a point are also drawn as the
sequence diagram of that point. Each arrow shows the number of its passage.
A click on the number opens that passage. In a line of the flow block, write the
name of a context exactly as in the context: line, or leave out the last
word of the name, as in billing for billing context. The page then marks
that context in the sequence diagram while one of its passages is open.
A codeflow block after the flow block is drawn as the code-level
sequence diagram. The flow block shows the contexts. The codeflow block
shows the classes and ports that the passage titles are about. Each line is
written like a flow line, with the class or port as the participant and its
context in brackets, as in
ExportController (exports) -> GetInvoiceOwner (exports): … @1.1.
A types block after the flow block is drawn as a type diagram under the
sequence diagram. The type diagram shows how the types fit together, which
the sequence diagram doesn't.
The type diagram has one column per context. Each type is drawn as a box with only the type's name in the box. The colour of the box shows what kind of type it is, which is explained by the legend under the diagram.
The types block has 2 kinds of line. A line with = declares a box. A line
with -> draws an arrow from one box to another. The line ends with the
number of the walkthrough point that the arrow belongs to:
```types
Invoice = aggregate in billing
InvoiceOwner | InvoiceNotFound = value object | domain error in billing
ReadInvoiceOwner = API port in billing
GetInvoiceOwnerInProcAdapter = adapter in exports
GetInvoiceOwner = SPI port in exports
ExportOwner | InvoiceNotFound = value object | domain error in exports
ExportPermission = value object in exports
Invoice -> InvoiceOwner | InvoiceNotFound @2
InvoiceOwner | InvoiceNotFound -> ReadInvoiceOwner @2
ReadInvoiceOwner -> GetInvoiceOwnerInProcAdapter @2
GetInvoiceOwnerInProcAdapter -> GetInvoiceOwner @2
GetInvoiceOwner -> ExportOwner | InvoiceNotFound @2
ExportOwner | InvoiceNotFound -> ExportPermission @3
```
Declare the boxes in the order the code runs, because each box is drawn below the previous box. The exception is a box in another context that has an arrow from the previous box. Those 2 boxes are drawn side by side.
Write a union with |. Each type in the union can be a different kind. The
types of a union are drawn stacked in one box.
When 2 boxes share a name, write in <context> after that name in every
arrow, as in OpenSessionInProcAdapter -> OpenSession in identity @3. Leave
every other name bare. The renderer fails on a bare name that 2 boxes share.
Read the kind of each type off its declaration in the code. For a type in a TypeScript file, the render fails when the kind doesn't fit the declaration, such as a value object that is declared as an interface. Some of the colours are taken from event storming, such as orange for a domain event and blue for a command:
| Kind | Colour | What it is in the code |
|---|---|---|
domain error | red | a class that extends DomainError |
domain event | orange | an event that the domain raises |
aggregate | yellow | an aggregate root |
command | blue | the input of a use case |
value object | teal | any other class in domain/ |
plain array | grey | an array of strings or of a union of strings |
API port | purple pill | the interface that a context offers to other contexts |
SPI port | dashed purple pill | the interface that a context calls when it needs something from outside, which an adapter implements |
adapter | pink | the class that implements an SPI port, often by calling another context's API port |
If the kind of a type isn't in this table, write the keyword of its
declaration, interface or type. The box is drawn in grey, or in white
with a grey outline when the diagram has a plain array.
Never draw an arrow straight from a type in one context to a type in another. When a type is passed from one context to another, draw each box that the type is passed through:
The diagram only shows what the types are. So never colour a box or an arrow because you think the code is wrong. If you think the code is wrong, write that in a point.
Every point has a card diagram, which is built from the passages of the point.
Each ### passage is one card, which is a numbered box that contains the
short name of the passage. The cards are drawn in lanes. Each context has a
separate lane.
A card is in the lane of the context of the first code block in the passage that has a path. A passage without a code block like that has a card in a lane without a name. Arrows join the cards in the order of the passages. Each card opens its passage. That way the reader can jump straight to the code of any passage.
Read the code of each point and decide whether the point follows one request
through the code, such as an HTTP request from the route down to the domain
model. If it does, add an empty request block to that point. The diagram of
that point is then titled "The request". For any other point, the diagram is
titled "The passages".
Write the empty block after the point's intro paragraphs and before the first
### title:
## The export job stops after 3 failed uploads {Retry limit}
The export job in the exports context tries an upload 3 times at most.
```request
```
### `ExportController` reads the retry limit of the shop
…
### `ReadInvoiceOwner` in the billing context returns the ID of the invoice's shop
…
### `UploadRetryPolicy` stops a 4th upload
…
request block that has any lines. A card has the
short name of its passage, or else the label of its item in the table of
contents. Both are described in "The source format".> ⚠️ blocks aren't in the diagram, because they aren't numbered.The renderer also adds 3 things that you don't write in the source:
A note explains one line of a code block or a few lines of the block. Start
with what the line means for the code around it, as in "@Public() means that
anyone can call this route without a token". Explain how the framework handles
the line only when the reviewer needs that to judge the change. Write //~
at the end of the line, followed by the note:
```ts modules/exports/src/application/export-invoice.handler.ts
const policy = UploadRetryPolicy.fromAttempts(command.attempts) //~ `fromAttempts` reads the limit from the shop's settings
```
When a note is about several lines, write //~[ at the end of the first
line, followed by the note. Then write //~] at the end of the last line.
The lines in between don't need a marker. A … line can also be one of them:
```ts modules/exports/src/application/export-invoice.handler.ts
if (policy.isExhausted(attempts)) { //~[ `policy.isExhausted` stops a 4th upload
return new UploadRetriesExhausted()
} //~]
```
The renderer numbers the notes of a passage from 1, across every code block of the passage. So no 2 notes on one page have the same number. Each note is shown in 3 places:
The renderer takes the first name in backticks from the text of a note. It
only uses a name that is also in the lines the note is on. So start each note
with the name of the thing that the note is about, as in "policy.isExhausted
stops a 4th upload". A note without a name like that is named after the code
of its first line.
The renderer fails on a note on several lines that isn't written correctly:
//~] that doesn't end a note that was started with //~[//~[ without any text, or a //~] with text after it//~[ or a //~ while a note on several lines is still open//~[ that isn't ended with a //~] before the end of the block//~[ or a //~] on a … lineEach # heading in the source is a tab on the page. The renderer adds a 4th
tab, "Every file", at the end. The first paragraph of each tab is drawn as the
heading of the tab. Write that paragraph as one sentence. On the change tab,
list each route or command that the merge request adds under the heading, when
the merge request adds any. You can write these 3 tabs in the source:
The change. This tab contains the points from step 2, in the order the
code runs. The text before the first ## heading is the overview. Put the
flow block there, followed by the types block. 2. Architecture. This
tab contains what changes between contexts rather than inside one context: - a
new dependency between 2 contexts or 2 packages - a new API port or SPI port -
a new export from the index.ts of a context - a new table or a new queue
that another context can read - a new event that another context can read
A new dependency in a package.json belongs here even though the file is
config, because a reviewer reads the dependency as coupling between 2
contexts.
Docs and config. This tab contains everything that isn't code or architecture:
Leave out a tab that would be empty.
Mark anything that has a wide impact with > ⚠️, whichever tab it's on. The
overview lists every > ⚠️ block from every tab so Nick sees all of the
warnings before he opens a point. A new dependency between contexts, a lower
coverage threshold and a changed coding convention are all examples of a wide
impact.
Give each ## heading a short label in braces. The top of every screen has a
timeline, which is a row of numbered points. The full heading doesn't fit in
the timeline so the label is shown there instead. The label is also the title
of the sidebar of the point:
## The export job retries a failed upload {Retry}
Each entry below is about one mistake that makes a point harder to review. Most entries start with what to write instead and why. Then they describe where the mistake usually happens. Some of them also describe where the entry doesn't apply.
Each entry describes the usual case. So use your judgment rather than applying an entry to every sentence.
Bad: ExportController.startExport checks the shop
Good: ExportController.startExport checks the shop
Bad: The retry policy stops a 4th upload.
Good: UploadRetryPolicy in the exports context stops a 4th upload.
Good, when the sentence needs the words of the class as well: The retry
policy (UploadRetryPolicy) stops a 4th upload.
A reader who sees "the retry policy" has to work out which class the words mean. Those words don't name a file. The page draws a name in backticks as code and links the name to its file, so the reader sees where the code is without leaving the page.
This applies to a component, a hook, a function, a type, a file and a field. It doesn't apply to a person, a role or a thing outside the code, such as "the customer" or "the browser".
Write a behaviour as a sentence that a developer would say to another developer.
Bad: reads an export never started as no files
Good: An export that has never been started doesn't have any files.
Bad: responds to a start with a null shop with 400
Good: The controller returns a 400 if the request contains a null shop. The export isn't started.
Write each passage as Point, Explain, Evidence so that Nick knows why a block of code matters before he reads the code. Without the point first, the block would read as a dump of code. Nick would have to work out for himself what it changes.
Point. The ### title states the most important thing about the
passage, which is the key point of the flow. For a new class, the title
states its main responsibility. For a changed class, the title states the
main significant change. The paragraph contains the details that support the
key point.
Bad (a new class that starts an export): ExportController in the
exports context adds a Location header
Good (the same class): ExportController in the exports context starts
an export of the invoices of a shop
Bad (a changed class where the main change is the 4th upload):
UploadRetryPolicy in the exports context logs a warning
Good (the same class): UploadRetryPolicy in the exports context stops
a 4th upload
The header and the warning are details. They belong in the paragraph unless one of them is the main change of the passage.
Explain. The paragraph under the title describes in plain words how the code makes that change and why. Write the context of each thing at its first mention.
Evidence. Then show the code block. Put a //~ note on each line
that the explanation refers to.
This mistake is common in a passage whose title describes what the code is rather than what the code changes.
Bad:
### This import is new in this MR
followed only by the import of GetInvoiceOwner.
Good:
### An export of an invoice that another shop owns fails with a 403
The export route in the exports context asks the billing context which shop
owns an invoice. The call goes through `GetInvoiceOwner`, which is a new SPI
port in the exports context.
followed by the import, the call to GetInvoiceOwner and the line that
returns the 403, which has a note.
Build each point so that it can be read without the other points, because Nick will open the points in any order. He'll also jump straight to any passage of a point, because each passage is a separate slide. That's why each passage is built so that it can be read without the passage above it too.
Open the point with an intro that describes what the point is about. The intro doesn't refer to the previous point.
Write a breakdown after the intro if the point has 3 or more passages. These are the usual cases, but use your judgment for each point:
request block
after its intro paragraphs as described in "The source format".**<label>**: <description>. The
label is a noun phrase that makes sense without any text around the
label, such as "2 new SPI ports". The description explains in plain words
what the passage shows and how the passage fits with the others.Make the title of each passage its point. If you link to an earlier passage, write the link in the paragraph and write about the code rather than about the page. Never write "the passage on", "the introduction", "showed" or "described" about the page itself. Don't set up a passage at the end of the passage above either, because the reader might not have read that passage.
Start the context again in the paragraph under the title. The title is a heading rather than the first sentence of the paragraph. So the paragraph under the title never continues from the title.
Hide the title with your hand and read the paragraph alone. If any word in the paragraph only makes sense with the title, write the thing again in full and write its context. These words usually depend on the title, wherever they are in the paragraph:
Bad:
- The 2 ports are listed with the context that each one calls.
"The 2 ports" haven't been introduced on the screen. The label is also the subject of the sentence.
Good:
- 2 new SPI ports: the ports that the exports context calls and the context that each port's adapter calls.
Bad:
The passage on 2 new SPI ports showed that the exports context asks the billing context for the owner of an invoice.
The title talks about the page rather than the code.
Good:
The billing context reads the owner of an invoice from the invoice itself. The exports context calls the new ReadInvoiceOwner API port in the billing context. Inside the billing context,
InvoiceOwnerHandlerimplementsReadInvoiceOwnerand never reads the shop.
Bad:
### A 4th upload is never tried after 3 failures
The comment on the `UploadRetryPolicy` class in the exports context explains
this.
"This" at the end of the paragraph points at the title. If you hide the title, you can't tell what the comment explains.
Good:
### A 4th upload is never tried after 3 failures
The comment on the `UploadRetryPolicy` class in the exports context explains
why the export job doesn't try a 4th upload after 3 failed uploads.
This entry doesn't apply to a > ⚠️ block, because its first sentence is
already the warning. A point with 1 or 2 passages doesn't need a breakdown,
because the reader sees all of the point at once.
Start the passage with what is still missing before the point's goal is met. Then introduce the code that adds the missing part. Then show the code.
This mistake usually happens in the middle of a point. The point's heading is
a goal, such as "The export job retries a failed upload". If the next passage
opened with "UploadRetryPolicy is a new value object in the exports
context", the reader wouldn't know yet why a value object is needed for that
goal. So the sentence wouldn't have any connection to anything they'd read.
Bad:
GetInvoiceOwneris a new SPI port of the exports context. Its adapter calls the billing context.
Good:
An export is only allowed for the owner of the invoice, but the owner is stored by the billing context. The exports context asks for it through a new SPI port called
GetInvoiceOwner.
This entry doesn't apply to a point's heading, because the heading is the goal.
The renderer fails on any paragraph that has more than 4 sentences, because a longer paragraph is a wall of text that's hard to read. In the entries above, you're asked for the context and the dependency of everything in a block, as well as the reason why each thing is there. If you were to write all of that as one paragraph, you'd end up with about 8 sentences.
The point is in the passage's ### title. Keep the statements that explain
the point in the paragraph. Then move each other statement to the place where
it belongs:
//~ note on that
line.### title. The new passage shows the code that the statement is about.Never get under the limit by joining sentences with "and" or by cutting a thing's context.
Write each step of the code being discussed as a numbered list because humans find it easier to read a sequence of steps as a list instead of prose. Use your judgment, though. For example, 2 short steps can read fine as one sentence.
Strongly prefer bullet points for independent facts about the code, because a list is much easier to read than a run of statements. This is a strong preference rather than a rule, so 2 short related statements can still be one sentence. A statement and the reason for it stay in one bullet, joined as one sentence. A reason on a separate bullet reads like a separate statement, because a reason only makes sense when it's joined to the sentence it explains.
Steps in a paragraph.
Bad:
UploadInvoiceAdapterin the exports context implementsUploadInvoice, which is a new SPI port. It signs the file with the shop's key and posts the file to the storage bucket. Then it checks the ETag of the response against the checksum of the file.
Good:
UploadInvoiceAdapterin the exports context implementsUploadInvoice, which is a new SPI port. These are the 3 steps ofUploadInvoiceAdapter:
- It signs the file with the shop's key.
- It posts the file to the storage bucket.
- It checks the ETag of the response against the checksum of the file.
Separate statements in a paragraph.
Bad:
ExportControlleris a new controller in the exports context.@Public()means that anyone can call theexportInvoiceroute without a token. The retry limit is the number that is returned by the billing context.
Good:
ExportControlleris a new controller in the exports context.@Public()means that anyone can call theexportInvoiceroute without a token.- The retry limit is the number that is returned by the billing context.
A reason on a separate bullet.
Bad:
- The export job tries an upload 3 times.
- Because the storage bucket sometimes drops an upload.
Good:
The export job tries an upload 3 times because the storage bucket sometimes drops an upload.
Each sentence in a passage usually explains a line of the code block under the passage or leads to the next sentence. If a sentence doesn't do either, move it into a separate passage, which shows the code that the sentence is about.
Some names in the code are too short to tell the reader what they are.
method and reader are examples. Write what the name stands for instead,
such as "the HTTP verb" or readRetryLimit.
Show one caller's code first. Put the definition of the new code straight below that. A reviewer can't learn much from a definition on its own. A caller comes first because the walkthrough is written from the outside in.
Put a //~ note on the line where the new code is called. If there are
several callers, show one of them and list the others.
Without a caller, the reviewer would see that a method was added to a controller, but they couldn't see that anything calls the method. The text often claims that the new method is used, as in "each of the 4 routes calls the new method", while the code block under that sentence only shows the new method.
Bad: a passage with the new #withRetry method of ExportController,
followed by a passage about the port that #withRetry calls.
Good: a passage with exportInvoice calling #withRetry, with a note on
that line. Then a passage with #withRetry itself. Then the list of the
other 3 routes. Only then is there a passage about the SPI port.
This entry doesn't apply to code that's called by a framework, such as a controller's route or a module's provider. Show the decorator or the registration instead. It doesn't apply either to a type that's already used in a block on the page.
In a TypeScript or JavaScript file, only copy the lines that the passage is
about. The renderer adds the signature line of the enclosing method and the line that closes the method, with a … line on each side. When the
first line that you copy is the signature, as in a whole short method, the
renderer doesn't add anything. In a file in any other language, copy the
signature line and the closing line yourself. Replace each part that you leave
out with …. A reviewer can only understand the lines once they know which
method and which class the lines are in. The parameters of that method also
explain where each variable comes from.
This mistake is usually made in a point about 2 or 3 lines of a long method.
The block then starts at those lines. So the reader sees an if and a
return without knowing which method they're in or where attempts comes
from.
Bad:
if (attempts >= this.limit) {
return UploadResult.gaveUp(attempts)
}
Good:
async upload(file: ExportFile): Promise<UploadResult> {
…
if (attempts >= this.limit) {
return UploadResult.gaveUp(attempts)
}
…
}
A function outside a class is shown in the same way. The block starts at the
function line and ends at the line that closes the function.
Write 3 or more names of the same kind as a list rather than inside a sentence. A reader scans a column of file names faster than a sentence. Each name also becomes a link on its own line.
Bad:
The other 4 files with the same line are
order-problems.ts,invoice-problems.ts,refund-problems.tsandexport-problems.ts.
Good:
These 4 files have the same line:
order-problems.tsinvoice-problems.tsrefund-problems.tsexport-problems.ts
This is only for names that are the same kind of thing and that the reader might want to open. Examples are files and classes. Routes and tests are examples too.
If there are only 2 names, leave them in the sentence. If each name has a second statement, such as the action that each handler checks, use a table instead of bullets.
Use the most precise and accurate technical word for the thing. Pick the word that a developer would say out loud.
Bad:
A save is also refused when the order doesn't have an owner.
The reader can't tell what "a save" is. It could be the route that saves an
order, the saveOrder method of OrderController, the SaveOrder use case
or a write to the database.
Good:
The
SaveOrderuse case also refuses a caller when the order doesn't have an owner.
Write what kind of thing it is as part of the thing's name, such as "use case" or "controller". You can leave the kind out where the sentence already makes the kind clear. Without the kind, the reader would have to guess which layer of the code the sentence is about.
Bad:
All write methods check the owner.
"Write methods" could be database write methods, use case write methods or controller write methods.
Good:
All controller write methods check the owner.
The kind isn't needed in "OrderController checks that the user owns the
order in each of its write methods", because the word "its" already makes the
kind clear. Every method of a controller is a controller method.
When the code has a name for a thing, write that name in backticks, even when
a writing rule bans the plain word for that thing. The writing hook doesn't
check inline code. For example, write "maps each SignInRefusal in the
identity context to sign-in-refused" rather than "maps the 5 sign-in
rejections to sign-in-refused".
The first time you mention a thing in a passage, write what kind of thing it
is and its context, such as "the GetInvoiceOwner SPI port in the exports
context". For the rest of the passage, just use its name. Write the context
again in the next passage, because each passage is a separate section on the
page.
This matters because a merge request can touch several contexts. Then a port
or an adapter without its context could be in any of them. Some names even
exist twice, such as a GetOrder port in both the BFF (the backend for one
frontend) and the orders context. A class whose name is unique in the merge
request still needs its context the first time, because the reader hasn't
learned the name yet.
Announce a call to another context in the text above the code block that shows the call.
Say a method in the exports context contains this.getInvoiceOwner.apply(…).
The call looks local, but getInvoiceOwner is a port whose adapter calls the
billing context. So that line creates a dependency between 2 contexts. For a
reviewer it's the most important line in the block, but the line on its own
doesn't show the dependency.
A dependency like this one is why every piece of the page shows its context. Explain the dependency in the passage that shows the line rather than in a later passage. Never leave the dependency out.
In the text above the block, describe:
Then show the call in the block. Include the import line and the line where
the SPI port is injected. If the path in the import doesn't show what the
name is, put a //~ note on that line.
A dependency that's new in the merge request is also a point on the
Architecture tab, under a > ⚠️ block. Refer to that tab in the passage.
Bad:
The new method reads the owner of the invoice and then runs the export.
followed by a block with only the body of #exportForOwner.
Good:
The new
#exportForOwnermethod in the exports context calls the billing context:
#exportForOwnercalls the new SPI portGetInvoiceOwnerin the exports context to read the owner of the invoice from the billing context.- The exports context didn't depend on the billing context before this merge request. The Architecture tab lists the new dependency.
followed by a block with the import of GetInvoiceOwner, the constructor
line where GetInvoiceOwner is injected and then #exportForOwner.
A call to code in the same context doesn't need any of this. A use case that calls its own repository is an example.
If a dependency on another context already existed before the merge request, still write its context in the text. One clause is enough there. There's no need for a warning either.
There's usually no need to show the import of a framework decorator, or of a helper whose name already describes what the helper does.
When a key piece of code is imported from another file, show the import. This is especially important when the import crosses an architectural boundary like a module or a context.
When the change adds a folder, show the file tree of the folder.
If a code block contains something surprising, either describe the surprise
and its reason in the text above the block or replace the surprising lines
with …. A surprise is something like a constant called
PLACEHOLDER_SHOP_ID, a TODO, a thrown error or a cast. If the walkthrough
didn't explain the surprise, the reader would stop and ask whether it's a
problem.
Lines that are ordinary for the file don't need a description. Imports and constructors are usually ordinary lines like that. So are decorators. An import from another context is the exception, as described in "A code block that calls another context without the text announcing the call".
When you see code that the reader won't understand, add a //~ note that
explains what the code does and why. When you can't make sense of the code
yourself, start the note with ⚠️ and say that the code may be a bug.
When the same change is made in several places, show one of them in full. Then list the others and write that they have the same change. If the same change was made in 6 handlers, for example, the reader wouldn't learn anything from a second code block.
Before you write that they're the same, compare all of them, because the
defects are usually in the exceptions. If one place differs, show its code
under a > ⚠️ block that describes how it differs. If the copies only differ
by a name, such as the action that each handler checks, a table of the names
is enough.
Show every change at the boundary of a context, even if it's only one line,
because a reviewer nearly always wants to see these changes. A new port, a new
export from an index.ts and a new dependency in a package.json are each a
contract between 2 contexts. Show the declaration of a new port and write
which context calls which. The render fails on an added line in an index.ts or a package.json that isn't shown in any code block. The renderer prints each of those lines.
A private method, a new file inside one context or a renamed local variable isn't a boundary change. Show a change like that only where the point would be unclear without the change.
Prove every sentence with the code. Never write "I think", "probably" or "should".
If a sentence is a consequence rather than something you can see in one file, such as "a real user is never blocked today", prove it first. Show the lines that the sentence follows from. If there's a test for that behaviour, show the test too.
If you can't prove the sentence, stop and ask Nick. In auto mode, keep the
sentence and start it with [USER INPUT REQUIRED].
Write a decision that applies to the whole change as the second paragraph of the tab. The paragraph only needs 2 or 3 sentences. Refer to the decision again in the point where it's implemented.
An example would be "the shop id is never passed down as a parameter". A code block can't show a decision like that, because the decision is about what isn't there. Without the decision, the reader can't tell why some of the code exists.
Most merge requests don't have a decision like this. Don't invent one for them.
Nick will read the page on a laptop. walkthrough.css, walkthrough.js and
render-walkthrough.mjs are built around the constraints of a laptop screen,
which are listed below. If you change one of these files, keep to these
constraints:
The code is always fully visible, because Nick can't review a line that he can't see. A long line wraps. A code block never scrolls sideways and it's never clipped.
A point is shown as slides. Each slide is one passage. A reader who saw 7 points and 40 code blocks on one scrolling page wouldn't know where to start. The heading of a slide is the number and the title of the passage, as in "1.1 The export job stops after 3 failed uploads". The line above a slide only shows which passage is open, as in "Passage 2 of 4". So the arrows never move. Nick moves between the slides with the links at the top and at the bottom of a slide, or with the left and right arrow keys.
The first slide of a point is the overview of the point. It has these parts:
On the slide of a passage, the page is a stack of sections, one for each code block. A section has one code block on the right, with the text above that block and the notes panel of the block on the left. A line separates 2 sections. The 2 columns aren't independent, so the notes of one block are never drawn beside the code of another block. An arrow on the left of the sections folds the text so that the code has the whole width. A teal tab then opens the text again.
A sidebar lists the passages of the open point. The open passage also lists its files and how many notes each file has. The sidebar folds into a rail that is 40px wide, which still shows the number of each passage. A teal arrow at the top of the rail opens the sidebar again.
A header above the slide of a passage shows where the passage is in the point. The header is folded at first. It contains the card diagram and the sequence diagram of the point. The open passage is marked in both diagrams.
A diagram is never squeezed into its space. A card is never narrower than 180px so that its title can be read. A diagram that is a little too wide is scaled down as a whole. A wider diagram is drawn at its full size. Nick then zooms and pans the diagram.
Body text is dark on white. Grey text on a grey background is hard to read. Only a label, such as a line number or a path, is grey.
The timeline is on every screen. Showing one passage per screen hides the overall story. That's why the row of numbered points is at the top of every screen. The timeline shows which point is open, which ones have been read and which ones have a warning. A click on a point of the timeline drops down a panel that lists the passages of that point. A click on a passage in the panel opens that passage.
The overview shows the whole change at a glance. It has these parts:
A warning that's only visible inside a point is a defect.
The colour of a context is a faint tint. Each context has a separate hue. The badge on a code block is a light tint of that hue with dark text. The lane of a context has the same hue. So do the notes on the code of that context. A strong colour on every badge would draw the eye away from the text and the code.
Before you show the page to Nick, open walkthrough.html at the size of a
laptop screen and look at the page. #t1p2 opens the overview slide of a
point and #t1p2.b1 opens the slide of a passage.
~/nick-walkthrough/
himself.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub ntcoding/wip-skillz --plugin wip-skillz7 skills in this plugin
/architecture-proposal-analysisAnalyse an architecture proposal and write the analysis on an HTML page. The agent writes the content in Markdown. A script generates the HTML. Trigger on "analyse this architecture proposal" or "/architecture-proposal-analysis"./explain-clearlyExplain code, a problem, an idea or a decision so that the reader understands it on the first read. Use it whenever a reply explains how code works, why something happens, what a change does or what a review found. Use it whenever Nick has to decide something too. Also trigger on "/explain-clearly", "explain", "why", "how does", "what does", "walk me through", "I don't understand what you mean" and "what are you talking about?". Every explanation follows Point, Explain, Evidence (PEE). A decision ends with a list of options, their trade-offs and a recommendation./mr-descriptionUse before creating a merge request or pull request, or before changing the description of one (glab mr create, glab mr update, gh pr create, gh pr edit). Also use it to fix the description of an existing MR ("fix the description of !N"). Every description is approved by Nick before it is posted./nick-reviewA first pass over a merge request, or a group of them, for Nick to read before he reviews. Trigger on "review !N", "review these MRs", "/nick-review <iid…>". It checks correctness against the spec, compliance with the repository's rules, and simplification. One subagent per merge request. It opens an HTML report and never posts anything to GitLab./rewrite-like-nickRewrite a document so that it reads like Nick wrote it. Any document, like a README, an ADR, a skill, a guide, a wiki page, an MR description. Trigger on "rewrite this like me", "rewrite in my tone", "this is AI slop", "this reads like AI", or /rewrite-like-nick <path>. The whole document is never rewritten before Nick approved a calibration on a small sample./scratch-padTurn this conversation into collaboration on an HTML scratch pad. Nick starts the skill for a new scratch pad, for the conversation so far or for an existing scratch pad.Other plugins' skills for the same job