agent-patternslisted
Install: claude install-skill VictorGjn/agent-skills
# Agent Patterns
Five composable workflow patterns from Anthropic's "Building Effective Agents" guide. Pick the simplest pattern that solves the problem. Add complexity only when it demonstrably improves outcomes.
## Decision Framework
Before picking a pattern, ask:
1. **Can a single optimized LLM call with retrieval + examples solve this?** If yes, stop here. No agent needed.
2. **Are the subtasks predictable and fixed?** → Use a **workflow** (patterns 1-4)
3. **Are subtasks unpredictable, requiring model-driven decisions?** → Use an **agent** (pattern 5+)
## The 5 Patterns
### 1. Prompt Chaining
**What**: Sequential steps, each LLM call processes the previous output. Optional programmatic gates between steps.
**When**: Task cleanly decomposes into fixed subtasks. Trade latency for accuracy by making each call easier.
**Structure**:
```
Input → LLM₁ → [Gate] → LLM₂ → [Gate] → LLM₃ → Output
```
**Examples**:
- Generate copy → translate to target language
- Write outline → validate against criteria → write full document
- Extract data → transform → generate report
**Implementation**: Chain calls with validation checks between steps. If a gate fails, loop back or abort.
---
### 2. Routing
**What**: Classify input, direct to specialized handler. Separation of concerns.
**When**: Distinct input categories need different prompts/tools/models. Optimizing for one category hurts others.
**Structure**:
```
Input → Classifier → Route A (specialized prompt)