paperclipai/paperclip / .agents/skills/directions-lab
directions-lab
VerifiedScaffold a directions lab that shows shipped UI (Today) beside 2-3 design directions, with surface tabs, theme and animation toggles and the V1 MVP hover motion, registered in design-proposals Storybook. Use for a directions page or lab, or to explore design directions next to production.
scripts/lib/write.mjs
View on GitHubimport { existsSync, mkdirSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
import path from "node:path";
export const MAX_LINES = 600;
export const COMMENT_LINE = /^\s*(\/\/|\/\*|\{\/\*|<!--)/;
export const VITEST_PRAGMA = /^\/\/ @vitest-environment [a-z-]+$/;
export function commentLines(content) {
const hits = [];
content.split("\n").forEach((line, index) => {
if (index === 0 && VITEST_PRAGMA.test(line)) return;
if (COMMENT_LINE.test(line)) hits.push(index + 1);
});
return hits;
}
export function lineCount(content) {
return content.endsWith("\n") ? content.split("\n").length - 1 : content.split("\n").length;
}
export function checkRendered(files, { root }) {
const errors = [];
for (const [relative, content] of files) {
if (typeof content !== "string" || !content.trim()) errors.push(`${relative}: rendered empty`);
const comments = commentLines(content ?? "");
if (comments.length) errors.push(`${relative}: comment line(s) at ${comments.slice(0, 5).join(", ")}; generated code carries no comments`);
const lines = lineCount(content ?? "");
if (lines >= MAX_LINES) errors.push(`${relative}: ${lines} lines reaches the ${MAX_LINES}-line limit`);
if (existsSync(path.join(root, relative))) errors.push(`${relative}: already exists; refusing to overwrite`);
}
return errors;
}
export function newJournal() {
return { files: [], dirs: [] };
}
export function writeFiles(files, { root, journal = newJournal() }) {
for (const [relative] of files) {
let dir = path.dirname(path.join(root, relative));
const missing = [];
while (!existsSync(dir)) {
missing.unshift(dir);
dir = path.dirname(dir);
}
for (const created of missing) {
if (!journal.dirs.includes(created)) journal.dirs.push(created);
mkdirSync(created);
}
}
for (const [relative, content] of files) {
const target = path.join(root, relative);
writeFileSync(target, content);
journal.files.push(target);
}
return journal;
}
export function rollback(journal) {
for (const file of journal.files) if (existsSync(file)) unlinkSync(file);
const dirs = [...journal.dirs].sort((a, b) => b.length - a.length);
for (const dir of dirs) if (existsSync(dir) && statSync(dir).isDirectory()) rmSync(dir, { recursive: true, force: true });
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |