extract
pbakaus/impeccable
Extract and consolidate reusable components, design tokens, and patterns into your design system.
What is extract?
This skill identifies repeated UI patterns, hard-coded values, and inconsistent component implementations across your codebase, then extracts them into a centralized design system for systematic reuse. Use it when refactoring UI patterns, building or enriching a component library, or establishing design tokens.
- Analyzes code to find repeated components, hard-coded design values, and inconsistent UI patterns
- Assesses extraction opportunities based on reuse frequency and consistency impact
- Creates a systematic extraction plan with component definitions, token hierarchies, and naming conventions
- Builds improved, reusable components with proper props APIs, variants, accessibility, and documentation
- Generates design tokens with clear naming, hierarchy, and semantic meaning
- Migrates existing code to consume the new shared versions and removes dead code
How to install extract
npx skills add https://github.com/pbakaus/impeccable --skill extractHow to use extract
- 1.Identify the target area or codebase section to analyze for extraction opportunities
- 2.Locate or confirm the design system structure, component organization, and naming conventions
- 3.Review the skill's analysis of repeated patterns, hard-coded values, and inconsistent variations
- 4.Approve the extraction plan including which components, tokens, and patterns to extract
- 5.Execute the extraction to create new reusable components and design tokens
- 6.Review and test the migrated code to ensure visual and functional parity
- 7.Update design system documentation with the new components and tokens
Use cases
- Consolidating multiple button implementations into a single reusable component with variants
- Extracting hard-coded colors and spacing values into a design token system
- Identifying and systematizing repeated layout patterns across multiple pages
- Refactoring inconsistent form input styles into a unified, accessible component library
- Building a design system from scratch by analyzing existing UI patterns in a codebase
- Design system maintainers
- Frontend developers refactoring UI code
- Product teams establishing design consistency
- Teams migrating to component-driven architecture
extract FAQ
The skill will ask before creating one and will work with you to understand your preferred location and structure first.
It considers whether a pattern is used 3+ times, whether systematizing it improves consistency, whether it's general enough to reuse, and whether the maintenance benefit outweighs the cost.
Yes, it creates components with clear props APIs, sensible defaults, proper variants for different use cases, and built-in accessibility features like ARIA and keyboard navigation.
Yes, it systematically finds all instances of extracted patterns and replaces them with the new shared versions, then removes the old implementations.
It identifies hard-coded values that should become tokens and creates them with clear naming, hierarchy, and documentation, but avoids creating tokens for every single value.
Full instructions (SKILL.md)
Source of truth, from pbakaus/impeccable.
name: extract description: Extract and consolidate reusable components, design tokens, and patterns into your design system. Identifies opportunities for systematic reuse and enriches your component library. Use when the user asks to create components, refactor repeated UI patterns, build a design system, or extract tokens. user-invocable: true argument-hint: "[target]"
Identify reusable patterns, components, and design tokens, then extract and consolidate them into the design system for systematic reuse.
Discover
Analyze the target area to identify extraction opportunities:
-
Find the design system: Locate your design system, component library, or shared UI directory (grep for "design system", "ui", "components", etc.). Understand its structure:
- Component organization and naming conventions
- Design token structure (if any)
- Documentation patterns
- Import/export conventions
CRITICAL: If no design system exists, ask before creating one. Understand the preferred location and structure first.
-
Identify patterns: Look for:
- Repeated components: Similar UI patterns used multiple times (buttons, cards, inputs, etc.)
- Hard-coded values: Colors, spacing, typography, shadows that should be tokens
- Inconsistent variations: Multiple implementations of the same concept (3 different button styles)
- Reusable patterns: Layout patterns, composition patterns, interaction patterns worth systematizing
-
Assess value: Not everything should be extracted. Consider:
- Is this used 3+ times, or likely to be reused?
- Would systematizing this improve consistency?
- Is this a general pattern or context-specific?
- What's the maintenance cost vs benefit?
Plan Extraction
Create a systematic extraction plan:
- Components to extract: Which UI elements become reusable components?
- Tokens to create: Which hard-coded values become design tokens?
- Variants to support: What variations does each component need?
- Naming conventions: Component names, token names, prop names that match existing patterns
- Migration path: How to refactor existing uses to consume the new shared versions
IMPORTANT: Design systems grow incrementally. Extract what's clearly reusable now, not everything that might someday be reusable.
Extract & Enrich
Build improved, reusable versions:
-
Components: Create well-designed components with:
- Clear props API with sensible defaults
- Proper variants for different use cases
- Accessibility built in (ARIA, keyboard navigation, focus management)
- Documentation and usage examples
-
Design tokens: Create tokens with:
- Clear naming (primitive vs semantic)
- Proper hierarchy and organization
- Documentation of when to use each token
-
Patterns: Document patterns with:
- When to use this pattern
- Code examples
- Variations and combinations
NEVER:
- Extract one-off, context-specific implementations without generalization
- Create components so generic they're useless
- Extract without considering existing design system conventions
- Skip proper TypeScript types or prop documentation
- Create tokens for every single value (tokens should have semantic meaning)
Migrate
Replace existing uses with the new shared versions:
- Find all instances: Search for the patterns you've extracted
- Replace systematically: Update each use to consume the shared version
- Test thoroughly: Ensure visual and functional parity
- Delete dead code: Remove the old implementations
Document
Update design system documentation:
- Add new components to the component library
- Document token usage and values
- Add examples and guidelines
- Update any Storybook or component catalog
Remember: A good design system is a living system. Extract patterns as they emerge, enrich them thoughtfully, and maintain them consistently.
Related skills
More from pbakaus/impeccable and the wider catalog.
impeccable
Design and iterate production-grade frontend interfaces with real working code and exceptional craft.
polish
Final quality pass fixing alignment, spacing, consistency, and micro-details before shipping.
critique
Evaluate design from a UX perspective with quantitative scoring, persona testing, and automated anti-pattern detection.
audit
Run technical quality checks across accessibility, performance, theming, responsive design, and anti-patterns with severity ratings.
animate
Review features and add purposeful animations, micro-interactions, and motion effects that improve usability and delight.
adapt
Adapt designs across screen sizes, devices, and platforms with responsive layouts and context-aware patterns.