code-pattern-extractor

Detect idioms, clones, and anti-patterns in codebases via AST analysis.

1|2|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/santosomar/general-secure-coding-agent-skills --skill code-pattern-extractor-santosomar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-pattern-extractor
Source: https://github.com/santosomar/general-secure-coding-agent-skills/tree/main/skills/code-analysis/code-pattern-extractor
Command: npx skills add https://github.com/santosomar/general-secure-coding-agent-skills --skill code-pattern-extractor-santosomar

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you understand and improve your codebase by identifying recurring structural patterns, such as idioms, copy-pasted code, and anti-patterns.

Core Features & Use Cases

  • Idiom Identification: Recognizes common, intentional coding styles used by the team.
  • Clone Detection: Finds duplicated code blocks that could be refactored into functions.
  • Anti-pattern Detection: Highlights recurring mistakes or problematic code structures.
  • Use Case: When onboarding to a new project, use this Skill to quickly grasp the team's coding conventions and identify areas ripe for refactoring.

Quick Start

Analyze the current project to find all code clones and idioms.

Frequently Asked Questions about code-pattern-extractor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect code clones and duplicated blocks for refactoring?

Code clone detection identifies duplicated blocks by analyzing tokenized and normalized AST nodes for structural similarity. It finds recurring patterns and proposes refactoring by extracting common code into reusable functions to reduce redundancy.

What are code smells and how do I find anti-patterns in my codebase?

Code smells are recurring mistakes or problematic structures within a project. You can find anti-patterns by analyzing n-gram frequency and structural similarity in AST nodes to highlight areas needing correction.

How do I extract coding idioms to understand a new project's conventions?

Extracting coding idioms recognizes common, intentional coding styles used by a team. By analyzing structural patterns and n-gram frequency in AST nodes, you can quickly grasp coding conventions during project onboarding.

Does code pattern analysis work without external dependencies?

Code pattern analysis works without external dependencies. It relies solely on internal references to tokenize and normalize AST nodes, detecting structural similarity for idiom and anti-pattern discovery directly within your environment.

How do I identify recurring structural patterns in a codebase?

Identifying recurring structural patterns involves categorizing them as idioms, clones, or anti-patterns. It analyzes tokenized and normalized AST nodes to detect structural similarity and n-gram frequency for comprehensive pattern discovery.