Skip to content

xinetzone/SpecWeave / .agents/skills/design-library-creator

design-library-creator

Flagged

Create, 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.

FileKindSize
SKILL.mdskill md19.3 KB
aesthetics/dark-mode.mdmarkdown1.8 KB
aesthetics/index.mdmarkdown33.8 KB
aesthetics/navigation-footer.mdmarkdown2.2 KB
aesthetics/screen-craft.mdmarkdown9.2 KB
aesthetics/self-check.mdmarkdown24.9 KB
examples/templates/component-dispatch-rules.mdmarkdown9.1 KB
examples/templates/figma-token-gen.mdmarkdown50.3 KB
examples/templates/incremental.mdmarkdown5.7 KB
examples/templates/phase-2-analysts.mdmarkdown6.8 KB
examples/templates/phase-2-structured-spec.mdmarkdown8.8 KB
examples/templates/phase-2.5-intent-synthesis.mdmarkdown31.0 KB
examples/templates/phase-3-4-component.mdmarkdown9.0 KB
examples/templates/phase-4-ui-kit.mdmarkdown39.3 KB
examples/templates/phase-5-docs.mdmarkdown12.5 KB
examples/templates/scratch-token-gen.mdmarkdown14.4 KB
examples/templates/specimen-reference.htmlother6.0 KB
file-specs/css-json.mdmarkdown9.5 KB
file-specs/css-tokens.mdmarkdown33.6 KB
file-specs/design-library-output.mdmarkdown10.3 KB
file-specs/design-spec-bundle.mdmarkdown5.9 KB
file-specs/documentation.mdmarkdown12.3 KB
file-specs/preview-pages.mdmarkdown28.0 KB
file-specs/ui-kit.mdmarkdown28.5 KB
operation-policies/agent-orchestration.mdmarkdown20.2 KB
operation-policies/bundle-exploration.mdmarkdown9.0 KB
operation-policies/decision-rules.mdmarkdown10.7 KB
operation-policies/quality-gates.mdmarkdown10.5 KB
operation-policies/user-output-policy.mdmarkdown7.8 KB
scripts/check-design-library-phase.mjsscript85.1 KB
scripts/copy-bundle-assets.mjsscript12.3 KB
scripts/css-to-json.mjsscript53.1 KB
scripts/css-utils.mjsscript748 B
scripts/extract-components-css.mjsscript10.3 KB
scripts/generate-uikit-plan.mjsscript27.5 KB
scripts/jsonl-utils.mjsscript7.3 KB
scripts/validate-design-library-output.mjsscript3.1 KB
scripts/validate-intent.mjsscript7.3 KB
scripts/validate-token-input.mjsscript4.0 KB
scripts/validate-uikit-plan.mjsscript13.6 KB
skill-release-manifest.jsonconfig202 B
workflows/create-from-scratch.mdmarkdown22.5 KB
workflows/create-from-structured-spec.mdmarkdown17.5 KB
workflows/create-library.mdmarkdown53.0 KB
workflows/expand-components.mdmarkdown9.0 KB
workflows/generate-additional-kit.mdmarkdown4.9 KB
workflows/refine-library.mdmarkdown9.7 KB

scripts/jsonl-utils.mjs

View on GitHub
/**
 * JSONL utilities for reading/writing bundle JSONL files.
 *
 * The Figma parser outputs all generated/*.jsonl files with:
 * - Line 0: meta line ({_type:'meta', format:'<name>/v1', lines:[...]})
 * - Line 1+: data lines (each with _type field identifying its role)
 *
 * This utility reconstructs the original JSON object shapes from JSONL lines,
 * allowing scripts that previously consumed JSON to work with minimal changes.
 */

import fs from 'node:fs';

// ─── Public API ──────────────────────────────────────────────────────────────

/** Read a JSONL file, return array of parsed line objects */
export function readJsonlLines(filePath) {
  const raw = fs.readFileSync(filePath, 'utf8').trim();
  if (!raw) return [];
  return raw.split('\n').map((l, i) => {
    try {
      return JSON.parse(l);
    } catch (e) {
      throw new Error(`Invalid JSON at line ${i + 1} in ${filePath}: ${e.message}`);
    }
  });
}

/** Find first line with given _type */
export function findLine(lines, type) {
  return lines.find(l => l._type === type);
}

/** Find all lines with given _type */
export function filterLines(lines, type) {
  return lines.filter(l => l._type === type);
}

/** Write array of objects as JSONL */
export function writeJsonlLines(filePath, lines) {
  fs.writeFileSync(filePath, lines.map(l => JSON.stringify(l)).join('\n') + '\n', 'utf8');
}

/**
 * Read a data file, auto-detecting format by extension.
 * - .jsonl → parse lines, reconstruct into original object shape
 * - .json → standard JSON.parse
 */
export function readDataFile(filePath) {
  if (filePath.endsWith('.jsonl')) {
    const lines = readJsonlLines(filePath);
    if (lines.length === 0) return {};
    const meta = lines[0];
    const data = lines.slice(1);
    return reconstructObject(meta, data);
  }
  return JSON.parse(fs.readFileSync(filePath, 'utf8'));
}

/**
 * Resolve a file path, checking .jsonl first then .json fallback.
 * Returns the path that exists, or the .jsonl variant if neither exists.
 */
export function resolveDataPath(basePath) {
  if (basePath.endsWith('.json')) {
    const jsonlPath = basePath.replace(/\.json$/, '.jsonl');
    if (fs.existsSync(jsonlPath)) return jsonlPath;
    if (fs.existsSync(basePath)) return basePath;
    return jsonlPath;
  }
  if (basePath.endsWith('.jsonl')) {
    if (fs.existsSync(basePath)) return basePath;
    const jsonPath = basePath.replace(/\.jsonl$/, '.json');
    if (fs.existsSync(jsonPath)) return jsonPath;
    return basePath;
  }
  return basePath;
}

// ─── Format-specific reconstruction ─────────────────────────────────────────

function reconstructObject(meta, data) {
  if (!meta || meta._type !== 'meta') {
    // Not a valid JSONL meta line, merge all lines as fallback
    const result = {};
    for (const line of [meta, ...data]) Object.assign(result, stripType(line));
    return result;
  }

  switch (meta.format) {
    case 'bundle-manifest/v1': {
      const stats = stripType(findLine(data, 'stats')) || {};
      const shortlistLine = findLine(data, 'shortlist');
      const nav = stripType(findLine(data, 'navigation')) || {};
      const generatedFiles = filterLines(data, 'generatedFile').map(l => l.path);
      // splitHint may be on stats line
      const { splitHint, ...statsRest } = stats;
      return { stats: splitHint ? { ...statsRest, splitHint } : statsRest, shortlist: shortlistLine?.items || [], ...nav, generatedFiles };
    }

    case 'component-evidence/v1': {
      const signals = stripType(findLine(data, 'signals')) || {};
      const variants = filterLines(data, 'variant').map(stripType);
      const hints = stripType(findLine(data, 'hints')) || {};
      return { ...signals, representativeVariants: variants, ...hints };
    }

    case 'render-contract/v1': {
      const signals = stripType(findLine(data, 'signals')) || {};
      const renderPlan = stripType(findLine(data, 'renderPlan')) || {};
      const visualSpecs = stripType(findLine(data, 'visualSpecs')) || {};
      const hints = stripType(findLine(data, 'hints')) || {};
      return { ...signals, renderPlan, visualSpecs, ...hints };
    }

    case 'evidence-index/v1':
    case 'components-index/v1': {
      const header = stripType(findLine(data, 'header')) || {};
      const components = filterLines(data, 'component').map(stripType);
      return { ...header, components };
    }

    case 'component-detail/v1': {
      const header = stripType(findLine(data, 'header')) || {};
      const structures = filterLines(data, 'structure').map(stripType);
      return { ...header, structures };
    }

    case 'uikit-planning-input/v1': {
      const header = stripType(findLine(data, 'header')) || {};
      const candidates = filterLines(data, 'candidate').map(stripType);
      return { ...header, candidateComponents: candidates };
    }

    case 'brand-input/v1': {
      const identity = stripType(findLine(data, 'identity')) || {};
      const visual = stripType(findLine(data, 'visual')) || {};
      const categories = filterLines(data, 'category').map(stripType);
      const copySignals = stripType(findLine(data, 'copySignals')) || {};
      return { ...identity, ...visual, categories, ...copySignals };
    }

    case 'design-tokens/v1': {
      const overviewLine = findLine(data, 'overview');
      const themeSignals = stripType(findLine(data, 'themeSignals')) || {};
      const variableSets = filterLines(data, 'variableSet').map(stripType);
      const semanticLine = findLine(data, 'semanticColors');
      const typographyLine = stripType(findLine(data, 'typography')) || {};
      const spacingLine = stripType(findLine(data, 'spacing')) || {};
      const radiusLine = stripType(findLine(data, 'radius')) || {};
      const shadowsLine = findLine(data, 'shadows');
      const componentUsageLine = stripType(findLine(data, 'componentUsage')) || {};
      const specAnnotationsLine = findLine(data, 'specAnnotations');
      return {
        meta: overviewLine?.meta,
        themeSignals,
        colors: { variableSets, resolvedSemanticColors: semanticLine?.items || [], fromVisualAnnotations: semanticLine?.fromVisualAnnotations || [] },
        typography: typographyLine,
        spacing: spacingLine,
        radius: radiusLine,
        shadows: shadowsLine?.items || [],
        componentUsage: componentUsageLine,
        specAnnotations: specAnnotationsLine?.items || [],
        designerNotes: specAnnotationsLine?.designerNotes || [],
      };
    }

    case 'annotations-summary/v1': {
      const stats = stripType(findLine(data, 'stats')) || {};
      const { warnings, ...statsRest } = stats;
      const tokenLikeNotes = filterLines(data, 'tokenNote').map(stripType);
      const brandLikeCopies = filterLines(data, 'brandCopy').map(stripType);
      const topUiCopies = filterLines(data, 'uiCopy').map(stripType);
      return { stats: statsRest, tokenLikeNotes, brandLikeCopies, topUiCopies, warnings: warnings || [] };
    }

    default: {
      // Fallback: merge all non-array lines, collect repeated types as arrays
      const result = {};
      for (const line of data) Object.assign(result, stripType(line));
      return result;
    }
  }
}

function stripType(obj) {
  if (!obj) return null;
  const { _type, ...rest } = obj;
  return rest;
}
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: 322kUpdated Claude CodeCodexVerifiedInstall
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: 197kUpdated Claude CodeCodexVerifiedInstall
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: 197kUpdated Claude CodeCodexVerifiedInstall
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: 197kUpdated Claude CodeCodexVerifiedInstall