Skill Extraction
by @wpank
Extract design systems, architecture patterns, and methodology from codebases into reusable skills and documentation. Use when analyzing a project to capture patterns, creating skills from existing code, extracting design tokens, or documenting how a project was built. Triggers on "extract patterns", "extract from this repo", "analyze this codebase", "create skills from this project", "extract design system".
clawhub install extractionπ About This Skill
name: pattern-extraction model: reasoning description: Extract design systems, architecture patterns, and methodology from codebases into reusable skills and documentation. Use when analyzing a project to capture patterns, creating skills from existing code, extracting design tokens, or documenting how a project was built. Triggers on "extract patterns", "extract from this repo", "analyze this codebase", "create skills from this project", "extract design system".
Pattern Extraction
Extract reusable patterns, skills, and methodology documentation from existing codebases.
Installation
OpenClaw / Moltbot / Clawbot
npx clawhub@latest install extraction
Before Starting
MANDATORY: Read these reference files based on what you're extracting:
| Extracting | Read First |
|------------|------------|
| Any extraction | methodology-values.md β priority order and what to look for |
| Specific categories | extraction-categories.md β detailed patterns per category |
| Generating skills | skill-quality-criteria.md β quality checklist |
Extraction Process
Phase 1: Discovery
Analyze the project to understand what exists.
Scan for project structure:
- Root directory layout
Key config files (package.json, tailwind.config.*, etc.)
Documentation (README, docs/, etc.)
Source organization (src/, app/, components/, etc.)
Identify tech stack:
| Indicator | Technology |
|-----------|------------|
| package.json with react | React |
| tailwind.config.* | Tailwind CSS |
| components.json | shadcn/ui |
| go.mod | Go |
| Dockerfile | Docker |
| k8s/ or .yaml manifests | Kubernetes |
| turbo.json | Turborepo |
| Makefile | Make automation |
Look for design system signals:
Capture key findings:
Phase 2: Categorization
Map discoveries to extraction categories, prioritized:
Priority order: 1. Design Systems β Color tokens, typography, spacing, motion, aesthetic documentation 2. UI Patterns β Component organization, layouts, interactions 3. Architecture β Folder structure, data flow, API patterns 4. Workflows β Build, dev, deploy, CI/CD 5. Domain-Specific β Patterns unique to this application type
For each category found, note:
Filter by value: | Extract | Skip | |---------|------| | Patterns used across multiple components | One-off solutions | | Customized configs with intention | Default configurations | | Documented design decisions | Arbitrary choices | | Reusable infrastructure | Project-specific hacks |
Phase 3: Extraction
For each valuable pattern, generate outputs.
Design Systems β Design System Doc + Skill
1. Read the Tailwind config, CSS files, theme files
2. Extract actual token values (colors, typography, spacing)
3. Document the aesthetic direction
4. Create:
- docs/extracted/[project]-design-system.md using design-system.md template
- ai/skills/[project]-design-system/SKILL.md if patterns are reusable
Architecture β Methodology Doc
1. Document folder structure with reasoning
2. Capture data flow patterns
3. Note key technical decisions
4. Create docs/extracted/[project]-summary.md using project-summary.md template
Patterns β Skills
For each pattern worth a skill:
1. Load skill-quality-criteria.md
2. Use skill-template.md template
3. Verify the quality checklist:
- Description has WHAT, WHEN, KEYWORDS
- No explanations of basics Claude knows
- Has specific NEVER list
- < 300 lines ideal
4. Create ai/skills/[project]-[pattern]/SKILL.md
Phase 4: Validation
Before writing output, validate extracted content.
For each skill, verify:
For documentation, verify:
Conflict detection: Before creating a new skill, check if similar skills exist:
# Check existing skills in the target repo
ls ai/skills/*/
| Situation | Action | |-----------|--------| | Similar skill exists | Enhance existing skill instead | | Overlapping patterns | Note overlap, may merge in refinement | | Unique pattern | Proceed with new skill |
Phase 5: Output
Write extracted content to target locations.
Methodology Documentation:
docs/extracted/
βββ [project]-summary.md # Overall methodology
βββ [project]-design-system.md # Design tokens and aesthetic
βββ [project]-architecture.md # Code patterns (if complex)
Skills:
ai/skills/
βββ [project]-[category]/
βββ SKILL.md
βββ references/ # (if needed for detailed content)
Create docs/extracted/ directory if it doesn't exist.
Extraction Focus Areas
Design System Extraction (Highest Priority)
When a project has intentional design work, extract thoroughly:
Must capture:
Look in:
tailwind.config.js / tailwind.config.tsglobals.css / app.css / root CSS filestheme.ts / theme.jsGenerate: 1. Design system documentation with actual values 2. Skill capturing the aesthetic philosophy (if distinctive)
Workflow Extraction
Look for:
Extract:
Error Handling
| Situation | Resolution | |-----------|------------| | No patterns found | Create project summary only; document why extraction failed | | Pattern too project-specific | Skip or generalize by removing project names | | Incomplete pattern | Extract what exists, note gaps in skill | | Quality criteria not met | Revise skill or skip pattern | | Similar skill already exists | Update existing skill instead of creating new | | Can't find source files | Note in extraction log, skip that category |
When extraction fails partially: 1. Complete what can be extracted 2. Document gaps in the project summary 3. Note "Incomplete extraction" in output 4. Suggest what additional information would be needed
NEVER Do
Quality Check Before Finishing
After Extraction: Staging for Refinement
If you're extracting to later consolidate patterns across multiple projects:
Copy results to the skills toolkit repo for staging:
# From this project, copy to the skills repo staging area
cp -r ai/skills/[project]-* /path/to/skills-repo/ai/staging/skills/
cp -r docs/extracted/* /path/to/skills-repo/ai/staging/docs/
Staging folder structure:
ai/staging/
βββ skills/ # Extracted skills from multiple projects
β βββ project-a-design-system/
β βββ project-b-ui-patterns/
β βββ ...
βββ docs/ # Extracted methodology docs
βββ project-a-summary.md
βββ project-b-design-system.md
βββ ...
After staging content from multiple projects:
Related Skills
ai/agents/extraction/ β Autonomous extraction workflow/extract-patterns β Quick extraction commandai/skills/refinement/ β Consolidate extracted patternsreferences/skill-quality-criteria.md