microfolio
CLAUDE.md144 starsChanged 3 months agoMITView on GitHub
.mcp.json declares the official Svelte MCP server (@sveltejs/mcp): live documentation and a svelte-autofixer that validates Svelte source. Prefer it over recalling Svelte 5 semantics from memory. It replaced svelte-complete.txt, an 810 KB documentation dump that had been frozen since July 2025. .claude/settings.json allowlists this project's own scripts so pnpm lint, pnpm build and friends run without a prompt. microfolio is a static portfolio generator built with SvelteKit 2, Svelte 5, and Tailwind CSS 4. It uses a file-based CMS (Markdown…
- Reads credentials
- Deletes or force-pushes
The file
We split this CLAUDE.md into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 81
All routes use server-side loading (+page.server.js) that reads content from the filesystem at build time:
- Very specific: line 113
All custom components use Ak prefix (e.g., AkHeader, AkFooter, AkProjectCard, AkProjectSummary, AkFilters, AkLightbox, AkOptimizedImage).
- Very specific: line 151
Default locale set in $lib/config.js (siteConfig.locale)
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
.mcp.json declares the official Svelte MCP server (@sveltejs/mcp): live documentation and a svelte-autofixer that validates Svelte source. Prefer it over recalling Svelte 5 semantics from memory. It replaced svelte-complete.txt, an 810 KB documentation dump that had been frozen since July 2025.
.claude/settings.json allowlists this project's own scripts so pnpm lint, pnpm build and friends run without a prompt.
Project Overview
microfolio is a static portfolio generator built with SvelteKit 2, Svelte 5, and Tailwind CSS 4. It uses a file-based CMS (Markdown + YAML frontmatter) for content. Developed by AKER.
The 1.0 stability promise (README › Stability) freezes until 2.0: the content layout and frontmatter keys, the keys of config.js (add-only), the commands, and the files update-microfolio never touches. A change to any of those is a major version, not a minor.
Development Commands
pnpm dev # Development server (port 5555)
pnpm build # Production build (via build.js → vite build)
pnpm deploy # Build with NODE_ENV=production (sets /microfolio base path)
pnpm preview # Preview production build (port 2001)
pnpm lint # Prettier check + ESLint
pnpm format # Prettier auto-fix
pnpm optimize-images # Generate WebP thumbnails via sharp
pnpm clean-images # Remove generated optimized images
pnpm test # Unit tests (Vitest, single run)
pnpm test:watch # Unit tests in watch mode
pnpm test:e2e # End-to-end tests (Playwright, against pnpm dev)
pnpm test:smoke # Smoke tests (Playwright, against build/ — run pnpm deploy first)
pnpm screenshots # Regenerate doc/screenshots (needs a dev server; PORT=…)Those two ports are a Daft Punk nod — Interstella 5555, and Discovery, the album it sets to pictures. strictPort is deliberately unset, so a busy port sends Vite to the next one and it prints where it actually landed. playwright.config.js and scripts/screenshots.js both default to 5555 because each means "wherever the dev server is": Playwright reuses a running one rather than starting its own, and the screenshot script requires one.
pnpm screenshots drives scripts/screenshots.js. Each shot is one 1280x1028 viewport captured by element, not a full page, and every route is longer than that — so no shot in the current set reaches the footer. A version bump alone therefore does not require regenerating them, and the footer fix of 2026-08-19 left all twelve untouched. Bump package.json first anyway if you regenerate for a release, in case a future shot does frame it. Dark-mode shots go through prefers-color-scheme, not the footer toggle.
Package manager: pnpm 11, as engines.pnpm. There is deliberately no packageManager field. An exact pin makes pnpm switch to that version, and for any 11.x target the switch goes through @pnpm/exe (packageManagerDeps() only drops it from pnpm 12) — which has published no macOS Intel binary since pnpm 11: @pnpm/macos-x64 stops at 10.34.5. So on an Intel Mac, the moment the installed pnpm differs from the pin — which it does at every pnpm release — install, dev and build all die on Cannot verify the identity of the @pnpm/exe.darwin-x64 native binary. Apple Silicon never sees it. The exact version is pinned in .github/workflows/deploy.yml instead, where the runner is linux-x64. pnpm 12 will reopen the question.
Node.js 22.13+ required — pnpm 11 uses node:sqlite and crashes on Node 20. Both engines are enforced at install time: .npmrc sets engine-strict=true, and pnpm throws on an unsatisfied engines.pnpm regardless. engines.node is a floor, not the tested version: CI runs the Active LTS (24 today), and the Homebrew formula installs whatever the unversioned node is, which tracks Current. Three different Node majors are therefore in play at once, on purpose.
The Homebrew formula depends on node, never node@N. Every versioned Node formula is keg-only, so Homebrew never links one onto PATH — and Homebrew's pnpm is the JavaScript package, whose shebang is #!/usr/bin/env node and which only depends on node for :build and :test. With node@22 a Mac with no Node of its own — which is every Mac out of the box — got env: node: No such file or directory from microfolio and from a bare pnpm alike. Pinning the LTS with node@24 does not fix it: it is keg-only too, and putting its opt_bin on the wrapper's PATH would rescue microfolio … while leaving the hundred pnpm … commands in the docs broken.
pnpm 11 no longer reads the pnpm field in package.json — its settings live in pnpm-workspace.yaml, where allowBuilds lists which dependencies may run install scripts (build scripts are blocked by default) and minimumReleaseAgeExclude records packages accepted despite being published in the last 24h.
Testing
- Unit — Vitest, co-located
src/**/*.test.jsandscripts/**/*.test.js.vitest.config.jsdeliberately omits the SvelteKit plugin, so these cover plain modules only (the content parsing, the update script) and run in well under a second. They run on every fork's CI too, so they must hold on a site that set its ownurland deleted the demo zip:markdown.test.jsmocksconfig.jsfor the base-path case rather than read the site's, andinstall-demo.test.jsskips the two tests that need the real archive when it is absent. A 0.14.0 fork that followed the docs had three red tests and a red badge for this. - End-to-end — Playwright, specs in
e2e/. It starts its own dev server, or reuses one already running on the port. SetPLAYWRIGHT_PORTto exercise the CI path locally without colliding with a dev server on 5555. - Smoke —
pnpm test:smoke,e2e/smoke/underplaywright.smoke.config.js. The only suite that loadsbuild/rather than a dev server: it serves the artefact withvite previewand walks its pages, asserting each returns 200, hydrates, throws nothing, and asks for no same-origin file it does not have. Cross-origin requests are filtered out — the font CDN and the tile server are somebody else's uptime and have no business failing a deploy. Deliberately shallow: behaviour is the e2e suite's job, this one is about the artefact. It runs in ~5s and it earns its place — reverting the?worker&urlfix in the map route makes it fail with404 …/maplibre-gl-shared.mjswhile all 29 e2e tests still pass. - The smoke suite always runs against a production build, because
vite previewsetsNODE_ENV=productionitself whatever the build was made with. So it serves under/microfolioeven after a plainpnpm build, and the origin root 404s.playwright.smoke.config.jssetsNODE_ENV=productionat the top of the file sogetBasePath()agrees with the server by construction; locally, pair it withpnpm deploy, notpnpm build. It lives there rather than in thetest:smokescript because aVAR=valueprefix is POSIX shell syntax that Windows does not understand — for the same reasonpnpm deployisnode build.js --productionand not aNODE_ENV=prefix. Its routes are relative and itsbaseURLends in a slash — Playwright joins them withnew URL(), where a leading slash would drop the base path. - CI (
.github/workflows/deploy.yml) runs lint, unit tests and e2e, then builds, then smoke-tests the build before uploading it. The demo unzip, lint and e2e steps run only onaker-dev/microfolio(if: github.repository == …): a fork or clone publishes someone's portfolio, whose Markdown was not written for Prettier and whose projects are not the demo the e2e suite counts on — there, unit tests, build and smoke are what runs. For the same reason the smoke suite's project page is the first valid project found incontent/projects/, notexample-project, which a real site deletes. It has no image step of its own:pnpm buildoptimizes first, undersiteConfig.images.optimizeOnBuild, so a deployed site and a local one carry the same images.example_projects.zipships only JPEGs plus one small real PDF per project, and the demo was published at full size until that was true. - A second job builds on
windows-latest— install,pnpm demo, build, smoke — and deliberately does not gatedeploy, which keepsneeds: build: the site ships from the ubuntu build, so a Windows regression is a red check to fix rather than a reason to hold a publication. It exists because microfolio is written on macOS and published from Linux, and the Windows path was only ever tested by hand:build.jsspawnednpx, which isnpx.cmdthere and which Node refuses to launch without a shell, sopnpm builddied onspawn npx ENOENT. Worse and quieter,generate-optimized-images.jsandclean-optimized-images.jscomparedimport.meta.urlagainst a hand-built`file://${process.argv[1]}`— never equal on Windows, whereargv[1]isC:\…and the URL isfile:///C:/…— so both scripts exited 0 having done nothing, and a fixed build would have shipped a site with no WebP at all. Nothing spawns a shim any more:build.jsrunsprocess.execPathagainst a bin path resolved through the dependency'spackage.json, because vite'sexportsmap publishes./package.jsonbut not./bin/*. Lint and e2e stay on ubuntu — neither is platform-specific, and both would only double the wait. - Some specs run with
javaScriptEnabled: falseto assert that/listand/projectsreally do ship their content in the HTML, and others under a phone viewport. Everything else waits ondata-hydrated, an attribute+layout.sveltesets on<html>once the tree is interactive: the whole page is prerendered, so a click can otherwise land on markup with no listener attached and be lost. That failure only ever showed on the slower CI runner.
What a green suite will not tell you
Look at anything visual. The rebuilt lightbox shipped with its panel translucent, the page showing through the metadata, and every test passed — they asserted presence, not legibility. Take a screenshot and read it.
Compare checksums on anything generated. Two of the documentation screenshots were byte-identical for a while because a scroll silently did nothing; the images looked plausible individually. md5 -q doc/screenshots/*.png | sort | uniq -d catches it in a second.
Do not trust a long-running dev server. One left running on 5555 served stale code twice in a single session, once nearly leading to the conclusion that a working feature was broken. Verify against a fresh server: CI=true PLAYWRIGHT_PORT=5199 pnpm test:e2e.
A green dev server says nothing about the build. MapLibre builds its worker URL at runtime from a name it assembles, which Rollup cannot see through: the production build referenced a worker chunk it had never emitted, so the map came up blank with no tile request at all — while pnpm dev was perfect. pnpm build then serving build/ is the only way that surfaces. pnpm test:smoke now does exactly that on every deploy, but it only visits the routes it is told about: a new page is not covered until it is added to PAGES in e2e/smoke/built-site.spec.js.
An overlay that covers something interactive also captures its events. The map's veil spanned the whole map, so selecting a project froze it — no panning, no zooming, no reaching another marker. It went unnoticed for as long as it did because looking at a screenshot cannot reveal it either: the fix is pointer-events-none on the layer and pointer-events-auto on what should still be clickable, and the check is document.elementFromPoint() on a spot that ought to reach through.
Architecture
Content System
Projects live in /content/projects/{slug}/ with:
index.md— YAML frontmatter (title, date, location, coordinates, type, tags, featured, authors) + Markdown bodythumbnail.jpg— Project thumbnail (optionalthumbnail.webpfor optimized version)images/,videos/,documents/— Resource subdirectories
Homepage content: /content/index.md. About page: /content/about.md.
Data Loading
All routes use server-side loading (+page.server.js) that reads content from the filesystem at build time:
src/routes/+page.server.js— Loads the homepage vialoadMarkdownPage(), then filtersloadProjects()onfeatured: truesrc/routes/projects/+page.server.js— Delegates to$lib/utils/projects.jsshared loadersrc/routes/projects/[slug]/+page.server.js— Validates the frontmatter, then loads resources and EXIF metadata; a project that fails validation 404s rather than half-renderingsrc/routes/list/,map/,about/— Each has its own+page.server.js
Content parsing goes through $lib/utils/markdown.js, never an ad-hoc split('---'): its regex stops at the first closing delimiter, so a --- horizontal rule in the body stays in the body.
Key Utilities
$lib/utils/paths.js—getBasePath(): returns/microfolioin production, empty string otherwise (mirrorssvelte.config.jslogic). Server-only: it readsprocess.env, so client code usesbasefrom$app/pathsinstead$lib/utils/projects.js—loadProjects(): shared project loading used by the homepage,/projects,/list,/map. Validates each project, sorts by date, and reports skipped ones once per build$lib/utils/markdown.js—splitFrontmatter(),renderMarkdownBody(),loadMarkdownPage()$lib/utils/projectFrontmatter.js—parseProjectFrontmatter(): returns{ metadata }or{ problem }with a plain-language reason$lib/utils/locale.js—getTextDirection(), shared byhooks.server.js(prerender) and+layout.svelte(client)$lib/utils/imageMetadata.js— EXIF/IPTC extraction viaexifreader(credit, camera, GPS, etc.)$lib/utils/date.js—formatProjectDate(): theYYYY-MMshown everywhere a project is dated. It was written out four times before$lib/config.js— Site config, and deliberately only what someone setting up their site needs: title,url, social links, navigation,ogImage,images.optimizeOnBuild,font.url,font.family,lightbox.hideControlsDelay,lightbox.showExtendedMetadata. Tile provider URLs and zoom limits live in the map route instead$lib/utils/seo.js—absoluteUrl(): takes a route path without the base, becausesiteConfig.urlalready carries it$lib/i18n.js— Internationalization setup withsvelte-i18n(en/fr active, more commented out)
Styling
- Tailwind CSS 4 configured in
src/app.csswith@tailwindcss/typographyplugin - Custom theme in
src/lib/theme.css - Dark mode has two layers: a
prefers-color-schememedia query for the default, and a.dark/.lightclass on:rootfor the explicit toggle inAkFooter(persisted inlocalStorage). An inline script inapp.htmlapplies the stored choice before first paint to avoid a flash - Font:
siteConfig.font—url(Bunny Fonts by default) andfamily.hooks.server.jswrites them intoapp.html's%microfolio.font%at prerender: preconnect + stylesheet, then an unlayered:root{--default-font-family:…}that beats the@themedefault inapp.css. It lives in config rather thanapp.htmlbecause the update script protectsconfig.jsand overwritesapp.html; a config without afontblock falls back to IBM Plex rather than to no font src/app.cssalso holds the rules no component owns: a global:focus-visibleoutline so keyboard focus is never invisible,.ak-filters :disabledfor the pre-hydration state described under Components, and the map block —.ak-markerplus the overrides that flatten MapLibre's own chrome. Those last ones are written with two classes rather than one, because MapLibre's stylesheet is imported by the map route and therefore lands after this file: matching its specificity would leave the winner down to injection order
Components
All custom components use Ak prefix (e.g., AkHeader, AkFooter, AkProjectCard, AkProjectSummary, AkFilters, AkLightbox, AkOptimizedImage). Datatable components (Datatable, Search, ThSort, ThFilter, Pagination, RowCount, RowsPerPage) power the /list view using @vincjo/datatables.
AkFilters builds its TableHandler in the component body rather than in an $effect, because effects never run on the server — that is what puts the rows of /list and the cards of /projects in the prerendered HTML. Only restoring state from the query string still waits for the browser. Its controls carry disabled until onMount, so a click landing before hydration cannot be silently lost. Below md its whole panel collapses behind a button that counts the active filters.
Two components render a project, and the room decides which. AkProjectCard leads with a 4:3 thumbnail and belongs in the grids of the homepage and /projects. AkProjectSummary is text-first and belongs where an image would crowd the text out: the map callout, and /list below md. The whole summary is one link, which is why its tags are plain text — an anchor cannot contain other links.
The map is MapLibre GL on OpenFreeMap, worldwide OpenStreetMap vector tiles with no API key, in Positron for light and Dark for dark — the two neutral styles it publishes, which is why nothing desaturates the map any more. The styles and zoom limits sit at the top of map/+page.svelte, not in config.js. Things about it that are not guessable:
- Coordinates swap. Frontmatter is
[latitude, longitude], MapLibre wants[longitude, latitude].toLngLat()inmap/+page.svelteis the only place they meet — keep it that way - Switching theme swaps the whole style, since light and dark are two published styles rather than one repainted. Markers survive it: they are DOM nodes the map owns, not part of the style. Verified, not assumed — 30 before and after (31 projects, one of which names no place)
fitMaxZoomexists because fitting one project would otherwise frame its roof. The map's ownmaxZoomused to do that job back when it was capped at 6- MapLibre's chrome fights back twice. Its icons are baked dark SVG data URIs with variants only for Windows' forced-colors mode, so they are inverted in dark; and its compact attribution paints itself white through a two-class rule that ties with ours and wins on order, so ours carries a third class. Without it the bar was white with white links on it
Markers are built with createElement, out of reach of a Svelte template, so the star a featured project carries is the same IconStarFilled component mounted into the element (mount/unmount from svelte) — one original, rather than a traced copy free to drift.
MapLibre 6 has no default export; (await import('maplibre-gl')).default is undefined, and every example online still shows otherwise.
/list renders its rows twice. A list of AkProjectSummary below md, the seven-column table from md up — the table needed 840px inside 311px on a phone. Both live in src/routes/list/+page.svelte and iterate the same handler.rows. Add a column to one and you have to add it to the other; nothing in the markup says so. The cards sit flush and are parted by divide-y, echoing the rule between table rows: leave a gap and the rule lands on a card edge, reading as an underline rather than a separation.
Build & Deployment
- Static site generation via
@sveltejs/adapter-static(output:/build) svelte.config.jsdynamically generates prerender entries by scanning/content/projects/vite.config.jscopies thecontent/directory to build output viavite-plugin-static-copy(build only, not dev)- Icons are local components,
src/lib/icons/Icon*.svelte, generated bypnpm icons(scripts/icons.js) from the public Iconify API — 14 Carbon (Apache-2.0) and 3 Akar Icons (MIT), licences insrc/lib/icons/README.md. Each spreads its props onto a1.2em<svg>, exactly whatunplugin-iconsused to emit. To add one: name it in the script'sICONSlist, runpnpm icons, import it.@iconify/jsonwas 437 MB of the 643 MBnode_modulesbefore this; the folder is in.prettierignorebecause it is generated - The site's address is written once, as
siteConfig.url. The base path is its pathname (empty in dev, sopnpm devkeeps serving from/), and every absolute URL —og:image,og:url, canonical, sitemap — is built from it byabsoluteUrl().getBasePath()is the single definition andsvelte.config.jsimports it - There is no CNAME file. Published through an Actions workflow, GitHub Pages ignores any CNAME in the build — the custom domain is set in the repository settings. The one that used to sit in
static/did nothing sitemap.xmlandrobots.txtare prerendered endpoints, listed explicitly insvelte.config.jsentries because nothing links to them and the crawler would never find them- Layout (
+layout.js):prerender = true,trailingSlash = 'always' - Deployment to GitHub Pages is triggered by a push to
main—.github/workflows/deploy.yml(it used to be a separatepreviewbranch until 0.13.2;mainis simpler for forks and clones, which publish with a plain push). Work happens ondev; publishing means mergingdevintomain, and a release tags that merge. The workflow also runs ondev, without deploying (the deploy job and the Pages steps carryif: github.ref == 'refs/heads/main'), so every push todevis checked by the real runner first. Thepreviewbranch was deleted on 2026-08-21: GitHub Pages serves one site per repository, so a staging site would need a second repository and a build-time override ofsiteConfig.url— neither exists - That workflow runs
pnpm demoafter installing, so the demo content CI builds and tests against comes fromcontent/projects/example_projects.zip, not from the working copy..gitignoreignores the demo by name — a block between two marker comments thatpnpm generate-demorewrites from the dataset — and nevercontent/projects/*: a user's projects must reach their repository, and until 0.13.2 they did not, so a site that followed the docs was published by GitHub Pages without a single one of them. It then runs lint, unit tests and e2e before the build pnpm update-microfolio(scripts/update-microfolio.js) moves a site to a release. It downloads the version the site runs and the target from GitHub and decides file by file (decide(), three-way):PROTECTED—content/,src/lib/config.js,static/favicon.svg,static/og.jpg,.env*— is never touched; a file the user never edited takes the new version; one edited on both sides goes throughgit merge-file, and lands as<file>.upstreamnext to the user's when that fails; what changed inconfig.jsupstream is printed, not applied. It refuses a dirty working tree sogit checkout . && git clean -fdcan undo it. Plain Node with no dependencies, on purpose: a copy of it runs in a site that predates it, which is how a 0.x site gets to 1.0. The Homebrew formula should grow amicrofolio updatethat calls itpnpm demo(scripts/install-demo.js) unzips the set intocontent/projects/;--removedeletes exactly the directories the zip lists. It reads the zip itself — central directory, then stored or deflated entries throughinflateRawSync— because the command is for users and Windows ships nounzip. CI andgenerate-demo --installcall the same function- The zip holds the thirty-project "Bauhaus" demo set, produced by
pnpm generate-demo(scripts/generate-demo-projects.js— maintainer tool, shells out tozip). The dataset is handwritten inscripts/demo-projects/projects.js; the images are seeded geometric compositions (compose.js), so regeneration is byte-identical until the dataset changes. Tags never repeat a project'stypeand there is no umbrella tag; at least six projects sharepublic-space, because the e2e pagination specs filter on it withrows=5and need a second page. Eleven arefeaturedso the homepage grid holds twelve withexample-project.--installrefreshes the unzipped working copies (it deletes the gitignored project directories and re-extracts)
Internationalization
- Locale strings in
src/lib/locales/{lang}.json - Default locale set in
$lib/config.js(siteConfig.locale) - RTL support via
getTextDirection():hooks.server.jsfills thelanganddirplaceholders inapp.htmlat prerender, and+layout.svelteupdates them when the locale changes client-side
Deferred
JSON-LD structured data, deliberately left out of the sharing work: a
CreativeWork per project and a site identity on the home page. The frontmatter
already carries everything it needs — title, date, location, authors, type,
tags — so it is a matter of emitting it, not of gathering it.
Project Metadata Schema
title and date are required. A project missing either, or whose YAML does not parse, is skipped from every view and named in a summary at the end of the build — it never fails the build. A missing thumbnail.jpg does not disqualify a project: it sets hasThumbnail: false and the UI shows a placeholder. Validation lives in $lib/utils/projectFrontmatter.js.
title: 'Project Title' # required
date: '2023-01-01' # required, must be parseable by new Date()
location: 'City, Country'
coordinates: [latitude, longitude] # For map display
description: 'Project description'
type: 'architecture' # Used for filtering
tags: ['tag1', 'tag2']
authors:
- name: 'Author Name'
role: 'Role'
featured: true # Shows on homepageDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

