playbook/outfitter-agents/plugins/outfitter/templates/skills/multi-file-skill/EXAMPLES.md

387 lines
5.0 KiB
Markdown

# [YOUR_SKILL_NAME] - Examples
Real-world examples and use cases for [YOUR_SKILL_NAME].
## Table of Contents
1. [Basic Examples](#basic-examples)
2. [Intermediate Examples](#intermediate-examples)
3. [Advanced Examples](#advanced-examples)
4. [Integration Examples](#integration-examples)
5. [Common Scenarios](#common-scenarios)
---
## Basic Examples
### Example 1: [Simple Use Case]
**Scenario**: [Description of the problem this solves]
**Solution**:
```[language]
[CODE_EXAMPLE_WITH_DETAILED_COMMENTS]
```
**Output**:
```
[EXPECTED_OUTPUT]
```
**Key Takeaways**:
- [Learning point 1]
- [Learning point 2]
---
### Example 2: [Another Simple Use Case]
**Scenario**: [Description]
**Solution**:
```[language]
[CODE_EXAMPLE]
```
**Output**:
```
[EXPECTED_OUTPUT]
```
---
## Intermediate Examples
### Example 3: [More Complex Use Case]
**Scenario**: [Description of a more complex problem]
**Step 1: Setup**
```[language]
[SETUP_CODE]
```
**Step 2: Implementation**
```[language]
[IMPLEMENTATION_CODE]
```
**Step 3: Usage**
```[language]
[USAGE_CODE]
```
**Complete Example**:
```[language]
[FULL_CODE_WITH_COMMENTS]
```
**Explanation**:
1. [Explanation of step 1]
2. [Explanation of step 2]
3. [Explanation of step 3]
**Output**:
```
[EXPECTED_OUTPUT]
```
---
### Example 4: [Error Handling Example]
**Scenario**: [Description including potential errors]
**Solution**:
```[language]
[CODE_WITH_ERROR_HANDLING]
```
**Testing the Error Handling**:
```[language]
[TEST_CODE_FOR_ERRORS]
```
**Key Points**:
- [Error handling insight 1]
- [Error handling insight 2]
---
## Advanced Examples
### Example 5: [Complex Real-World Scenario]
**Scenario**: [Detailed description of a production use case]
**Architecture Overview**:
```
[ASCII_DIAGRAM_OR_DESCRIPTION]
```
**Implementation**:
**File 1**: `[filename]`
```[language]
[CODE_FOR_FILE_1]
```
**File 2**: `[filename]`
```[language]
[CODE_FOR_FILE_2]
```
**File 3**: `[filename]`
```[language]
[CODE_FOR_FILE_3]
```
**Configuration**: `[config-file]`
```[format]
[CONFIGURATION]
```
**Running the Example**:
```bash
[COMMANDS_TO_RUN]
```
**Expected Behavior**:
[Detailed description of what should happen]
**Trade-offs and Considerations**:
-**Advantages**: [List]
- ⚠️ **Considerations**: [List]
- 🔧 **Customization Options**: [List]
---
### Example 6: [Performance-Optimized Example]
**Scenario**: [Description of performance-critical use case]
**Naive Implementation** (slower):
```[language]
[NAIVE_CODE]
```
*Performance*: [Benchmark]
**Optimized Implementation** (faster):
```[language]
[OPTIMIZED_CODE]
```
*Performance*: [Benchmark]
**Explanation of Optimizations**:
1. [Optimization 1 and why it helps]
2. [Optimization 2 and why it helps]
3. [Optimization 3 and why it helps]
---
## Integration Examples
### Example 7: Integration with [External System 1]
**Scenario**: [Description of integration need]
**Setup**:
```bash
[SETUP_COMMANDS]
```
**Implementation**:
```[language]
[INTEGRATION_CODE]
```
**Usage**:
```[language]
[USAGE_EXAMPLE]
```
**Testing**:
```[language]
[TEST_CODE]
```
---
### Example 8: CI/CD Pipeline Integration
**Scenario**: Automating [task] in CI/CD pipeline
**GitHub Actions Workflow**:
```yaml
name: [Workflow Name]
on: [push, pull_request]
jobs:
[job-name]:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: [Step Name]
run: |
[COMMANDS]
- name: [Another Step]
run: |
[MORE_COMMANDS]
```
**GitLab CI**:
```yaml
[GITLAB_CI_EXAMPLE]
```
---
## Common Scenarios
### Scenario 1: [Common Problem]
**Problem**: [Description]
**Solution**:
```[language]
[SOLUTION_CODE]
```
**Why This Works**:
[Explanation]
---
### Scenario 2: [Another Common Problem]
**Problem**: [Description]
**Wrong Approach** ❌:
```[language]
[WRONG_CODE]
```
*Why this is wrong*: [Explanation]
**Correct Approach** ✅:
```[language]
[CORRECT_CODE]
```
*Why this is better*: [Explanation]
---
### Scenario 3: [Migration Example]
**Problem**: Migrating from [old approach] to [new approach]
**Before** (old way):
```[language]
[OLD_CODE]
```
**After** (new way):
```[language]
[NEW_CODE]
```
**Migration Steps**:
1. [Step 1]
2. [Step 2]
3. [Step 3]
**Benefits**:
- [Benefit 1]
- [Benefit 2]
- [Benefit 3]
---
## Quick Reference
### Common Patterns Cheat Sheet
```[language]
// Pattern 1: [Name]
[CODE_SNIPPET]
// Pattern 2: [Name]
[CODE_SNIPPET]
// Pattern 3: [Name]
[CODE_SNIPPET]
```
### Troubleshooting Examples
**Issue**: [Common error message]
```
[ERROR_OUTPUT]
```
**Solution**: [Fix with code example]
**Issue**: [Another common error]
```
[ERROR_OUTPUT]
```
**Solution**: [Fix with code example]
---
## Community Examples
Examples from real-world usage:
1. **[Project Name]**: [Description and link]
2. **[Project Name]**: [Description and link]
3. **[Project Name]**: [Description and link]
## Contributing Examples
Have a great example? Contribute it by:
1. [Step 1]
2. [Step 2]
3. [Step 3]
[Link to contribution guidelines]