Agent skill

Code Pattern Extractor

by majiayu000 in majiayu000/claude-skill-registry

Analyze codebases to identify reusable code patterns, duplications, and implementation patterns for future development.

MITAuto-check passedDevelopment

Install Code Pattern Extractor

skills CLI
$ npx skills add majiayu000/claude-skill-registry --skill code-pattern-extractor -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install majiayu000/claude-skill-registry code-pattern-extractor --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/majiayu000/claude-skill-registry.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/analysis/code-pattern-extractor .claude/skills/code-pattern-extractor && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
code-pattern-extractor
GitHub stars
666
Used in
1 other repo
Token cost
~1.5k tokens
SKILL.md length
426 words
Files
2
Skills in repo
971
Repo updated
First seen
Licence
MIT

At a glance

Analyze codebases to identify reusable code patterns, duplications, and implementation patterns for future development.

  • Works in 7 steps: Define Analysis Scope → Scan for Code Duplication → Identify Implementation Patterns → …
  • Refactoring code
  • SKILL.md covers Overview, Workflow, Output Structure and Pattern Detection Heuristics, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Code Pattern Extractor is an agent skill from majiayu000/claude-skill-registry. 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.

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file (for example `metadata.json`).

It sits in Development, covering Refactoring and Technical debt. The repository describes itself as: Searchable Claude Code skills catalog with source-linked guides and generated registry artifacts. The licence is MIT.

When your agent uses it

  • Refactoring code
  • Identifying technical debt
  • Finding opportunities for abstraction
  • Documenting common patterns in a directory

Example prompts

  • “/code-pattern-extractor”

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  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

What it can do on your machine

Read from SKILL.md and the folder at commit 000116a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown and javascript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Code Pattern Extractor loads about 1.5k tokens when it runs. Until then it costs about 93 tokens; SKILL.md has 426 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~93
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from majiayu000/claude-skill-registry at commit 000116a, republished under its MIT licence (© majiayu000). 426 words, ~1,544 tokens.

Download SKILL.mdSave it as .claude/skills/code-pattern-extractor/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
code-pattern-extractor
description
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.

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: Repeated try-catch or error checking
  • Data validation: Similar input validation logic
  • Data transformation: Repeated mapping/filtering operations
  • State management: Similar state update patterns
  • Configuration: Repeated configuration setup

Example patterns to detect:

javascript
// Pattern: API call with error handling
async function fetchX() {
  try {
    const response = await fetch(url);
    if (!response.ok) throw new Error();
    return await response.json();
  } catch (error) {
    console.error(error);
    return null;
  }
}
4. Categorize Patterns

Group identified patterns by type and impact:

Categories:

  • High-value: Appears frequently (5+ times), significant code size
  • Medium-value: Appears moderately (3-4 times), moderate complexity
  • Low-value: Appears rarely (2 times), simple code

Pattern types:

  • Utility functions (data processing, formatting, validation)
  • API/network patterns (requests, responses, error handling)
  • UI patterns (component structures, event handling)
  • Business logic patterns (calculations, rules, workflows)
5. Generate Pattern Catalog

Document each identified pattern:

Pattern entry format:

markdown
## Pattern: [Descriptive Name]

**Type**: [Utility/API/UI/Business Logic]
**Frequency**: [Number of occurrences]
**Impact**: [High/Medium/Low]

**Description**: [What the pattern does]

**Current implementations**:
- `file1.js:45-60` - [Brief context]
- `file2.js:120-135` - [Brief context]
- `file3.js:89-104` - [Brief context]

**Common variations**:
- [Variation 1 description]
- [Variation 2 description]
6. Generate Refactoring Suggestions

For each high-value pattern, provide refactoring recommendations:

Suggestion format:

markdown
### Refactoring: Extract [Pattern Name]

**Current state**: Pattern appears in [N] locations with [X]% code duplication

**Proposed solution**: Extract into [utility function/class/hook/module]

**Benefits**:
- Reduce code duplication by ~[N] lines
- Centralize logic for easier maintenance
- Improve testability

**Implementation approach**:
1. Create new file: `utils/[pattern-name].js`
2. Extract common logic with parameters for variations
3. Replace [N] occurrences with function calls
4. Add unit tests

**Estimated effort**: [Small/Medium/Large]
Show full SKILL.md (165 more words)Show less
7. Generate Template Code

Create reusable template implementations for high-value patterns:

Template format:

javascript
/**
 * [Pattern description]
 *
 * @param {type} param1 - [Description]
 * @param {type} param2 - [Description]
 * @returns {type} [Description]
 */
function patternTemplate(param1, param2) {
  // Extracted common logic
  // Parameterized variations
  // Return standardized result
}

Include:

  • Function signature with parameters for variations
  • Documentation comments
  • Error handling
  • Type annotations (if applicable)
  • Usage examples

Output Structure

Organize findings into a comprehensive report:

markdown
# Code Pattern Analysis: [Directory/Module Name]

## Summary
- Files analyzed: [N]
- Patterns identified: [N]
- High-value patterns: [N]
- Estimated duplication: [N] lines

## Pattern Catalog
[List of all identified patterns with details]

## Refactoring Suggestions
[Prioritized list of refactoring opportunities]

## Template Code
[Reusable implementations for high-value patterns]

## Next Steps
[Recommended actions prioritized by impact]

Pattern Detection Heuristics

Code duplication detection:

  • Compare function bodies for structural similarity
  • Ignore variable names and minor formatting differences
  • Focus on logic flow and operations

Implementation pattern detection:

  • Look for similar function signatures
  • Identify repeated import patterns
  • Find similar control flow structures (if-else, loops, try-catch)
  • Detect repeated library usage patterns

Abstraction opportunities:

  • Multiple functions with similar purpose but different parameters
  • Repeated setup/teardown code
  • Similar data transformations
  • Parallel class hierarchies

Tips

  • Start with high-frequency patterns for maximum impact
  • Consider language-specific idioms when suggesting abstractions
  • Balance DRY principle with code clarity (don't over-abstract)
  • Include migration path in refactoring suggestions
  • Prioritize patterns that improve maintainability, not just reduce lines
  • Consider existing project architecture when suggesting abstractions
  • Document trade-offs (flexibility vs. simplicity)
  • For large codebases, analyze one module at a time

© majiayu000, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in skills/analysis/code-pattern-extractor of majiayu000/claude-skill-registry.

  • SKILL.md
  • metadata.json

Open the folder on GitHubat commit 000116a

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in majiayu000/claude-skill-registry, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Code Pattern Extractor next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Code Pattern Extractor compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Code Pattern Extractor this skillmajiayu000/claude-skill-registry6661 repos~1.5kAutomated safety check: PassMIT
Systematic Code Refactoringluongnv89/claude-howto42k—~3kAutomated safety check: PassMIT
Code Simplification for ego-litecitrolabs/ego-lite17k—~1.2kAutomated safety check: PassMIT
Code Refactoring Workflowluongnv89/claude-howto42k—~3.1kAutomated safety check: PassMIT
Tech Debt Analyzerailabs-393/ai-labs-claude-skills4542 repos~3.9kAutomated safety check: PassMIT
FIXME Resolvertailcallhq/forgecode7.6k—~1.1kAutomated safety check: PassApache-2.0

Similar skills

  • Systematic Code Refactoring

    luongnv89/claude-howto

    Guides refactoring in phases based on Martin Fowler's method: research, test coverage check, planning and small tested steps, with your approval at each phase.

    42k GitHub stars~3k tokensUpdated 7 days ago
    DevelopmentAuto-check passed
  • Finds and implements evidence-backed simplifications in the ego-lite repository, such as dead code, duplicated state and speculative abstractions, without hiding behavior changes.

    17k GitHub stars~1.2k tokensUpdated 14 days ago
    DevelopmentAuto-check passed
  • Code Refactoring Workflow

    luongnv89/claude-howto

    Guides systematic, test-backed refactoring in the style of Martin Fowler, moving through research, planning and small incremental changes with your approval at each phase.

    42k GitHub stars~3.1k tokensUpdated 7 days ago
    DevelopmentAuto-check passed
  • Tech Debt Analyzer

    ailabs-393/ai-labs-claude-skills

    This skill should be used when analyzing technical debt in a codebase, documenting code quality issues, creating technical debt registers, or assessing code maintainability.

    454 GitHub starsUsed in 2 repos~3.9k tokens
    DevelopmentAuto-check passed
  • FIXME Resolver

    tailcallhq/forgecode

    Finds every FIXME comment in a codebase, groups related ones across files into one task, implements the work they describe and removes the comments once it is done.

    7.6k GitHub stars~1.1k tokensUpdated today
    DevelopmentAuto-check passed
  • Desloppify

    Git-on-my-level/codex-autorunner

    Codebase health scanner and technical debt tracker. An agent skill from Git-on-my-level/codex-autorunner.

    875 GitHub stars~3.4k tokensUpdated 6 days ago
    DevelopmentAuto-check passed

More from majiayu000/claude-skill-registry

All 971 skills in this repo
  • Deep Research

    majiayu000/claude-skill-registry

    Multi-source deep research using firecrawl and exa MCPs. An agent skill from majiayu000/claude-skill-registry.

    666 GitHub starsUsed in 6 repos~1.1k tokens
    Auto-check passed
  • Exa Search

    majiayu000/claude-skill-registry

    Neural search via Exa MCP for web, code, and company research.

    666 GitHub starsUsed in 5 repos~856 tokens
    Auto-check passed
  • Fal AI Media

    majiayu000/claude-skill-registry

    Unified media generation via fal.ai MCP — image, video, and audio.

    666 GitHub starsUsed in 5 repos~1.7k tokens
    Auto-check passed
  • Bgpt Paper Search

    majiayu000/claude-skill-registry

    Search scientific papers and retrieve structured experimental data extracted from full-text studies via the BGPT MCP server.

    666 GitHub starsUsed in 4 repos~619 tokens
    Auto-check: notes
  • Bio Alignment Pairwise

    majiayu000/claude-skill-registry

    Perform pairwise sequence alignment using Biopython Bio.Align.PairwiseAligner.

    666 GitHub starsUsed in 4 repos~1.7k tokens
    Auto-check passed
  • Open Notebook

    majiayu000/claude-skill-registry

    Self-hosted, open-source alternative to Google NotebookLM for AI-powered research and document analysis.

    666 GitHub starsUsed in 4 repos~2.4k tokens
    Auto-check passed

Categories

Questions about Code Pattern Extractor

What does Code Pattern Extractor do?

Analyze codebases to identify reusable code patterns, duplications, and implementation patterns for future development. Code Pattern Extractor is an agent skill from majiayu000/claude-skill-registry. Analyze codebases to identify reusable code patterns, duplications, and implementation patterns for future development.

When should I use Code Pattern Extractor?

Code Pattern Extractor fits situations like: refactoring code; identifying technical debt; finding opportunities for abstraction; documenting common patterns in a directory.

How do I install Code Pattern Extractor in Claude Code?

Run `npx skills add majiayu000/claude-skill-registry --skill code-pattern-extractor -a claude-code`. Or copy the skill folder (skills/analysis/code-pattern-extractor in majiayu000/claude-skill-registry) into .claude/skills/code-pattern-extractor in your project. Claude Code loads it when a task matches its description.

How do I install Code Pattern Extractor in Codex?

Run `npx skills add majiayu000/claude-skill-registry --skill code-pattern-extractor -a codex`. Or copy the skill folder (skills/analysis/code-pattern-extractor in majiayu000/claude-skill-registry) into .agents/skills/code-pattern-extractor in your project. Codex loads it when a task matches its description.

Can I use Code Pattern Extractor in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add majiayu000/claude-skill-registry --skill code-pattern-extractor -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/code-pattern-extractor, .gemini/skills/code-pattern-extractor, .github/skills/code-pattern-extractor and .opencode/skills/code-pattern-extractor in your project.

What does Code Pattern Extractor need to run?

SKILL.md names no scripts, command-line tools or credentials: Code Pattern Extractor is instructions for the agent only.

Does Code Pattern Extractor access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Code Pattern Extractor safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Code Pattern Extractor use?

Code Pattern Extractor is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Code Pattern Extractor use?

About 1.5k tokens (SKILL.md is roughly 6.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Code Pattern Extractor?

Skills that share tags, products or a category with Code Pattern Extractor: Systematic Code Refactoring (luongnv89/claude-howto, 42k stars), Code Simplification for ego-lite (citrolabs/ego-lite, 17k stars), Code Refactoring Workflow (luongnv89/claude-howto, 42k stars) and Tech Debt Analyzer (ailabs-393/ai-labs-claude-skills, 454 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Code Pattern Extractor?

majiayu000 (a GitHub user) maintains it in majiayu000/claude-skill-registry, which has 666 GitHub stars. The repository holds 971 skills in this directory. The repository was last updated on October 7, 2026.

Source: majiayu000/claude-skill-registry on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.