Pattern Mine for Openclaw

A structural analysis tool that identifies duplicated, inconsistent, and dead code patterns to guide intelligent refactoring.

jcools1977
v1.0.0
Mar 4, 2026
0
803
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install pattern-mine

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install pattern-mine using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Pattern Mine?

Pattern Mine is a sophisticated codebase analysis engine that goes beyond basic linting to discover the underlying architectural logic of your project. It identifies four distinct types of patterns: convergent logic that should be unified, divergent implementations that cause bugs, emerging abstractions that are ready for extraction, and fossilized code that serves no modern purpose. By treating patterns as repeated decisions, it helps developers transition from a codebase that simply grew to one that is intentionally cultivated.

As part of the broader ecosystem of Openclaw Skills, this tool operates entirely locally with zero external dependencies. It analyzes your code's structure and semantics without making any API calls, ensuring your proprietary logic stays private while providing actionable insights into your project's health and evolution.

Pattern Mine Use Cases

  • Identifying high-impact refactoring targets before major architectural shifts.
  • Streamlining onboarding by showing new developers the actual conventions used in the codebase.
  • Detecting security vulnerabilities caused by inconsistent implementations of critical logic like sanitization.
  • Removing unreachable or redundant code patterns inherited from legacy systems.
  • Prioritizing technical debt cleanup during sprint planning based on frequency of duplication.

How Pattern Mine Works

  1. Extraction: The skill parses source files into structural representations, identifying functional blocks and their operational signatures.
  2. Similarity Mapping: It builds a similarity matrix to compare blocks based on behavior, input/output, and side effects rather than just text.
  3. Clustering: Blocks are grouped into categories like convergent or divergent based on their semantic consistency and age.
  4. Trend Analysis: The engine evaluates the Rule of Three for emerging patterns and checks commit history for fossilized ones.
  5. Reporting: It generates a prioritized Mine Report that highlights the highest ROI cleanup tasks and potential bug risks.

Pattern Mine Setup

Pattern Mine is a zero-dependency tool compatible with macOS, Linux, and Windows. To add it to your Openclaw Skills workflow, use the following commands:

# Install the pattern-mine skill
openclaw install pattern-mine

# Run the mining operation on your source directory
openclaw run pattern-mine ./src

Pattern Mine Data Schema & Taxonomy

Pattern Mine classifies findings using a specific taxonomy and organizes metadata to assist in refactoring decisions:

Data Point Description
Pattern Type Categorization into Convergent, Divergent, Emerging, or Fossilized clusters.
Instance Count The number of unique locations where the pattern was detected.
Extraction ROI A calculated metric based on lines saved multiplied by the frequency of change.
Canonical Form The most common or robust version of a detected pattern suggested as the standard.
Location Mapping Precise file paths and line ranges for every detected occurrence.

Pattern Mine Advanced Features

  • Semantic Detection: Recognizes identical logic even when written with different syntax or variable names.
  • Fossilization History: Analyzes commit data to prove when a defensive pattern has become obsolete.
  • Divergence Alerts: Flags implementations that deviate from established internal standards, preventing special-case bugs.
  • Growth Tracking: Monitors emerging patterns across scan sessions to suggest the optimal time for abstraction.
  • Privacy-First Analysis: Operates with zero API requirements, keeping all code analysis strictly on the local machine.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*