---
description: Investigate how a pattern is implemented, analyze its effectiveness, and propose improvements
argument-hint: <pattern to investigate, e.g., "error handling", "authentication", "logging">
allowed-tools: Task, Read, Write, Edit, Glob, Grep, Bash
---

Investigate this pattern: $ARGUMENTS

## Instructions

Load the `pattern-investigator` skill, then:

### 1. Define the Pattern

State explicitly what you're investigating and why.

### 2. Find All Instances

```bash
# Search across the monorepo
grep -rn "[pattern]" --include="*.go" services/ workers/ pkg/
grep -rn "[pattern]" --include="*.ts" --include="*.tsx" apps/
```

### 3. Categorize Variations

Group by approach. For each:
- Where it's used (files, components)
- Pros and cons
- Consistency with rest of codebase

### 4. Analyze Effectiveness

- Does the dominant pattern work well?
- Where does it break down?
- What edge cases aren't handled?

### 5. Propose Improvements

Provide 2-4 concrete options:

```markdown
### Option A: [Name]
- What: [description]
- Files affected: [count]
- Risk: LOW/MEDIUM/HIGH
- Effort: LOW/MEDIUM/HIGH
```

### 6. Step Back

- Is the current pattern actually fine?
- Will "improving" it create more churn than value?
- Is there a reason the variations exist?

## Critical Rules

- ALWAYS search before opining
- ALWAYS provide concrete options with tradeoffs
- NEVER recommend changes without understanding why the current pattern exists
