3.2 KiB
3.2 KiB
Tool Patterns Catalog
Patterns for building robust, self-correcting Claude Code tools (skills, agents, commands).
Pattern Summary
| Pattern | Purpose | When to Use |
|---|---|---|
| Audit | Smart implicit audits | Modifying existing tools, vague requests |
| Verification | Mandatory completion checks | Before claiming any work complete |
| Brainstorming | Design decision refinement | Design decisions, new concepts |
| Reversion Protection | Prevent behavior regression | All tools with defined behaviors |
| Decisions Record | Capture audit decisions | During any audit workflow |
| Deterministic Scripting | Shift mechanical work to scripts | Planning/design, identifying automation |
| Adaptive Verbosity | Scale output to complexity | Skills with variable complexity (simple to complex scenarios) |
| Role-Workflow | Multi-workflow orchestration | Plugins with 2+ subagent workflows needing synthesis |
Quick Decision Guide
Starting a new tool?
- Brainstorm the design first (if non-trivial)
- If orchestrating 2+ subagent workflows with synthesis → use Role-Workflow pattern
- Identify scripting opportunities (mechanical, repeatable tasks)
- Define invariants and golden examples (reversion protection)
- Build with verification hooks
Modifying an existing tool?
- Check for prior decisions (
.decisions/) - Run implicit audit before changes
- Verify against golden examples
- Record any new decisions made
Reviewing a tool?
- Run audit workflow
- Record decisions made
- Update golden examples if behavior changes were intentional
During planning/design?
- For each component, ask: "Is this mechanical, repeatable, and unambiguous?"
- If yes → recommend a script (see deterministic-scripting pattern)
- Choose language based on project context
Integration Points
These patterns work together:
Brainstorming ──→ Design decisions captured
│
↓
Planning ──→ Script opportunities identified
│ Multi-workflow orchestration? → Role-Workflow pattern
↓
Building ──→ Invariants + golden examples defined
│ Scripts implement mechanical tasks
│ Role-Workflow: Task files + dispatch structure
↓
Modifying ──→ Audit runs implicitly
│ │
│ ↓
│ Decisions recorded
│ │
↓ ↓
Verification ──→ Golden examples checked
Scripts provide deterministic evidence
Role-Workflow: Synthesis step verifies completeness
Model Guidance
| Pattern | Recommended Model |
|---|---|
| Audit execution - structure | Haiku |
| Audit execution - content/quality | Opus |
| Decision recording | Haiku |
| Brainstorming | Opus |
| Verification | Haiku |
| Golden example comparison | Opus |
| Role-Workflow - research | Haiku |
| Role-Workflow - processing | Sonnet |
| Role-Workflow - judgment | Opus |
| Cleanup | Haiku |