ASP源码
PHP源码
.NET源码
JSP源码
模式提取技能是一个先进的分析引擎,旨在将遗留或现有的代码库转化为结构化的、可操作的情报。它系统地扫描仓库以识别有意的设计决策、独特的架构流程和自定义配置,过滤掉通用的默认设置,以捕捉项目 DNA 的真实本质。
通过在 Openclaw Skills 生态系统中使用此工具,开发人员可以弥合运行代码与可重用知识之间的鸿沟。它不仅仅是复制文件;它还将设计系统(包括颜色、字体和间距)、UI 模式和部署工作流合成到标准化的文档和模块化的智能体技能中,以便无缝地应用于未来的项目。
下载入口:https://github.com/openclaw/skills/tree/main/skills/wpank/extraction
从源直接安装技能的最快方式。
npx clawhub@latest install extraction
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 extraction。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
使用 OpenClaw hub CLI 安装提取模块,开始分析您的代码库:
npx clawhub@latest install extraction
确保您可以在本地环境中访问 methodology-values.md 和 skill-quality-criteria.md 等参考文件,以引导提取逻辑并保持 Openclaw Skills 所预期的高标准。
该技能将提取的数据组织到特定的目录结构中,以保持 Openclaw Skills 的清晰度和重用性:
| 目录 | 内容类型 | 用途 |
|---|---|---|
docs/extracted/ |
Markdown 文件 | 存储项目摘要、设计系统值和架构图。 |
ai/skills/ |
SKILL.md & 参考 | 包含从代码库模式衍生出的模块化 Openclaw 技能。 |
ai/staging/ |
临时存储 | 在最终细化之前,用于汇总来自多个项目的模式。 |
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".
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:
70% expert knowledge (not in base Claude model)
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