home / skills / lis186 / sourceatlas / pattern-finder

pattern-finder skill

/plugin/skills/pattern-finder

This skill helps you locate and apply code patterns by surfacing precise implementation examples and conventions from the project.

npx playbooks add skill lis186/sourceatlas --skill pattern-finder

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.5 KB
---
name: pattern-finder
description: Find implementation examples and design patterns in the codebase. Use when user asks "how to implement X", "how does this project do X", "show me examples of X", "where is X implemented", or needs to follow existing code conventions.
---

# Pattern Finder

## When to Use

Trigger this skill when the user:
- Asks how to implement a specific feature
- Wants to see existing implementation examples
- Needs to follow project conventions
- Asks "how does this project do X"
- Asks "show me examples of X"

## Instructions

1. Identify what pattern the user is looking for
2. Run `/sourceatlas:pattern "<pattern>"` with the relevant pattern name
3. Returns best example files with line numbers and implementation guide

## Common Patterns

- API endpoints: `/sourceatlas:pattern "api endpoint"`
- Authentication: `/sourceatlas:pattern "authentication"`
- Database queries: `/sourceatlas:pattern "database query"`
- Background jobs: `/sourceatlas:pattern "background job"`
- File uploads: `/sourceatlas:pattern "file upload"`
- Error handling: `/sourceatlas:pattern "error handling"`
- Validation: `/sourceatlas:pattern "validation"`
- Testing: `/sourceatlas:pattern "unit test"`

## What User Gets

- Best example files with exact line numbers
- Standard implementation flow
- Key conventions to follow
- Common pitfalls to avoid
- Testing patterns

## Example Triggers

- "How do I add a new API endpoint?"
- "Show me how authentication works here"
- "Where can I find examples of database queries?"
- "How does this project handle errors?"

Overview

This skill finds implementation examples and design patterns across a codebase to help you implement features consistently. It locates best-match files, returns exact line ranges, and provides a concise implementation guide tied to project conventions. Use it to follow existing patterns and avoid guesswork when adding features.

How this skill works

Tell the skill the pattern or feature you need (for example, "api endpoint" or "authentication"). The skill queries the code index for matching examples, ranks the best files by relevance, and returns precise file locations with line numbers. It also summarizes the standard implementation flow, key conventions, and common pitfalls to avoid.

When to use it

  • You ask "how do I implement X" or "how does this project do X"
  • You need concrete examples to follow project conventions
  • You want exact file locations and line numbers for reference
  • You are adding a feature and want to mirror existing patterns
  • You need test examples or validation patterns to copy

Best practices

  • Start from the highest-ranked example and follow its directory structure and naming conventions
  • Copy the standard flow (request handling, validation, business logic, persistence, error handling) in order
  • Reuse existing helper modules, middleware, and constants rather than creating duplicates
  • Preserve logging and error patterns so behavior stays consistent across the project
  • Add tests modeled on the project's testing examples and follow the same fixtures/mocks

Example use cases

  • Locate and copy an API endpoint implementation with handler, router, and tests
  • Find all authentication-related files and the recommended flow for token issuance
  • Discover database query patterns and helper utilities to reuse in a new service
  • See how background jobs are queued and processed to add a new scheduled task
  • Identify error handling and validation patterns to match responses and status codes

FAQ

What exact output will I get?

You receive a list of best example files with line ranges, a short implementation guide, and notes on conventions and pitfalls.

How specific should my pattern query be?

Start with a clear pattern name (e.g., "file upload", "database query"). If results are broad, narrow the query with component names or verbs (e.g., "create upload endpoint").

Can I get tests and edge-case guidance?

Yes. The skill includes testing patterns and common pitfalls found in matching examples so you can cover edge cases similarly.