code-pattern-extractor
Analyze codebases to identify reusable code patterns, duplications, and implementation patterns for future development. Use when refactoring code, identifying technical debt, finding opportunities for abstraction, or documenting common patterns in a directory or module. Outputs pattern catalogs, refactoring suggestions, and reusable template code.
npx skills add majiayu000/claude-skill-registry --skill code-pattern-extractor --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Code Pattern Extractor ## Overview Systematically analyze code in directories or modules to identify recurring patterns, code duplication, and implementation patterns that can be abstracted into reusable components, utilities, or design patterns. ## Workflow ### 1. Define Analysis Scope Identify the code to analyze: - **Directory/module**: Analyze all files in a specific directory - **File set**: Analyze a specific set of related files - **Component**: Analyze files related to a specific feature or component Use Glob to find relevant files: ``` **/*.js, **/*.py, **/*.go, etc. ``` ### 2. Scan for Code Duplication Identify repeated code blocks that appear multiple times: **Look for**: - Similar function implementations with minor variations - Repeated code blocks (>5 lines) across files - Copy-pasted code with slight modifications - Similar class structures or method patterns **Analysis criteria**: - Similarity threshold: >70% code similarity - Minimum size: 5+ lines of code - Frequency: Appears 3+ times ### 3. Identify Implementation Patterns Find recurring implementation approaches: **Common patterns**: - **API call patterns**: Similar fetch/request handling - **Error handling**:
- Overview
- Workflow
- 1. Define Analysis Scope
- 2. Scan for Code Duplication
- 3. Identify Implementation Patterns
- 4. Categorize Patterns
- 5. Generate Pattern Catalog
- 6. Generate Refactoring Suggestions
- 7. Generate Template Code
- Output Structure
- Pattern Detection Heuristics
- Tips
What does the code-pattern-extractor skill do?
Analyze codebases to identify reusable code patterns, duplications, and implementation patterns for future development. Use when refactoring code, identifying technical debt, finding opportunities for abstraction, or documenting common patterns in a directory or module. Outputs pattern catalogs, refactoring suggestions, and reusable template code.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill code-pattern-extractor --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
