xinetzone/SpecWeave / .agents/skills/design-library-creator
design-library-creator
FlaggedCreate, expand, and refine professional Design Libraries / Design Systems with structured token architecture. ONLY invoke when user EXPLICITLY mentions design-system terminology: 'Design Library', 'Design System', '设计系统', '设计库', 'token system', 'design tokens', '组件库规范', or provides a parsed design-spec bundle (ZIP/Figma export). Also covers creating a new theme / color theme as a design-system deliverable (创建主题/新建暖色主题/深色主题等 — tokens + palette + component styling). Do NOT route here for: '素材库', '全套素材', '素材合集', '物料库', '生成素材', '做一套设计', '做几张图', '设计一套页面', '帮我出图', page/poster/landing-page creation, or any visual-asset generation intent where the user does not demonstrate knowledge of design-system concepts. Those belong to solo-design.
scripts/validate-token-input.mjs
View on GitHub#!/usr/bin/env node
import fs from 'node:fs';
import path from 'node:path';
import { readDataFile, resolveDataPath } from './jsonl-utils.mjs';
const MAX_TOKEN_BYTES = 65536;
const OLD_SCHEMA_FIELDS = ['brandSignals', 'unresolvedReferences', 'rawSpecAnnotations'];
function parseArgs(argv) {
const args = {
tokenPath: undefined,
legacyCssPath: undefined,
};
for (let index = 0; index < argv.length; index += 1) {
const arg = argv[index];
if (arg === '--legacy-css') {
args.legacyCssPath = argv[index + 1];
index += 1;
} else if (arg === '--json') {
// JSON output is the only output mode; keep flag for explicit callers.
} else if (!arg.startsWith('--') && !args.tokenPath) {
args.tokenPath = arg;
}
}
return args;
}
function legacyExists(legacyCssPath) {
return Boolean(legacyCssPath && fs.existsSync(legacyCssPath) && fs.statSync(legacyCssPath).isFile());
}
function fail(summary, reason, legacyCssPath) {
summary.errors.push(reason);
if (legacyExists(legacyCssPath)) {
summary.ok = true;
summary.mode = 'bundle';
summary.fallbackReason = reason;
} else {
summary.ok = false;
summary.mode = 'fail';
}
return summary;
}
function hasOldVariablesValues(value) {
if (!value || typeof value !== 'object') return false;
if (Array.isArray(value)) return value.some((entry) => hasOldVariablesValues(entry));
if (Array.isArray(value.variables)) {
return value.variables.some((variable) => variable && typeof variable === 'object' && 'values' in variable);
}
return Object.values(value).some((entry) => hasOldVariablesValues(entry));
}
const { tokenPath, legacyCssPath } = parseArgs(process.argv.slice(2));
const summary = {
ok: false,
mode: 'fail',
status: 'unknown',
size: 0,
errors: [],
warnings: [],
};
if (!tokenPath) {
summary.errors.push('Usage: validate-token-input.mjs <design-tokens.json> [--legacy-css <colors_and_type.css>] [--json]');
console.log(JSON.stringify(summary, undefined, 2));
process.exit(2);
}
const absoluteTokenPath = resolveDataPath(path.resolve(tokenPath));
if (!fs.existsSync(absoluteTokenPath)) {
console.log(JSON.stringify(fail(summary, `design-tokens file missing: ${absoluteTokenPath}`, legacyCssPath), undefined, 2));
process.exit(summary.ok ? 0 : 1);
}
const raw = fs.readFileSync(absoluteTokenPath, 'utf8');
summary.size = Buffer.byteLength(raw);
// Size check: warn but do not block — sub-agent handles large files via chunked reads
// (warning is appended after quality extraction below to avoid being overwritten)
let tokens;
try {
tokens = readDataFile(absoluteTokenPath);
} catch (error) {
console.log(JSON.stringify(fail(summary, `design-tokens file parse failed: ${error.message}`, legacyCssPath), undefined, 2));
process.exit(summary.ok ? 0 : 1);
}
const oldField = OLD_SCHEMA_FIELDS.find((field) => field in tokens);
if (oldField) {
console.log(JSON.stringify(fail(summary, `old schema field present: ${oldField}`, legacyCssPath), undefined, 2));
process.exit(summary.ok ? 0 : 1);
}
if (hasOldVariablesValues(tokens)) {
console.log(JSON.stringify(fail(summary, 'old schema variables[].values present', legacyCssPath), undefined, 2));
process.exit(summary.ok ? 0 : 1);
}
const quality = tokens.themeSignals?.quality;
summary.status = quality?.status || 'unknown';
summary.errors = Array.isArray(quality?.errors) ? quality.errors.map((issue) => issue.message || issue.code || String(issue)) : [];
summary.warnings = Array.isArray(quality?.warnings) ? quality.warnings.map((issue) => issue.message || issue.code || String(issue)) : [];
if (quality?.status === 'fail') {
summary.warnings.push('themeSignals.quality.status is fail; continuing in degraded token mode');
}
if (summary.size >= MAX_TOKEN_BYTES) {
summary.warnings.push(
`design-tokens file is ${summary.size} bytes (> ${MAX_TOKEN_BYTES}); token sub-agent should use offset/limit chunked reads`
);
summary.chunked = true;
}
summary.ok = true;
summary.mode = 'llm';
console.log(JSON.stringify(summary, undefined, 2));
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: 197k | 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: 197k | 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: 197k | Updated | Claude CodeCodex | Verified | Install |