pattern-detection

vneseyoungster's avatarfrom vneseyoungster

Detect and document existing code patterns in a codebase. Use to maintain consistency with established conventions when writing new code.

⭐21stars🔀15forks📁View on GitHub🕐Updated Jan 7, 2026

When & Why to Use This Skill

The Pattern Detection skill automates the identification and documentation of established coding conventions within a codebase. By analyzing naming styles, error handling, and testing structures, it ensures architectural consistency and provides a quantitative consistency score to guide refactoring and standardization efforts, making it an essential tool for maintaining high-quality, idiomatic code.

Use Cases

  • Developer Onboarding: Helping new team members quickly grasp and adopt project-specific coding styles and conventions to ensure their contributions match the existing codebase.
  • Technical Debt Assessment: Identifying deviations from established patterns in legacy code to prioritize refactoring tasks and improve overall system maintainability.
  • Automated Consistency Audits: Generating detailed reports and scores for naming, error handling, and testing patterns to maintain architectural integrity across large-scale projects.
  • AI-Assisted Development: Providing structural context to AI agents so they can generate new code that seamlessly integrates with the established patterns of a specific repository.
namepattern-detection
descriptionDetect and document existing code patterns in a codebase. Use to

Pattern Detection Skill

Purpose

Identify and document patterns for consistency enforcement.

Pattern Categories

1. Naming Conventions

Reference: patterns/naming-conventions.md

Detection method:

  • Sample 10+ files across different directories
  • Extract function/class/variable names
  • Identify dominant patterns

2. Error Handling

Reference: patterns/error-handling.md

Detection method:

  • Search for try/catch blocks
  • Find custom error classes
  • Check for error middleware

3. Testing Patterns

Reference: patterns/testing-patterns.md

Detection method:

  • Locate test files
  • Analyze test structure
  • Identify mocking approach

Consistency Scoring

Rate codebase consistency:

  • High (90%+): Strong patterns, few deviations
  • Medium (70-89%): Clear patterns with some variation
  • Low (<70%): Inconsistent, needs standardization

Output Format

Create patterns document with:

  1. Detected patterns with examples
  2. Consistency score per category
  3. Deviation examples
  4. Recommendations for standardization

Storage Location

Save to: docs/research/patterns-{date}.md