anbeime/skill / skills/hairline/hairline/skills/hairline-create
hairline-create
VerifiedUse when someone asks for a new Hairline figure, or runs /hairline-create with an idea. Draws one isometric line figure that answers the pointer, in the style and on the engine of @lucasmarkes/hairline, and hands it over as a single self-contained HTML file.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 7.0 KB |
| bench.html | other | 8.1 KB |
| build.mjs | script | 2.1 KB |
| concepts.md | markdown | 6.3 KB |
| examples/riffle.js | script | 7.2 KB |
| examples/terrain.js | script | 4.3 KB |
| kernel.js | script | 27.3 KB |
| look.md | markdown | 9.7 KB |
| look.mjs | script | 28.0 KB |
| read.mjs | script | 19.2 KB |
| rules.md | markdown | 10.3 KB |
| source.md | markdown | 3.3 KB |
| validate.mjs | script | 15.3 KB |
build.mjs
View on GitHub#!/usr/bin/env node
/**
* Puts a figure on the bench: `node build.mjs <figure.js> [out.html]` writes
* one self-contained page, bench.html with kernel.js and the figure in its two
* slots and nothing else changed, and prints where it is. Without a path the
* page is hairline-<name>.html in the working directory.
*/
import { readFileSync, realpathSync, writeFileSync } from "node:fs";
import { resolve } from "node:path";
import { fileURLToPath } from "node:url";
const here = (p) => fileURLToPath(new URL(p, import.meta.url));
/** The page for a figure's source. The replacements are functions so `$&` in the kernel or the figure is pasted as it is. */
export function assemble(figure) {
const kernel = readFileSync(here("./kernel.js"), "utf8").replace(/\r\n/g, "\n").trimEnd();
return readFileSync(here("./bench.html"), "utf8").replace(/\r\n/g, "\n")
.replace("/*KERNEL*/", () => `\n${kernel}\n`)
.replace("/*FIGURE*/", () => `\n${figure.replace(/\r\n/g, "\n").trim()}\n`);
}
/** The figure's name, read from its declaration: the last hairline({ … }) call, as validate.mjs reads it, so a `name:` earlier in the figure is not taken for it. */
export function nameOf(figure) {
const call = [...figure.matchAll(/\bhairline\s*\(\s*\{/g)].at(-1);
return call ? /\bname:\s*["'`]([a-z][a-z0-9-]*)["'`]/.exec(figure.slice(call.index))?.[1] ?? null : null;
}
/** Whether two resolved paths are one file. Windows paths ignore case, and the drive letter's case can differ between the two. */
export const same = (a, b, platform = process.platform) => platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
/* The skill is often installed as a symlink, so the path Node was given is resolved before it is compared. */
if (process.argv[1] && same(realpathSync(process.argv[1]), realpathSync(here("./build.mjs")))) {
const [src, out] = process.argv.slice(2);
if (!src) {
console.error("usage: node build.mjs <figure.js> [out.html]");
process.exit(2);
}
const figure = readFileSync(src, "utf8");
const file = resolve(out ?? `hairline-${nameOf(figure) ?? "figure"}.html`);
writeFileSync(file, assemble(figure));
console.log(file);
}
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: 194k | 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: 194k | 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: 194k | Updated | Claude CodeCodex | Verified | Install |