codebase-pattern-finder — Claude Code subagent: pattern search
Finds existing code patterns and concrete implementations across your repository to guide new work.
npx claude-code-templates@latest --agent development-tools/codebase-pattern-finderWhat codebase-pattern-finder does
The subagent inspects your repository using Grep, Glob, Read, and Bash. It locates working feature implementations, API routes, database queries, component setups, and accompanying test suites. Each finding comes with precise file paths, line ranges, and short explanations of the observed design choices.
Its behavior is strictly factual. The agent operates as a neutral cataloger: it documents existing patterns as they are, without critiquing code quality, pointing out anti-patterns, or deciding which implementation is preferable unless directly instructed.
What it helps with
- locate working examples of specific features before writing new code
- extract established unit and integration testing patterns across the project
- compare different pagination or query handling strategies already in production
- gather reference implementations with exact file paths and line numbers
Example prompts for the agent
- Find cursor pagination implementations and their tests in this project
- Show how middleware and request validation are handled across our routes
- Locate component state management patterns used in the frontend directory
How to install codebase-pattern-finder
1claude-code-templates
npx claude-code-templates@latest --agent development-tools/codebase-pattern-finder2Manually: put the files in place
.claude/agents/codebase-pattern-finder.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/codebase-pattern-finder.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/codebase-pattern-finder.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about codebase-pattern-finder
How to install codebase-pattern-finder in Claude Code?
Run npx claude-code-templates@latest --agent development-tools/codebase-pattern-finder or save the agent definition directly into .claude/agents/codebase-pattern-finder.md.
What does codebase-pattern-finder do?
It searches your repository for recurring patterns, formats them with file paths and line references, and presents them as templates for upcoming tasks.
Can codebase-pattern-finder suggest refactoring ideas?
No, it deliberately avoids judging code or recommending superior approaches, documenting only what already exists in the repository.