Extract reusable patterns, skills, and methodology documentation from existing codebases.
npx clawhub@latest install extraction
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 |
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:
Map discoveries to extraction categories, prioritized:
Priority order:
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 |
For each valuable pattern, generate outputs.
Design Systems → Design System Doc + Skill
docs/extracted/[project]-design-system.md using design-system.md templateai/skills/[project]-design-system/SKILL.md if patterns are reusableArchitecture → Methodology Doc
docs/extracted/[project]-summary.md using project-summary.md templatePatterns → Skills
For each pattern worth a skill:
skill-quality-criteria.mdskill-template.md templateai/skills/[project]-[pattern]/SKILL.mdBefore 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 |
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.
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:
Look for:
Extract:
| 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:
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:
ai/agents/extraction/ — Autonomous extraction workflow/extract-patterns — Quick extraction commandai/skills/refinement/ — Consolidate extracted patternsreferences/skill-quality-criteria.md共 1 个版本