Skip to content
Development
Skill

/pattern-recognition

Identify and apply existing codebase patterns for consistency. TRIGGER when: writing new code that should match conventions, or reviewing code for pattern drift. SKIP: language-specific patterns (use python-patterns or react-patterns); security review (use

From plugin
scaffolding
1639 skills13 agents21 commands25 hooks

Claude Code

$ npx -y skills add komluk/scaffolding --skill pattern-recognition --agent claude-code

SKILL.md

pattern-recognition.SKILL.md
name: pattern-recognition
description: "Identify and apply existing codebase patterns for consistency. TRIGGER when: writing new code that should match conventions, or reviewing code for pattern drift. SKIP: language-specific patterns (use python-patterns or react-patterns); security review (use security-review-checklists); should this exist (use necessity-first)."

Pattern Recognition Skill

Standards for identifying and applying existing codebase patterns to maintain consistency.

When to Apply

  • Before writing new code
  • When implementing similar features
  • Code review for pattern consistency
  • Refactoring decisions

---

Pattern Detection Process

Step 1: Scan Existing Code

| Action | Purpose | |--------|---------| | Find similar modules/components | Match structure and naming | | Find similar functions/hooks | Match return types and patterns | | Find similar services | Match error handling and API patterns | | Check shared-types location | Match how the project centralizes types |

Step 2: Extract Patterns

| Element | What to Look For | |---------|------------------| | Module/component structure | Imports, signature, body order | | State management | Local-vs-shared state decisions | | Error handling | Try/catch style, error messages | | Naming conventions | Files, functions, types | | File organization | Directory structure |

Step 3: Apply Consistently

| Rule | Description | |------|-------------| | Match existing style | New code follows established patterns | | Document deviations | If pattern changes, document why | | Refactor if needed | Update old code to match new pattern |

---

Example: React + TypeScript conventions (illustrative)

> Illustrative — the naming, component, hook, service, and type conventions below > are one team's React/TypeScript catalog shown as a concrete example. The > reusable skill is the *process* above (scan → extract → apply existing > conventions). Substitute your stack's actual conventions; the value of this > skill is matching whatever your codebase already does, not adopting these > specific rules.

Naming Conventions

File Naming

| Type | Convention | Example | |------|------------|---------| | Component | PascalCase | `AnnotationCard.tsx` | | Hook | camelCase with use | `useVisualization.ts` | | Service | camelCase | `apiService.ts` | | Types | camelCase or index | `types/index.ts` | | Store | camelCase with Store | `projectStore.ts` | | Utility | camelCase | `formatters.ts` |

Code Naming

| Type | Convention | Example | |------|------------|---------| | Component | PascalCase | `AnnotationCard` | | Function | camelCase verb | `fetchProjects`, `handleClick` | | Hook | camelCase with use | `useVisualization` | | Type/Interface | PascalCase | `ProjectType`, `ButtonProps` | | Constant | UPPER_SNAKE | `API_BASE_URL`, `MAX_SIZE` | | Variable | camelCase | `isLoading`, `userName` |

---

Component Patterns

Standard Component Structure

| Section | Order | Required | |---------|-------|----------| | Imports | 1st | Yes | | Props interface | 2nd | Yes | | Component function | 3rd | Yes | | Hooks declarations | Inside, top | Yes | | Event handlers | Inside, after hooks | As needed | | Return JSX | Inside, last | Yes |

Component Organization by Type

| Type | Location | Purpose | |------|----------|---------| | Page components | `pages/` | Route entry points | | Feature components | `components/[feature]/` | Feature-specific UI | | Common components | `components/common/` | Reusable across features | | Layout components | `components/layout/` | Page structure |

---

Hook Patterns

Custom Hook Standards

| Element | Requirement | |---------|-------------| | Name | `use` prefix + descriptive name | | Return | Object with named values | | State | `data`, `loading`, `error` pattern | | Dependencies | All external values in dependency array |

Hook Return Pattern

| Return Type | Use Case | |-------------|----------| | `{ data, loading, error }` | Data fetching hooks | | `{ value, setValue, reset }` | Form/input hooks | | `{ isOpen, open, close, toggle }` | Toggle hooks |

---

Service Patterns

API Service Standards

| Element | Requirement | |---------|-------------| | Async/await | All API calls use async/await | | Error handling | Try/catch with console.error | | Error format | `[ServiceName] Error description:` | | Return type | Promise with typed response |

Error Handling Pattern

| Element | Standard | |---------|----------| | Log format | `console.error('[Context] Message:', error)` | | User message | Generic, no technical details | | Rethrow | After logging for upstream handling |

---

Type Patterns

Type Location Rules

| Rule | Description | |------|-------------| | Centralized | All shared types in `types/index.ts` | | Import style | Use `import type` for type-only imports | | Export style | Use `export type` for type exports | | No interfaces | Prefer `type` over `interface` for consistency |

Type Naming

| Category | Pattern | Example | |----------|---------|---------| | Entity | `[Entity]Type` | `ProjectType`, `UserType` | | Props | `[Component]Props` | `ButtonProps`, `CardProps` | | State | `[Domain]State` | `ProjectState`, `UIState` | | API Response | `[Endpoint]Response` | `ProjectsResponse` |

---

Anti-Patterns

| Anti-Pattern | Problem | Solution | |--------------|---------|----------| | Props drilling | Hard to maintain | Use a shared store or context | | Large components | Hard to test/read | Extract sub-components | | Inline styles | Inconsistent | Use your styling system's tokens | | `any` type | Loses type safety | Define proper types | | Barrel exports | Circular dependencies | Use direct imports | | Mixed conventions | Confusing | Follow established patterns |

---

Code Reuse Protocol

The universal rule: **before writing ANY new utility, grep the codebase for an existing one.** Map your project's shared modules and reuse them instead of c

Read more
@komluk
Ships withscaffolding

Spec-driven multi-agent orchestration for Claude Code — pure markdown, zero backend, runs on the stock runtime. 13 agents, 39 skills, 21 commands, 20 hooks, per-phase model tiers, opt-in lifecycle hooks, optional cross-device semantic memory.

1639 skills13 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
16
Star history of komluk/scaffolding on GitHub, a chart by star-history.com

Other skills on scaffolding.

agent-comms

agent-comms

SendMessage recipient validation and worktreePath safety (CWE-59). TRIGGER when: validating a SendMessage `to:` recipient against…

@komluk@komlukInstall Skill
agent-memory

agent-memory

Repo-local file memory under .scaffolding/ (shared/agent/conversation tiers). TRIGGER when: reading or writing .scaffolding/…

@komluk@komlukInstall Skill
api-design

api-design

RESTful API design standards: resource naming, HTTP methods, status codes, pagination, versioning. TRIGGER when: designing new…

@komluk@komlukInstall Skill
context-engineering

context-engineering

Optimize Claude Code context-window usage for accuracy and cost. TRIGGER when: hitting context limits, structuring prompts for an…

@komluk@komlukInstall Skill
database-optimization

database-optimization

Schema design, index strategy, migration safety, and query analysis. TRIGGER when: designing tables or indexes, writing a…

@komluk@komlukInstall Skill
distill

distill

Knowledge distillation: candidate extraction, confidence scoring, tier routing. Invoked by /learn and the memory-ingest Stop…

@komluk@komlukInstall Skill

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills11d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc13d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react2d252k
@facebook@facebookInstall Skill

Questions about pattern-recognition.

Which coding agents can use pattern-recognition?
pattern-recognition installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.