pattern-detection
Auto-detects reusable patterns, best practices, and automation opportunities during implementation. Recognizes repetitive structures and generalizable solutions that could become skills.
Best use case
pattern-detection is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Auto-detects reusable patterns, best practices, and automation opportunities during implementation. Recognizes repetitive structures and generalizable solutions that could become skills.
Teams using pattern-detection should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/pattern-detection/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How pattern-detection Compares
| Feature / Agent | pattern-detection | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Auto-detects reusable patterns, best practices, and automation opportunities during implementation. Recognizes repetitive structures and generalizable solutions that could become skills.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Pattern Detection Skill
Recognize and note reusable patterns during implementation for potential contribution to Product Forge.
## Purpose
When working on projects, Claude often implements patterns that could benefit the broader Product Forge ecosystem. This skill helps identify those patterns so they can be captured by the feedback hooks and potentially become new skills, commands, or templates.
## Pattern Categories
### Code Patterns
Implementations that follow consistent, reusable structures:
- **Factory patterns** - Test fixtures, mock builders, data generators
- **Service layer patterns** - Repository, command, query separation
- **Error handling** - Consistent error types, recovery strategies
- **API patterns** - Response formatting, pagination, filtering
- **Testing patterns** - Fixtures, assertions, mocking strategies
### Workflow Patterns
Multi-step processes that could be automated:
- **Project setup** - Directory structures, config files, initial scaffolding
- **Code review** - Checklists, validation steps, quality gates
- **Deployment** - Build, test, deploy sequences
- **Documentation** - Auto-generation, formatting, templates
### Configuration Patterns
Settings and configurations that are commonly needed:
- **Tool configurations** - Linter rules, formatters, CI/CD
- **Environment setup** - Development, staging, production
- **Integration patterns** - API keys, service connections
## Recognition Triggers
Note patterns when you observe:
1. **Repetition**: Same structure implemented 3+ times
2. **Best practice**: Industry-standard patterns being applied
3. **Automation opportunity**: Manual process that could be scripted
4. **Convention enforcement**: Rules applied manually that could be automated
5. **Boilerplate reduction**: Repeated code that could be templated
## Quality Criteria
Only patterns worth capturing should be:
| Criterion | Description |
|-----------|-------------|
| **Reusable** | Applies to multiple projects or contexts |
| **Non-trivial** | More than simple one-liners or obvious code |
| **Generalizable** | Not too specific to one codebase |
| **Documented** | Can be explained clearly to others |
| **Tested** | Validated in at least one real project |
## Examples of Good Patterns
### Django Model Factory Pattern
```python
# Consistent factory for test fixtures
class UserFactory:
@classmethod
def create(cls, **overrides):
defaults = {"name": "Test User", "email": "test@example.com"}
defaults.update(overrides)
return User.objects.create(**defaults)
```
**Why it's a good pattern**: Reusable across Django projects, reduces test boilerplate, follows established factory pattern.
### API Response Wrapper
```python
# Consistent API response format
def api_response(data=None, error=None, status=200):
return {
"success": error is None,
"data": data,
"error": error,
"timestamp": datetime.now().isoformat()
}
```
**Why it's a good pattern**: Standardizes API responses, easy to implement, improves API consistency.
### Pre-commit Hook Configuration
```yaml
# Standard Python project pre-commit
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
hooks:
- id: mypy
```
**Why it's a good pattern**: Common Python setup, enforces code quality, easy to adapt.
## Examples of Poor Patterns
### Too Specific
```python
# Only works for this exact database schema
def get_acme_corp_users_with_subscription():
return User.objects.filter(company="ACME", has_subscription=True)
```
**Problem**: Too specific to one project/company.
### Too Trivial
```python
# Just basic Python
def add_numbers(a, b):
return a + b
```
**Problem**: Doesn't provide enough value to warrant a pattern.
### Incomplete
```python
# Missing error handling and edge cases
def parse_config(path):
return json.load(open(path))
```
**Problem**: Not production-ready, would need significant expansion.
## Integration with Feedback Hooks
When you recognize a valuable pattern:
1. **Continue implementing** - Don't interrupt the user's workflow
2. **Note mentally** - The pattern will be captured at session end
3. **Be descriptive** - When discussing the implementation, explain why it's valuable
The Stop hook's Haiku analysis will detect patterns based on:
- Repeated implementations
- Best practice discussions
- "This could be reusable" mentions
- Template-like code structures
## What Becomes a Pattern
Captured patterns may become:
| Destination | When |
|-------------|------|
| **Skill** | Knowledge/guidelines that Claude applies |
| **Command** | User-invoked action or wizard |
| **Template** | Scaffolding for new projects/files |
| **Agent** | Specialized automated workflow |
## Notes
- This skill helps Claude recognize patterns, not explicitly mark them
- The feedback hooks capture patterns via AI analysis at session end
- Use `/sync-feedback` to review captured patterns
- Quality over quantity - only genuinely reusable patterns matterRelated Skills
zod
Zod schema validation patterns and type inference. Auto-loads when validating schemas, parsing data, validating forms, checking types at runtime, or using z.object/z.string/z.infer in TypeScript.
typescript-import-style
Merge-friendly import formatting (one-per-line, alphabetical). Auto-loads when writing TypeScript/JavaScript imports to minimize merge conflicts in parallel development. Enforces consistent grouping and sorting.
setup-mcp-auth
Configure authentication for an existing FastMCP server
fastmcp
FastMCP TypeScript framework patterns for MCP servers. Auto-loads when building MCP servers, creating tools/resources/prompts, implementing authentication, configuring transports, or working with FastMCP in TypeScript.
add-mcp-tool
Add a new tool to an existing FastMCP server with guided configuration
add-mcp-resource
Add a new resource or resource template to an existing FastMCP server
plan-with-team
Validate plan file ownership
privacy-compliance
GDPR, CCPA, and privacy compliance guidance for data protection. Use when handling personal data, implementing consent management, or ensuring regulatory compliance across jurisdictions.
oauth
OAuth 2.0 and OpenID Connect implementation patterns. Use when implementing authentication, authorization flows, or integrating with OAuth providers like Google, GitHub, or custom identity providers.
mcp-security
Use when securing MCP servers, preventing prompt injection, implementing authorization, validating user input, or building secure multi-agent pipelines. Provides 5-layer defense architecture patterns.
rag-cag-security
Security patterns for RAG and CAG systems with multi-tenant isolation. Use when building retrieval-augmented or cache-augmented generation systems that require tenant isolation, access control, and secure data handling.
chunking-strategies
Document chunking strategies for RAG systems. Use when implementing document processing pipelines to determine optimal chunking approaches based on document type and retrieval requirements.