Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
One-time setup that gathers your project's design context and saves it to CLAUDE.md for future sessions.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
reference/extract.md
1# Extract Flow23Identify reusable patterns, components, and design tokens, then extract and consolidate them into the design system for systematic reuse.45## Step 1: Discover the Design System67Find the design system, component library, or shared UI directory. Understand its structure: component organization, naming conventions, design token structure, import/export conventions.89**CRITICAL**: If no design system exists, STOP and use Codex's structured user-input/question tool when available; if unavailable, ask directly in chat to clarify what you cannot infer. before creating one. Understand the preferred location and structure first.1011## Step 2: Identify Patterns1213Look for extraction opportunities in the target area:1415- **Repeated components**: Similar UI patterns used 3+ times (buttons, cards, inputs)16- **Hard-coded values**: Colors, spacing, typography, shadows that should be tokens17- **Inconsistent variations**: Multiple implementations of the same concept18- **Composition patterns**: Layout or interaction patterns that repeat (form rows, toolbar groups, empty states)19- **Type styles**: Repeated font-size + weight + line-height combinations20- **Animation patterns**: Repeated easing, duration, or keyframe combinations2122Assess value: only extract things used 3+ times with the same intent. Premature abstraction is worse than duplication.2324## Step 3: Plan Extraction2526Create a systematic plan:2728- **Components to extract**: Which UI elements become reusable components?29- **Tokens to create**: Which hard-coded values become design tokens?30- **Variants to support**: What variations does each component need?31- **Naming conventions**: Component names, token names, prop names that match existing patterns32- **Migration path**: How to refactor existing uses to consume the new shared versions3334**IMPORTANT**: Design systems grow incrementally. Extract what is clearly reusable now, not everything that might someday be reusable.3536## Step 4: Extract & Enrich3738Build improved, reusable versions:3940- **Components**: Clear props API with sensible defaults, proper variants for different use cases, accessibility built in (ARIA, keyboard navigation, focus management), documentation and usage examples41- **Design tokens**: Clear naming (primitive vs semantic), proper hierarchy and organization, documentation of when to use each token42- **Patterns**: When to use this pattern, code examples, variations and combinations4344## Step 5: Migrate4546Replace existing uses with the new shared versions:4748- **Find all instances**: Search for the patterns you extracted49- **Replace systematically**: Update each use to consume the shared version50- **Test thoroughly**: Ensure visual and functional parity51- **Delete dead code**: Remove the old implementations5253## Step 6: Document5455Update design system documentation:5657- Add new components to the component library58- Document token usage and values59- Add examples and guidelines60- Update any Storybook or component catalog6162**NEVER**:63- Extract one-off, context-specific implementations without generalization64- Create components so generic they are useless65- Extract without considering existing design system conventions66- Skip proper TypeScript types or prop documentation67- Create tokens for every single value (tokens should have semantic meaning)68- Extract things that differ in intent (two buttons that look similar but serve different purposes should stay separate)6970