🧩Advanced

Implementation Patterns

Five recurring patterns for skill bodies — pick the one that matches your use case and adapt it.

How to Use These Patterns

These five patterns emerged from skills built by early adopters and internal Anthropic teams. They are not rigid templates — pick the one that fits your use case and adapt it. Most skills combine two: a dominant pattern for the body plus a secondary pattern for a single tricky step.

Pattern 1 — Sequential Workflow Orchestration

Use when users need multi-step processes in a specific order, with dependencies between steps and potential rollback on failure.

markdown
## Workflow: Onboard New Customer

### Step 1: Create Account
Call MCP tool: `create_customer`
Parameters: name, email, company

### Step 2: Setup Payment
Call MCP tool: `setup_payment_method`
Wait for: payment method verification

### Step 3: Create Subscription
Call MCP tool: `create_subscription`
Parameters: plan_id, customer_id (from Step 1)

### Step 4: Send Welcome Email
Call MCP tool: `send_email`
Template: welcome_email_template
  • Explicit step ordering
  • Dependencies between steps
  • Validation at each stage
  • Rollback instructions for failures

Pattern 2 — Multi-MCP Coordination

Use when a workflow spans multiple services. Separate into phases, pass data between phases explicitly, validate before advancing, and centralize error handling so a failure in phase 3 can unwind phases 1 and 2.

markdown
### Phase 1: Design Export (Figma MCP)
1. Export design assets from Figma
2. Generate design specifications
3. Create asset manifest

### Phase 2: Asset Storage (Drive MCP)
1. Create project folder in Drive
2. Upload all assets
3. Generate shareable links

### Phase 3: Task Creation (Linear MCP)
1. Create development tasks
2. Attach asset links to tasks
3. Assign to engineering team

### Phase 4: Notification (Slack MCP)
1. Post handoff summary to #engineering
2. Include asset links and task references
  • Clear phase separation
  • Data passing between MCPs
  • Validation before moving to next phase
  • Centralized error handling

Pattern 3 — Iterative Refinement

Use when output quality measurably improves with iteration. Encode the quality criteria as explicit checks, loop until criteria are met, and define a stop condition so Claude does not iterate forever.

markdown
## Iterative Report Creation

### Initial Draft
1. Fetch data via MCP
2. Generate first draft report
3. Save to temporary file

### Quality Check
1. Run validation script: `scripts/check_report.py`
2. Identify issues:
   - Missing sections
   - Inconsistent formatting
   - Data validation errors

### Refinement Loop
1. Address each identified issue
2. Regenerate affected sections
3. Re-validate
4. Repeat until quality threshold met

### Finalization
1. Apply final formatting
2. Generate summary
3. Save final version
  • Explicit quality criteria
  • Iterative improvement
  • Validation scripts
  • Know when to stop iterating

Pattern 4 — Context-Aware Tool Selection

Use when the same outcome requires different tools depending on context — storing a file could use cloud storage for large binaries, a collaborative docs MCP for documents, GitHub for code. Encode the decision tree explicitly.

markdown
## Smart File Storage

### Decision Tree
1. Check file type and size
2. Determine best storage location:
   - Large files (>10MB): Use cloud storage MCP
   - Collaborative docs: Use Notion/Docs MCP
   - Code files: Use GitHub MCP
   - Temporary files: Use local storage

### Execute Storage
Based on decision:
- Call appropriate MCP tool
- Apply service-specific metadata
- Generate access link

### Provide Context to User
Explain why that storage was chosen.
  • Clear decision criteria
  • Fallback options
  • Transparency about choices

Pattern 5 — Domain-Specific Intelligence

Use when the skill adds specialized knowledge beyond tool access — compliance rules, clinical guidelines, regulatory requirements. Embed the logic in the skill so the agent makes the right call every time instead of re-deriving it.

markdown
## Payment Processing with Compliance

### Before Processing (Compliance Check)
1. Fetch transaction details via MCP
2. Apply compliance rules:
   - Check sanctions lists
   - Verify jurisdiction allowances
   - Assess risk level
3. Document compliance decision

### Processing
IF compliance passed:
  - Call payment processing MCP tool
  - Apply appropriate fraud checks
  - Process transaction
ELSE:
  - Flag for review
  - Create compliance case

### Audit Trail
- Log all compliance checks
- Record processing decisions
- Generate audit report
  • Domain expertise embedded in logic
  • Compliance before action
  • Comprehensive documentation
  • Clear governance

Before you continue

We use analytics cookies to understand how the documentation is used and improve the experience. Privacy Policy.