extract-patterns

Extract reusable code patterns from a codebase into markdown documentation.

7|4|Updated Mar 2, 2026
One-click install
npx skills add https://github.com/nklisch/skills --skill extract-patterns-nklisch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: extract-patterns
Source: https://github.com/nklisch/skills/tree/main/plugins/workflow/skills/extract-patterns
Command: npx skills add https://github.com/nklisch/skills --skill extract-patterns-nklisch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Maintaining consistency and reusing proven code structures across a growing codebase is hard, leading to duplicated effort and architectural drift.

Core Features & Use Cases

  • Pattern Discovery: Scans the repository to find recurring abstractions, utilities, and architectural approaches.
  • Documentation Generation: Creates detailed markdown files for each pattern and a concise index for quick agent reference.
  • Workflow Integration: Updates the project’s pattern skill and commits changes, fitting into the overall development pipeline.

Quick Start

Run the extract-patterns skill after completing a major feature to generate pattern documentation.

Frequently Asked Questions about extract-patterns

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

FAQPage Schema
How do I document reusable code patterns to maintain project consistency?

To document reusable code patterns, scan your codebase to find recurring abstractions and architectural approaches, then generate detailed markdown files and a concise index for project-wide agent reference.

What is the best way to extract recurring code structures for refactoring and documentation?

The best way to extract recurring code structures is running an automated scan of completed features to identify abstractions, generate markdown documentation, and commit the pattern updates directly into your pipeline.

How does pattern discovery work for preventing architectural drift in a codebase?

Pattern discovery prevents architectural drift by using glob and grep tools to scan repository files, identifying proven utilities and structures, and creating a dense index that agents reference for future development.

When should I generate pattern files for my codebase to ensure consistency?

You should generate pattern files after completing a major feature, encountering recurring structures, or starting a new project phase to capture proven architectural approaches and prevent duplicated effort.

Can I automate code analysis and pattern documentation without external dependencies?

Yes, you can automate code analysis without external dependencies by using built-in read, write, glob, grep, and task tools to scan files, generate markdown documentation, and commit changes directly.

Does automated pattern extraction work for large codebases with existing architectural drift?

Automated pattern extraction works for large codebases by scanning completed features and recurring structures to generate markdown documentation, capturing existing patterns to realign project consistency moving forward.