Agent skills that give coding agents taste: art direction, reference images and a browser check instead of generic AI pages
JavaScript agent-skillsai-agentsanti-slopclaude-codecodexcursordesign-systemfrontendlanding-pageui-designweb-design
Product pages build their interface fragments by the app rules; Chrome profiles removed reliably
Leonxlnx7d84c08f013f
diff --git a/skills/taste-skill/SKILL.md b/skills/taste-skill/SKILL.mdindex cf94908..a8dc56d 100644--- a/skills/taste-skill/SKILL.md+++ b/skills/taste-skill/SKILL.md@@ -45,8 +45,19 @@ Decide first which of two kinds of work this is.whole before you start; the page run below does not apply.A product site that shows its app is a page; the interface fragments on it follow the app-screen-rules for their insides. When a request mixes both (a landing page and the dashboard behind it),-build each with its own run and one shared palette and typeface.+rules for their insides. Deal the product's app style once, in its own folder, with the page's colours+and type kept:++```bash+node <skill>/scripts/draw.mjs --app --kind <kind> --brief "<the product>" --keep palette,type --out .taste-skill/app+```++and build every fragment the page shows (the hero's live screen, a feature's crop, a chart) as a real+piece of that app: `assets/app.css` for its panels, tables and controls, `assets/charts.js` for its+charts, real data that adds up, one finding stated, cropped and scaled the way the page's blueprint+treats a picture. A fragment that looks like a working product is the strongest picture a software page+has; grey bars and lorem numbers are the weakest. When a request mixes both (a landing page and the+dashboard behind it), build each with its own run and one shared palette and typeface.## The rundiff --git a/skills/taste-skill/scripts/draw.mjs b/skills/taste-skill/scripts/draw.mjsindex 7282a4f..6db3d89 100644--- a/skills/taste-skill/scripts/draw.mjs+++ b/skills/taste-skill/scripts/draw.mjs@@ -512,7 +512,7 @@ function render(s) {? `\`${ASSETS_CMD} "${qs[0]}"\`${qs.length > 1 ? `, then ${qs.slice(1).map((q) => `"${q}"`).join(' and ')}` : ''}, then queries from your inventory (its street, its materials, its trade's tools and history)`: `\`${ASSETS_CMD} "<a place, material or object from your inventory>"\``;const MODE = {- interface: '**This subject is software and there are no screenshots, so its pictures are its own interface.** Wherever this sheet says photograph, image or object, build a believable fragment of the product in HTML at real size (real labels, numbers that add up, one item hovered or selected), put the attribute `data-ui` on its root, and crop or scale it the way the blueprint treats a photograph: a full-bleed close crop, a tile, the fixed half of a split. Where a fragment makes no sense, use a flat colour field with type on it. Never a fake dashboard of grey bars, never a device frame. If the product works on something physical (ships, plants, buildings, a city), one real picture of that world can carry a section: find it with `' + ASSETS_CMD + ' "<that world>"`, download it with `--get`, credit it on the page, and never let it pass for the product or its customers.',+ interface: '**This subject is software and there are no screenshots, so its pictures are its own interface.** Wherever this sheet says photograph, image or object, build a believable fragment of the product in HTML at real size (real labels, numbers that add up, one item hovered or selected) by the app-screen rules (references/app-screens.md: deal its style once with `node <skill>/scripts/draw.mjs --app --kind <kind> --keep palette,type --out .taste-skill/app`, and build it with assets/app.css and assets/charts.js), put the attribute `data-ui` on its root, and crop or scale it the way the blueprint treats a photograph: a full-bleed close crop, a tile, the fixed half of a split. Where a fragment makes no sense, use a flat colour field with type on it. Never a fake dashboard of grey bars, never a device frame. If the product works on something physical (ships, plants, buildings, a city), one real picture of that world can carry a section: find it with `' + ASSETS_CMD + ' "<that world>"`, download it with `--get`, credit it on the page, and never let it pass for the product or its customers.','no-product-photo': '**There are no photographs of the product and none can be faked.** Wherever this sheet calls for a picture of the object, draw the object: its pieces as flat shapes in inline SVG, large, in one graphic language and in the colours that make it worth buying (a glaze, a finish, a material), never grey placeholders (references/imagery.md §8). **Around the object, use real pictures of its world** from the open collections: its material up close, its town in old postcards, its craft in engravings, a museum piece of the same kind, never one a visitor could take for the product itself (references/imagery.md §3). Start with ' + find + '. Download what you use with `--get` and credit every one on the page (`--credits` prints the footer line). Type at scale and full colour fields carry the rest; the dealt photographs only where they plainly do not pretend to be the product. In your report, say that product photography is needed and which drawings it will replace, and list every found picture with its source and licence.',atmosphere: '**The project has no photographs of its own yet.** First choice: **real pictures of the subject\'s world from the open collections**: its city and street in old postcards and photographs, an old map of the neighbourhood, its materials up close, its trade in engravings, museum objects of its kind (references/imagery.md §3). Start with ' + find + '. Download what you use into the project with `--get` and credit every one on the page (`--credits` prints the footer line). They show the world around the client, never the client\'s own room, dish, product, person or team. Second, for what no honest picture exists of: draw the subject\'s own things in code, large, in one flat graphic language and the palette\'s real colours (its tiles, its windows, its objects; references/imagery.md §8). Third: the dealt photographs, only where an honestly generic picture fits (the sea, the weather, a material), never one a visitor could take for the thing itself and never an unrelated scene. One treatment for all of them. If this direction is built on photographs, plan the set before building (four to six pictures of one family) and reuse them at different crops and scales instead of finding or drawing a new picture for every slot; keep drawings as `<symbol>` + `<use>` or generate them with a small script so the page stays light. List every found picture (with its source and licence), every dealt photograph and every drawing that stands in for photography in your report.',own: '**Use the images that belong to the project in every picture slot.** For slots they cannot fill, real pictures of the subject\'s world from the open collections come next (start with ' + find + '; credit them on the page), then the dealt photographs.',diff --git a/skills/taste-skill/scripts/lib/cdp.mjs b/skills/taste-skill/scripts/lib/cdp.mjsindex 11d6a12..b3b8e01 100644--- a/skills/taste-skill/scripts/lib/cdp.mjs+++ b/skills/taste-skill/scripts/lib/cdp.mjs@@ -1,8 +1,8 @@// Zero-dependency Chrome DevTools Protocol client.// Drives an installed Chrome / Edge / Chromium in headless mode over Node's built-in WebSocket.// Requires Node 22+. No npm install.-import { spawn } from 'node:child_process';-import { existsSync, mkdtempSync, rmSync, writeFileSync, readdirSync, statSync } from 'node:fs';+import { spawn, spawnSync } from 'node:child_process';+import { existsSync, mkdtempSync, rmSync, writeFileSync, readdirSync, statSync, openSync, closeSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';@@ -37,14 +37,20 @@ export function findChrome() {return null;}-// Profiles from runs that were killed before close(): gone after six hours (no run lasts that long).+// Profiles from runs that were killed before close(): removed once no Chrome holds them (a running+// Chrome keeps the profile's lockfile open) and they are a few minutes old.function sweepProfiles(base) {try {- const cutoff = Date.now() - 6 * 3600 * 1000;+ const cutoff = Date.now() - 3 * 60 * 1000;for (const name of readdirSync(base)) {if (!name.startsWith('ad-chrome-')) continue;const p = join(base, name);- try { if (statSync(p).mtimeMs < cutoff) rmSync(p, { recursive: true, force: true }); } catch {}+ try {+ if (statSync(p).mtimeMs > cutoff) continue;+ const lock = join(p, 'lockfile');+ if (existsSync(lock)) closeSync(openSync(lock, 'r+')); // throws while a Chrome holds it+ rmSync(p, { recursive: true, force: true });+ } catch {}}} catch {}}@@ -63,8 +69,14 @@ export class Browser {const base = process.env.TASTE_SKILL_TMP || tmpdir();sweepProfiles(base);const dir = mkdtempSync(join(base, 'ad-chrome-'));- const drop = () => { try { rmSync(dir, { recursive: true, force: true }); } catch {} };+ // On exit Chrome still holds the profile's files: stop it first, then remove the folder.+ let pid = 0;+ const drop = () => {+ try { if (pid) { if (process.platform === 'win32') spawnSync('taskkill', ['/pid', String(pid), '/T', '/F'], { stdio: 'ignore' }); else process.kill(pid, 'SIGKILL'); } } catch {}+ try { rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); } catch {}+ };process.once('exit', drop);+ for (const sig of ['SIGINT', 'SIGTERM', 'SIGHUP']) process.once(sig, () => { drop(); process.exit(130); });const args = ['--headless=new', '--remote-debugging-port=0', `--user-data-dir=${dir}`,'--disk-cache-size=16777216', '--media-cache-size=16777216',@@ -75,6 +87,7 @@ export class Browser {'--enable-unsafe-swiftshader', `--window-size=${width},${height}`, ...extraArgs, 'about:blank',];const proc = spawn(exe, args, { stdio: ['ignore', 'ignore', 'pipe'] });+ pid = proc.pid;const wsUrl = await new Promise((resolve, reject) => {let buf = '';const t = setTimeout(() => reject(new Error('Chrome did not start within 20s')), 20000);