Frontend design extractor

From bighardperson/computer-science-skills-collection · View interactive version

Frontend design extractor is an AI agent skill from the GitHub repository bighardperson/computer-science-skills-collection. Extract reusable UI/UX design systems from frontend codebases: design tokens, global styles, components, interaction patterns, and page templates. Use when analyzing any frontend repo (React/Vue/Angular/Next/Vite/etc.) to document or migrate UI/UX for reuse across projects. Focus on UI/UX only; expl

How to use this skill

Skill file

Frontend Design Extractor

Overview

Extract a reusable UI/UX design spec from a frontend codebase by inventorying UI sources, documenting foundations, cataloging components, and capturing page-level patterns and behaviors. Exclude business logic and domain-specific workflows. Framework-agnostic: adapt to the actual stack in the target repo.

Quick start

1) Confirm mode: new project (greenfield) or refactor existing. Clarify that business logic is out of scope.

2) If existing repo: run scripts/scan_ui_sources.sh to scan the repo root (no directory layout assumptions). It uses common globs + keyword hits, and ignores common build/cache dirs and extraction output folders by default.

3) Optionally: scripts/scan_ui_sources.sh <repo_root> [out_file] [extra_glob ...] or --root/--out/--ignore for nonstandard layouts.

4) Create the output folder (default ./ui-ux-spec) via scripts/generate_output_skeleton.sh and write all extraction results inside it.

5) Produce outputs in the default structure (see "Output structure").

Modes (choose one)

A) Greenfield (from blank)

Goal: create a reusable UI/UX foundation and starter UI without business logic.

1) Define foundations: tokens (color/typography/spacing/radius/shadow/motion), global styles, breakpoints, layout shell.

2) Create a baseline component set: Button, Input, Select, Card, Modal, Table/List, Tabs, Toast, EmptyState.

3) Create page templates: list/detail/form/dashboard skeletons with placeholder data.

4) Provide implementation notes for the target framework (CSS architecture, theming mechanism, file structure).

5) Optionally run scripts/generate_output_skeleton.sh [out_root] to scaffold folders and empty templates. Default output root is ./ui-ux-spec.

Deliverables:

B) Refactor existing project

Goal: extract current UI/UX, normalize tokens, and plan safe, incremental improvements.

1) Inventory UI sources (scan script + manual inspection).

2) Normalize tokens and map existing styles to them.

3) Identify high-impact components/patterns for first pass.

4) Plan migration with minimal diffs (wrappers, theme adapters, gradual replacement).

5) Document behavioral and a11y gaps to fix progressively.

Deliverables:

Refactor from spec (fixed flow)

Use this when applying an existing ui-ux-spec/ to a target project. Always work from a plan and execute step-by-step to avoid missing gaps.

0) Understand the target project

1) Build the refactor plan (required)

2) Execute phase by phase

3) Summarize and verify

Refactor prompt templates

Use one of the templates below to keep requests precise and plan-driven.

Template A: Standard refactor

Please refactor the existing project based on this UI/UX spec:
- Project path: /path/to/target-project
- Spec path: /path/to/ui-ux-spec
- Goal: UI/UX only (tokens, styles, components, layout), do not change business logic/APIs
- Scope: start with global styles + base components
- Constraints: minimal changes, small-step commits, reversible
- Deliverables: refactor plan + actual code changes + list of impacted files

Template B: Phased refactor

Please refactor UI/UX in phases; only do Phase 1:
- Project path: /path/to/target-project
- Spec path: /path/to/ui-ux-spec
- Phase 1: align tokens + global styles (colors/typography/spacing/radius/shadows)
- Do not change: business logic/routing/APIs
- Deliverables: list of changed files + alignment diff notes

Template C: Component-level refactor

Please align the following components to the spec while keeping business logic unchanged:
- Project path: /path/to/target-project
- Spec path: /path/to/ui-ux-spec
- Component list: Button, Input, Modal, Table
- Goal: only change styling/structure/interaction details
- Deliverables: alignment notes per component + code changes

Workflow

0) Scope and constraints

1) Source inventory (existing repos only)

2) Foundations (tokens + global styles)

3) Layout & information architecture

4) Component catalog

5) Page templates & composition rules

6) Behavior & content rules

7) Package outputs

Output structure (default)

This structure is a recommended documentation layout. It does not need to match the target project's directory structure, and it can be renamed or relocated (e.g., docs/ui-ux-spec/).

ui-ux-spec/
  01_Foundation/
  02_Components/
  03_Patterns/
  04_Pages/
  05_A11y/
  06_Assets/
  07_Engineering_Constraints/

Resources

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.