BLOG

Recreating the claude.dev Blog, and What It Says About Taste

I pointed Claude at claude.dev's blog and stole its layout in an afternoon. How the scroll rail actually works, and why copying good UI is the easy part now.

I opened a post on claude.dev to read about code review, and ten seconds in I had stopped reading the post and was just scrolling the page up and down like an idiot.

None of the tricks were loud. As I scrolled into a section, its subheadings unfolded in the left rail and folded back up when I left. A little ASCII progress bar built out of ▓ and ░ blocks ticked up as I read. Once the main title scrolled off the top of the viewport, a smaller copy slid into the top of the rail to take its place. Clicking a section eased the page there over most of a second instead of teleporting. Together it made my own blog look like a Google Doc from 2014.

So I stole it. Everything on the page you're reading right now was measured off their live DOM and rebuilt on this site's existing Vite and React setup, with zero new dependencies.

If you're on a wide screen, watch the left rail while you read. This post is the demo. It's also the first post on my site that actually has H3 subsections, for reasons that will become embarrassing in a minute.

Reading the HTML tells you nothing about a scroll loop

I didn't spend an afternoon squinting at Chrome DevTools. I gave Claude this prompt:

Make the blog section of my portfolio look like
https://claude.dev/blog/solving-code-review-at-anthropic/

Focus on the design and the animations around the post: the table of
contents and how its sections expand, the reading progress bar, and the
overall aesthetic. Don't just read the HTML. Open it in a browser, scroll
through it, take screenshots, and experience it the way a reader would.
Then recreate it without changing my tech stack.

"Don't just read the HTML" is the whole trick. Try curling claude.dev and reading the source. It's a Next.js build, so you get hashed bundle names and inert initial markup. Everything worth stealing happens mid-scroll.

To see what the page was actually doing, Claude drove a headless browser and pulled four things:

  1. Screenshots at fixed scroll depths on desktop and mobile viewports to see what state changes happen as you read.
  2. A dump of every active CSS rule from document.styleSheets, read straight out of the live browser so custom properties, grid tracks, and transition timings weren't buried in minified chunks.
  3. A scroll probe that stepped down the page and logged which table-of-contents item was active, which subsection drawers were open, what the ASCII bar read, and when the rail title appeared.
  4. A frame-by-frame timestamp log after clicking a TOC link, to see whether they were using native scroll-behavior: smooth or a custom easing loop.

Once you have those four dumps side by side, there's no mystery left.

How the left-rail tree actually works

The table of contents is labeled Tree and drawn with └ box-drawing characters, like the output of tree(1). You know you're looking at a document outline before you read a single heading.

Animating to auto height with a 1fr grid track

Scroll into a section that has H3s and its children unfold underneath it in the rail. You just watched this one open.

Try transitioning height: 0 to height: auto in CSS and the browser just snaps between them. People usually work around that by measuring scrollHeight in JavaScript or animating max-height to some guessed ceiling like 500px and living with the easing timing being slightly off.

claude.dev uses a one-cell CSS Grid instead:

.subs { display: grid; grid-template-rows: 0fr; visibility: hidden; }
.subs.open { grid-template-rows: 1fr; visibility: visible; }
.subs > div { min-height: 0; overflow: hidden; }
.subs { transition: grid-template-rows .3s var(--ease-out), visibility .3s; }

Grid track sizes are animatable, and 1fr resolves to the child's natural height. The browser does the measuring for you. The one line you cannot skip is min-height: 0 on the inner <div>. Grid items refuse to shrink below their minimum content size by default, so without min-height: 0 the drawer opens once and never closes again.

The visibility transition is doing quiet work too. visibility is discrete, so when you transition from visible to hidden, the browser waits until the 300ms height collapse finishes before flipping it to hidden. That keeps the links visible while the drawer shuts and then drops them out of the keyboard tab order once it's closed. (Their CSS also pops a group open with :has(:focus-visible) if a keyboard user tabs into a collapsed drawer, which is a great detail I didn't bother copying.)

When I first shipped this, nothing unfolded anywhere on my blog. I spent ten minutes checking my CSS before realizing none of my existing posts had a single ### heading in them. This post has subsections partly so the code has something to do.

Why I skipped IntersectionObserver

To highlight the current section, I check which heading is the last one to cross a horizontal line one-third of the way down the viewport:

const line = window.innerHeight / 3;
let current = 0;
headings.forEach((el, i) => {
  if (el && el.getBoundingClientRect().top <= line) current = i;
});
setActive(current);

Whenever someone sees getBoundingClientRect() in a scroll handler, their reflex is to tell you to use IntersectionObserver. I didn't, on purpose.

IntersectionObserver fires events when elements cross a threshold. What we want here is a total ordering question: which heading is the last one above the line right now? Click an anchor link that jumps from the top of the post straight to the bottom and nothing "crosses" the middle of the screen along the way. Checking a dozen heading offsets inside a requestAnimationFrame-throttled scroll listener takes microseconds. And because setActive only stores an integer index, React bails out without re-rendering on almost every frame.

Watching the H1 instead of scrollY

Scroll past the main H1 at the top of the article and a small copy of the title unfolds at the top of the left rail. It's been sitting over there since you finished the intro.

Instead of hardcoding a pixel offset like scrollY > 200, it watches the real H1 and triggers the moment the H1's bottom edge leaves the viewport. A one-line title and a three-line title hand off at the exact right moment.

Here I did use max-height, right after complaining about it. A post title is at most three lines tall, so we know the ceiling, and max-height is only a hack when you're guessing.

A progress bar made of 28 monospace characters

▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░ 57%

Look over at the rail and yours should be sitting right around 57% too. Because it's just 28 monospace characters in a text node, it can't reflow or jitter, and it doesn't need an SVG or a <canvas>. The percentage is zero-padded (03%) so the number never nudges the line width as it climbs.

On mobile the left rail disappears and the progress indicator turns into a thin bar pinned to the top of the viewport. claude.dev animates that bar by setting width on every scroll tick, which triggers a browser layout pass each frame. I kept mine at width: 100% and animated transform: scaleX() instead, so the compositor scales it on the GPU without touching layout. Same visual result, less work on a phone.

Bugs that had nothing to do with claude.dev

Dropping the new layout into my site shook loose four bugs in my own setup that apply to any React or Vite build.

A saved DOM snapshot is not SSR

My build script prerenders each route by opening the built site in headless Puppeteer and saving the serialized DOM to index.html. That looks like server-side rendering, and React treats it very differently.

<span>{post.minutes} min</span>      // React expects two text nodes
<span>{`${post.minutes} min`}</span> // one text node, matching the snapshot

When React renders {post.minutes} min in JSX, it creates two adjacent text nodes ("7" and " min"). When Puppeteer serializes that DOM to an HTML file and the browser parses it back, the HTML parser merges adjacent text into a single text node ("7 min"). When React tries to hydrate, it sees one text node where it expected two, panics about a hydration mismatch, and trashes the entire prerendered tree. Wrapping adjacent interpolations in a template literal, as in the second line above, emits a single text node from the start.

React.lazy broke hydration for a similar reason. Real renderToString SSR writes comment markers around Suspense boundaries; a saved DOM snapshot doesn't. The fix is to preload the current route's MDX chunk before mounting React:

const post = getPost(window.location.pathname.match(/^\/blog\/([^/]+)/)?.[1]);
(post ? loadPostContent(post) : Promise.resolve()).finally(() => {
  /* mount React */
});

Each post still code-splits into its own chunk, and the first client render matches the prerendered HTML on the first frame.

Put entrance animations in CSS, not JS

The title, standfirst, and metadata at the top of the post slide up with a short stagger when you load the page:

[data-reveal] {
  animation: reveal-up 0.7s var(--ease-out) var(--reveal-delay, 0s) backwards;
}
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(14px); }
}

Two details do the work here. Leaving the to block off @keyframes reveal-up makes the element animate into whatever resting styles it already has, so one keyframe rule works on everything. And animation-fill-mode: backwards holds the opacity: 0; translateY(14px) state during the --reveal-delay window. Because it's pure CSS on prerendered HTML, the animation starts the millisecond the browser paints the document, before the JS bundle has even finished downloading.

Putting font-family on * breaks CSS inheritance

The older parts of my portfolio had a global * { font-family: ... } reset. When you put a property on *, no element inherits that property from its parent anymore, because every single DOM node matches * directly. Give a container .mono and its child <span> ignores it and falls back to the * rule unless you write a more specific selector. Put font-family on body and let normal CSS inheritance do its job.

Layout shift goes to zero when nothing arrives late

Running my tmux config post through Lighthouse on a production build with mobile throttling before and after the rebuild:

ScoreCLSLCP
Before63 to 78up to 0.224.2 to 5.0s
After76 to 7904.1 to 4.4s

Cumulative Layout Shift dropped from 0.22 to 0 without me writing a single line of CLS-specific code. The blog uses system fonts (no webfont swap) and preloads the post chunk before mount. Nothing arrives late, so nothing shoves the text around after first paint.

Why taste is the scarce part now

Reverse engineering a page like this used to take hours of squinting at the Elements panel. Now I can point an agent at a URL, tell it to instrument the scroll loop in a headless browser, and have a working clone running on my own stack before lunch.

That changes what is actually hard in frontend work. Cloning the mechanics is cheap now. Deciding what to build, and when to stop, isn't.

What makes claude.dev's blog feel so good isn't the 0fr -> 1fr grid trick. It's everything their designers left out. Nothing on that page moves unless it is answering a question about where you are in the document. The tree unfolds because you entered a section. The bar fills because you read further. The small title appears because the big one just left the screen. There is no parallax, no hover glow, no hero illustration. They borrowed the tree command and ASCII blocks from a terminal, and stopped well short of making the page cosplay as a CRT monitor.

You can dump every stylesheet and animation curve off a live site with a script, and none of that output will tell you which ten ideas the designer tried and threw in the trash because they felt busy. As implementation gets cheaper, that kind of restraint is the whole game.

I'm fine borrowing theirs here. My blog is where I write down things I've figured out, and piggybacking on designers who clearly sweated the details beats leaving it ugly.