lookbkdev/lookbk-skills / skills/story-rail-kit
story-rail-kit
VerifiedBuild a horizontal rail of rich cards for a website from one rail.json done properly instead of as a janky carousel. Native scroll-snap, Previous and Next buttons that move by exactly one card whatever its width, and a scale under the rail drawn from the cards themselves with a bracket framing what is on screen, so a visitor always knows where they are and how much is left. Five card kinds in a rhythm the build checks (wide, tall, quote, number with its source, and a view-all end card), loops that play only on screen, keyboard support, a mouse drag that never opens a card by accident, and touch that never traps vertical scroll. No auto-advance unless you turn it on. A self-contained page plus a paste-in embed, a check at four widths including keyboard, drag and vertical scrolling, and a frame-by-frame recorder. Use for a home page band of case studies, recipes, articles, collections or products that leads to a "view all" page.
| File | Kind | Size |
|---|---|---|
| NOTICE.md | markdown | 1.5 KB |
| SKILL.md | skill md | 13.7 KB |
| TESTED.json | config | 405 B |
| examples/kestle/rail.json | config | 2.7 KB |
| examples/larder/rail.json | config | 2.7 KB |
| kit/drawn.mjs | script | 22.2 KB |
| kit/fonts/dm-mono-500.woff2 | binary | 14.6 KB |
| kit/fonts/dm-mono-OFL.txt | markdown | 4.4 KB |
| kit/fonts/fraunces-OFL.txt | markdown | 4.4 KB |
| kit/fonts/fraunces-italic.woff2 | binary | 146.2 KB |
| kit/fonts/fraunces.woff2 | binary | 118.2 KB |
| kit/fonts/geist-OFL.txt | markdown | 4.4 KB |
| kit/fonts/geist.woff2 | binary | 28.7 KB |
| kit/fonts/plex-mono-500.woff2 | binary | 14.5 KB |
| kit/fonts/plex-mono-OFL.txt | markdown | 5.2 KB |
| kit/rail.css | other | 11.3 KB |
| kit/runtime.js | script | 16.8 KB |
| scripts/build.mjs | script | 138 B |
| scripts/check.mjs | script | 138 B |
| scripts/chrome.mjs | script | 3.6 KB |
| scripts/kit/build.mjs | script | 12.4 KB |
| scripts/kit/cdp.mjs | script | 4.9 KB |
| scripts/kit/check.mjs | script | 21.7 KB |
| scripts/kit/record.mjs | script | 6.9 KB |
| scripts/kit/schema.mjs | script | 12.6 KB |
| scripts/kit/serve.mjs | script | 2.5 KB |
| scripts/record.mjs | script | 140 B |
| scripts/serve.mjs | script | 138 B |
scripts/kit/serve.mjs
View on GitHub// Story Rail (from the Scroll Cinema kit): serves a built page on http://localhost so it can be
// looked at, with Range requests so the films can seek (Safari needs them).
//
// node scripts/serve.mjs out [--port 4310]
import { createReadStream, existsSync, statSync } from 'node:fs'
import { createServer } from 'node:http'
import { extname, join, normalize, resolve, sep } from 'node:path'
const TYPES = {
'.html': 'text/html; charset=utf-8',
'.mp4': 'video/mp4',
'.webp': 'image/webp',
'.png': 'image/png',
'.jpg': 'image/jpeg',
'.svg': 'image/svg+xml',
'.css': 'text/css; charset=utf-8',
'.js': 'text/javascript; charset=utf-8',
}
/** Serves `dir` (with Range requests, which Safari needs for video); resolves to { url, close }. */
export function serve(dir, port = 0) {
const root = resolve(dir)
const server = createServer((req, res) => {
const path = decodeURIComponent(new URL(req.url, 'http://x').pathname)
let file = normalize(join(root, path))
if (!file.startsWith(root + sep) && file !== root) return res.writeHead(403).end()
if (existsSync(file) && statSync(file).isDirectory()) file = join(file, 'index.html')
if (!existsSync(file)) return res.writeHead(404).end('not found')
const size = statSync(file).size
const type = TYPES[extname(file)] ?? 'application/octet-stream'
const range = /bytes=(\d*)-(\d*)/.exec(req.headers.range ?? '')
if (range) {
const start = range[1] ? Number(range[1]) : size - Number(range[2])
const end = range[1] && range[2] ? Number(range[2]) : size - 1
res.writeHead(206, { 'Content-Type': type, 'Content-Range': `bytes ${start}-${end}/${size}`, 'Accept-Ranges': 'bytes', 'Content-Length': end - start + 1 })
return createReadStream(file, { start, end }).pipe(res)
}
res.writeHead(200, { 'Content-Type': type, 'Content-Length': size, 'Accept-Ranges': 'bytes' })
createReadStream(file).pipe(res)
})
return new Promise((ok) =>
server.listen(port, '127.0.0.1', () => ok({ url: `http://127.0.0.1:${server.address().port}/`, close: () => server.close() })),
)
}
export async function main(argv = process.argv.slice(2)) {
const dir = argv.find((a) => !a.startsWith('--')) ?? 'out'
const i = argv.indexOf('--port')
const port = i >= 0 ? Number(argv[i + 1]) : 4310
if (!existsSync(join(dir, 'index.html'))) {
console.error(`${dir}/index.html not found; build the page first`)
process.exit(1)
}
const { url } = await serve(dir, port)
console.log(`serving ${dir} at ${url} (Ctrl+C to stop)`)
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| 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: 196k | Updated | Claude CodeCodex | Verified | Install |