Skip to content

lookbkdev/lookbk-skills / skills/shop-collection-kit

shop-collection-kit

Verified

Build a small brand's collection or category page from one page.json - a collection header with the brand's point of view, a sticky filter bar whose chips re-lay the grid with a FLIP glide (no jump), numbered product plates that turn over on hover, focus or tap to show the reverse of the piece (the raw foot and maker's stamp, the hallmark inside a band), swatches that change the photograph, honest prices with their currency and one plain stock line (low, back soon with a date, sold out with Notify me), an editorial band in the grid, a quick-view sheet with options, sizes and per-option stock, and an Add to bag that turns into a bag slip. Phone layout with a 2-up grid, a sticky chip bar, a filter sheet and bottom sheets. Includes a three.js still-life renderer that makes true-scale product photographs (ceramics, jewellery) from the same config when the shop has no photos yet, a check at four widths and a frame-by-frame recorder. Use for independent shops: ceramics, jewellery, homewares, small-batch goods.

FileKindSize
NOTICE.mdmarkdown2.1 KB
SKILL.mdskill md17.8 KB
TESTED.jsonconfig524 B
examples/sorne/page.jsonconfig17.4 KB
examples/sorne/photos/band-gold-turn.webpbinary13.9 KB
examples/sorne/photos/band-gold.webpbinary15.0 KB
examples/sorne/photos/band-silver-turn.webpbinary12.4 KB
examples/sorne/photos/band-silver.webpbinary13.5 KB
examples/sorne/photos/disc-pendant-gold-turn.webpbinary19.7 KB
examples/sorne/photos/disc-pendant-gold.webpbinary16.5 KB
examples/sorne/photos/ed-375.webpbinary33.6 KB
examples/sorne/photos/moonstone-gold-turn.webpbinary14.1 KB
examples/sorne/photos/moonstone-gold.webpbinary15.7 KB
examples/sorne/photos/onyx-silver-turn.webpbinary13.8 KB
examples/sorne/photos/onyx-silver.webpbinary14.7 KB
examples/sorne/photos/pearl-studs-gold-turn.webpbinary9.9 KB
examples/sorne/photos/pearl-studs-gold.webpbinary10.2 KB
examples/sorne/photos/scale.jsonconfig1.7 KB
examples/sorne/photos/small-hoops-gold-turn.webpbinary18.2 KB
examples/sorne/photos/small-hoops-gold.webpbinary18.2 KB
examples/sorne/photos/small-hoops-silver-turn.webpbinary15.7 KB
examples/sorne/photos/small-hoops-silver.webpbinary16.0 KB
examples/sorne/photos/stack-gold-turn.webpbinary17.8 KB
examples/sorne/photos/stack-gold.webpbinary26.5 KB
examples/sorne/photos/wide-hoops-gold-turn.webpbinary30.3 KB
examples/sorne/photos/wide-hoops-gold.webpbinary30.4 KB
examples/wrenfold/page.jsonconfig9.4 KB
examples/wrenfold/photos/breakfast-bowl-celadon-turn.webpbinary14.8 KB
examples/wrenfold/photos/breakfast-bowl-celadon.webpbinary11.1 KB
examples/wrenfold/photos/breakfast-bowl-iron-turn.webpbinary15.7 KB
examples/wrenfold/photos/breakfast-bowl-iron.webpbinary12.8 KB
examples/wrenfold/photos/breakfast-bowl-oat-turn.webpbinary16.2 KB
examples/wrenfold/photos/breakfast-bowl-oat.webpbinary14.1 KB
examples/wrenfold/photos/bud-vase-ash-turn.webpbinary13.3 KB
examples/wrenfold/photos/bud-vase-ash.webpbinary11.2 KB
examples/wrenfold/photos/bud-vase-celadon-turn.webpbinary14.2 KB
examples/wrenfold/photos/bud-vase-celadon.webpbinary13.0 KB
examples/wrenfold/photos/carafe-oat-turn.webpbinary18.5 KB
examples/wrenfold/photos/carafe-oat.webpbinary16.1 KB
examples/wrenfold/photos/ed-kiln.webpbinary31.5 KB
examples/wrenfold/photos/pasta-plate-iron-turn.webpbinary27.5 KB
examples/wrenfold/photos/pasta-plate-iron.webpbinary20.7 KB
examples/wrenfold/photos/pasta-plate-oat-turn.webpbinary27.8 KB
examples/wrenfold/photos/pasta-plate-oat.webpbinary21.6 KB
examples/wrenfold/photos/scale.jsonconfig2.2 KB
examples/wrenfold/photos/serving-bowl-iron-turn.webpbinary23.6 KB
examples/wrenfold/photos/serving-bowl-iron.webpbinary17.4 KB
examples/wrenfold/photos/side-plate-chalk-turn.webpbinary16.9 KB
examples/wrenfold/photos/side-plate-chalk.webpbinary12.1 KB
examples/wrenfold/photos/tea-bowl-ash-turn.webpbinary10.7 KB
examples/wrenfold/photos/tea-bowl-ash.webpbinary9.7 KB
examples/wrenfold/photos/tea-bowl-celadon-turn.webpbinary10.1 KB
examples/wrenfold/photos/tea-bowl-celadon.webpbinary9.0 KB
examples/wrenfold/photos/tumblers-mixed-turn.webpbinary15.2 KB
examples/wrenfold/photos/tumblers-mixed.webpbinary13.5 KB
scripts/build.mjsscript147 B
scripts/check.mjsscript147 B
scripts/chrome.mjsscript3.6 KB
scripts/kit/build.mjsscript30.1 KB
scripts/kit/cdp.mjsscript4.9 KB
scripts/kit/check.mjsscript25.0 KB
scripts/kit/record.mjsscript6.0 KB
scripts/kit/runtime.jsscript20.9 KB
scripts/kit/serve.mjsscript2.5 KB
scripts/kit/style.cssother21.9 KB
scripts/record.mjsscript149 B
scripts/serve.mjsscript147 B
scripts/stills.mjsscript215 B
scripts/stills/objects.jsscript28.9 KB
scripts/stills/render.mjsscript8.0 KB
scripts/stills/shapes.jsscript30.9 KB
scripts/stills/studio.htmlother480 B
scripts/stills/studio.jsscript38.2 KB

scripts/kit/record.mjs

View on GitHub
// Shop Collection Kit: records the built page frame by frame into a video and
// a poster, following the page's own tour (rest on the collection header,
// scroll to the plates, turn one over, change a swatch, filter to one
// category and back, open the quick view, choose, add to bag).
//
//   node scripts/record.mjs out/index.html [--seconds 15.6] [--size 1920x1080] [--poster 4.4]
//   node scripts/record.mjs out/index.html --still 4 [--size 390x844 --scale 2] [--png file.png]
//   node scripts/record.mjs out/index.html --moments [--size 390x844]
//
// --moments prints, as JSON, every stretch where nothing on screen is mid-way
// (no plate turning, gliding or fading, no sheet sliding): [name, from, to]
// in seconds. Take stills inside them.
//
// The page runs with ?sck-record=1: nothing moves on its own, and for every
// frame the recorder asks it to seek to that exact time and draw, so the video
// is the same on any machine however slow it is. Writes out/preview.mp4
// (30 fps, no sound) and out/poster.png, or one PNG.
import { spawnSync } from 'node:child_process'
import { existsSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { dirname, join, relative, resolve } from 'node:path'
import { launch } from './cdp.mjs'
import { serve } from './serve.mjs'

function args(argv) {
  const out = { _: [] }
  for (let i = 0; i < argv.length; i++) {
    const a = argv[i]
    if (!a.startsWith('--')) out._.push(a)
    else {
      const [k, v] = a.slice(2).split('=')
      out[k] = v ?? (argv[i + 1] && !argv[i + 1].startsWith('--') ? argv[++i] : true)
    }
  }
  return out
}
const shown = (p) => {
  const r = relative(process.cwd(), p)
  return r.startsWith('..') ? p : r
}
function ffmpeg(argv) {
  const bin = process.env.FFMPEG_PATH || 'ffmpeg'
  const r = spawnSync(bin, ['-hide_banner', '-loglevel', 'error', '-y', ...argv], { stdio: ['ignore', 'inherit', 'pipe'] })
  if (r.error) throw new Error('ffmpeg not found: install it (brew install ffmpeg, winget install ffmpeg, apt install ffmpeg) or set FFMPEG_PATH')
  if (r.status !== 0) throw new Error(`ffmpeg failed: ${String(r.stderr).slice(-600)}`)
}

export async function record(input, opts = {}) {
  const file = resolve(input)
  if (!existsSync(file)) throw new Error(`${input} not found; build the page first`)
  const out = dirname(file)
  const [w, h] = String(opts.size ?? '1920x1080').split('x').map(Number)
  const scale = Number(opts.scale ?? 1)
  const fps = Number(opts.fps ?? 30)
  const server = await serve(out)
  const chrome = await launch({ width: w, height: h })
  const tmp = mkdtempSync(join(tmpdir(), 'shop-collection-kit-'))
  const errors = []
  try {
    const tab = await chrome.page()
    chrome.on('Runtime.exceptionThrown', (p) => errors.push(p.exceptionDetails?.exception?.description ?? p.exceptionDetails?.text))
    await tab.send('Page.enable')
    await tab.send('Runtime.enable')
    await tab.send('Emulation.setDeviceMetricsOverride', { width: w, height: h, deviceScaleFactor: scale, mobile: w < 760 })
    const loaded = tab.once('Page.loadEventFired', 60000)
    await tab.send('Page.navigate', { url: `${server.url}${relative(out, file)}?sck-record=1` })
    await loaded
    const ev = async (expression) => {
      const r = await tab.send('Runtime.evaluate', { expression, awaitPromise: true, returnByValue: true })
      if (r.exceptionDetails) throw new Error(r.exceptionDetails.exception?.description ?? r.exceptionDetails.text)
      return r.result.value
    }
    for (let i = 0; i < 100 && !(await ev('!!(window.ShopCollectionKit && window.ShopCollectionKit.seek)')); i++) await new Promise((r) => setTimeout(r, 100))
    if (!(await ev('!!(window.ShopCollectionKit && window.ShopCollectionKit.seek)'))) throw new Error(`the page did not start: ${errors.join(' | ') || 'unknown'}`)
    await ev('window.ShopCollectionKit.ready')
    const length = Number(opts.seconds ?? (await ev('window.ShopCollectionKit.length')))
    if (opts.moments) return { moments: { length, moments: await ev('window.ShopCollectionKit.moments()') } }
    const shot = async (t, path) => {
      await ev(`window.ShopCollectionKit.seek(${t})`)
      const { data } = await tab.send('Page.captureScreenshot', { format: 'png' })
      writeFileSync(path, Buffer.from(data, 'base64'))
    }
    if (opts.still !== undefined) {
      const png = resolve(opts.png ?? join(out, 'still.png'))
      await shot(Math.min(Math.max(Number(opts.still) || 0, 0), length), png)
      return { png }
    }
    const frames = Math.round(length * fps)
    for (let i = 0; i < frames; i++) await shot(i / fps, join(tmp, `${String(i + 1).padStart(5, '0')}.png`))
    const mp4 = join(out, 'preview.mp4')
    ffmpeg(['-framerate', String(fps), '-i', join(tmp, '%05d.png'), '-vf', `scale=${w}:${h}:flags=lanczos,format=yuv420p`, '-c:v', 'libx264', '-preset', 'slow', '-crf', String(opts.crf ?? 18), '-movflags', '+faststart', mp4])
    const posterAt = Math.min(Math.max(Number(opts.poster ?? 4.4), 0), length - 1 / fps)
    const poster = join(out, 'poster.png')
    ffmpeg(['-ss', String(posterAt), '-i', mp4, '-frames:v', '1', '-update', '1', poster])
    if (errors.length) console.warn(`page errors: ${errors.join(' | ')}`)
    return { mp4, poster }
  } finally {
    await chrome.close()
    server.close()
    rmSync(tmp, { recursive: true, force: true })
  }
}

export async function main(argv = process.argv.slice(2)) {
  const a = args(argv)
  const [input] = a._
  if (!input) {
    console.log('usage: node scripts/record.mjs out/index.html [--seconds 15.6] [--size 1920x1080] [--poster 4.4]\n       node scripts/record.mjs out/index.html --still SECONDS [--size 390x844 --scale 2] [--png file.png]\n       node scripts/record.mjs out/index.html --moments [--size 390x844]')
    process.exit(1)
  }
  try {
    const r = await record(input, a)
    if (r.moments) console.log(JSON.stringify(r.moments))
    else if (r.png) console.log(`wrote ${shown(r.png)}`)
    else console.log(`wrote ${shown(r.mp4)} and ${shown(r.poster)}`)
  } catch (e) {
    console.error(e.message)
    process.exit(1)
  }
}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 196kUpdated Claude CodeCodexVerifiedInstall