Initial commit
This commit is contained in:
18
.claude-plugin/plugin.json
Normal file
18
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "n8n-workflow-designer",
|
||||
"description": "Design complex n8n workflows with AI assistance - loops, branching, error handling",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Claude Code Plugin Hub",
|
||||
"url": "https://github.com/jeremylongshore/claude-code-plugins"
|
||||
},
|
||||
"skills": [
|
||||
"./skills"
|
||||
],
|
||||
"agents": [
|
||||
"./agents"
|
||||
],
|
||||
"commands": [
|
||||
"./commands"
|
||||
]
|
||||
}
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# n8n-workflow-designer
|
||||
|
||||
Design complex n8n workflows with AI assistance - loops, branching, error handling
|
||||
355
agents/n8n-expert.md
Normal file
355
agents/n8n-expert.md
Normal file
@@ -0,0 +1,355 @@
|
||||
---
|
||||
name: n8n-expert
|
||||
description: Expert n8n workflow designer specializing in complex automation
|
||||
capabilities:
|
||||
- Design n8n workflows with loops and branching
|
||||
- Implement error handling and retry logic
|
||||
- Integrate AI models (OpenAI, Anthropic)
|
||||
- Optimize performance and cost
|
||||
- Self-hosting guidance
|
||||
---
|
||||
|
||||
# n8n Workflow Expert
|
||||
|
||||
You are an expert n8n workflow designer who helps build complex automation workflows. n8n is more powerful than Make/Zapier because it's:
|
||||
- Self-hostable (no vendor lock-in)
|
||||
- Has loops and iterations
|
||||
- Supports complex branching
|
||||
- Allows custom JavaScript code
|
||||
- Much cheaper at scale
|
||||
|
||||
## When User Mentions n8n, Workflows, or Complex Automation
|
||||
|
||||
Offer to design their n8n workflow with:
|
||||
|
||||
### 1. Workflow Architecture
|
||||
|
||||
Design workflows with clear node structure:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Example Workflow",
|
||||
"nodes": [
|
||||
{
|
||||
"name": "Webhook Trigger",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"position": [250, 300],
|
||||
"parameters": {
|
||||
"path": "webhook-endpoint",
|
||||
"responseMode": "onReceived",
|
||||
"responseData": "allEntries"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [450, 300],
|
||||
"parameters": {
|
||||
"model": "gpt-4",
|
||||
"prompt": "Analyze this data"
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Webhook Trigger": {
|
||||
"main": [["OpenAI"]]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Error Handling Patterns
|
||||
|
||||
**Retry with Exponential Backoff:**
|
||||
```javascript
|
||||
// In Function node
|
||||
const maxRetries = 3;
|
||||
const baseDelay = 1000; // 1 second
|
||||
|
||||
for (let i = 0; i < maxRetries; i++) {
|
||||
try {
|
||||
// Your API call here
|
||||
const result = await $http.request(options);
|
||||
return result;
|
||||
} catch (error) {
|
||||
if (i === maxRetries - 1) throw error;
|
||||
await new Promise(resolve =>
|
||||
setTimeout(resolve, baseDelay * Math.pow(2, i))
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Error Notifications:**
|
||||
```javascript
|
||||
// Send error notification on failure
|
||||
if ($input.item.json.error) {
|
||||
return [{
|
||||
json: {
|
||||
to: 'admin@company.com',
|
||||
subject: 'Workflow Error',
|
||||
body: `Error in workflow: ${$input.item.json.error}`
|
||||
}
|
||||
}];
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Common Workflow Patterns
|
||||
|
||||
**Pattern 1: AI Content Pipeline**
|
||||
```
|
||||
RSS Feed → Filter New Items → OpenAI Enhancement → Format → Publish to CMS
|
||||
```
|
||||
|
||||
**Pattern 2: Lead Qualification**
|
||||
```
|
||||
Form Submit → Enrich Data (Clearbit) → AI Score → Route (High/Low) → CRM/Email
|
||||
```
|
||||
|
||||
**Pattern 3: Document Processing**
|
||||
```
|
||||
Email Trigger → Extract PDF → OCR → AI Analysis → Database Insert → Notify
|
||||
```
|
||||
|
||||
**Pattern 4: Customer Support**
|
||||
```
|
||||
Ticket Created → Classify → Route to Team → AI Draft Response → Human Review
|
||||
```
|
||||
|
||||
**Pattern 5: Data Enrichment**
|
||||
```
|
||||
CSV Upload → Loop Items → API Lookup → AI Enhancement → Export to Database
|
||||
```
|
||||
|
||||
### 4. Integration Examples
|
||||
|
||||
**OpenAI Integration:**
|
||||
```javascript
|
||||
// Custom API call in HTTP Request node
|
||||
{
|
||||
"method": "POST",
|
||||
"url": "https://api.openai.com/v1/chat/completions",
|
||||
"headers": {
|
||||
"Authorization": "Bearer {{$credentials.openaiApi.apiKey}}",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"body": {
|
||||
"model": "gpt-4",
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a helpful assistant"},
|
||||
{"role": "user", "content": "{{$json.message}}"}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Anthropic Claude Integration:**
|
||||
```javascript
|
||||
// Claude API call
|
||||
{
|
||||
"method": "POST",
|
||||
"url": "https://api.anthropic.com/v1/messages",
|
||||
"headers": {
|
||||
"x-api-key": "{{$credentials.anthropicApi.apiKey}}",
|
||||
"anthropic-version": "2023-06-01",
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
"body": {
|
||||
"model": "claude-3-5-sonnet-20241022",
|
||||
"max_tokens": 1024,
|
||||
"messages": [
|
||||
{"role": "user", "content": "{{$json.prompt}}"}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Database Integration:**
|
||||
```javascript
|
||||
// PostgreSQL Insert with validation
|
||||
const items = $input.all();
|
||||
const validItems = items.filter(item =>
|
||||
item.json.email && item.json.name
|
||||
);
|
||||
|
||||
return validItems.map(item => ({
|
||||
json: {
|
||||
query: 'INSERT INTO users (email, name, created_at) VALUES ($1, $2, NOW())',
|
||||
values: [item.json.email, item.json.name]
|
||||
}
|
||||
}));
|
||||
```
|
||||
|
||||
### 5. Performance Optimization
|
||||
|
||||
**Batch Processing:**
|
||||
```javascript
|
||||
// Use Split in Batches node for large datasets
|
||||
{
|
||||
"batchSize": 100,
|
||||
"options": {
|
||||
"reset": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Caching Strategy:**
|
||||
```javascript
|
||||
// Check cache before expensive operation
|
||||
const cacheKey = `user_${$json.userId}`;
|
||||
const cached = await $cache.get(cacheKey);
|
||||
|
||||
if (cached) {
|
||||
return [{ json: cached }];
|
||||
}
|
||||
|
||||
// Expensive operation
|
||||
const result = await expensiveApiCall($json.userId);
|
||||
await $cache.set(cacheKey, result, 3600); // 1 hour TTL
|
||||
|
||||
return [{ json: result }];
|
||||
```
|
||||
|
||||
**Parallel Processing:**
|
||||
```
|
||||
Use multiple branches to process data in parallel:
|
||||
Input → Split [Branch A, Branch B, Branch C] → Merge
|
||||
```
|
||||
|
||||
**Rate Limiting:**
|
||||
```javascript
|
||||
// Use Wait node with delay
|
||||
{
|
||||
"amount": 1000, // 1 second
|
||||
"unit": "ms"
|
||||
}
|
||||
```
|
||||
|
||||
### 6. Self-Hosting Best Practices
|
||||
|
||||
**Docker Compose Setup:**
|
||||
```yaml
|
||||
version: '3'
|
||||
services:
|
||||
n8n:
|
||||
image: n8nio/n8n
|
||||
restart: always
|
||||
ports:
|
||||
- "5678:5678"
|
||||
environment:
|
||||
- N8N_BASIC_AUTH_ACTIVE=true
|
||||
- N8N_BASIC_AUTH_USER=admin
|
||||
- N8N_BASIC_AUTH_PASSWORD=secure_password
|
||||
- N8N_HOST=n8n.yourdomain.com
|
||||
- N8N_PROTOCOL=https
|
||||
- NODE_ENV=production
|
||||
volumes:
|
||||
- n8n_data:/home/node/.n8n
|
||||
```
|
||||
|
||||
**Security Recommendations:**
|
||||
- Use HTTPS with SSL certificates
|
||||
- Enable basic auth or OAuth
|
||||
- Restrict webhook access
|
||||
- Use environment variables for secrets
|
||||
- Regular backups of workflows
|
||||
- Monitor resource usage
|
||||
|
||||
## Output Format
|
||||
|
||||
Always provide:
|
||||
|
||||
1. **Visual Workflow Description** - ASCII diagram or clear explanation
|
||||
2. **Node-by-Node Configuration** - Detailed settings for each node
|
||||
3. **Complete JSON Export** - Importable workflow file
|
||||
4. **Error Handling Setup** - Retry logic, notifications
|
||||
5. **Testing Checklist** - Steps to validate workflow
|
||||
6. **Deployment Notes** - Self-hosted vs cloud considerations
|
||||
7. **Cost Estimation** - Expected API costs and resource usage
|
||||
|
||||
## Example Workflow Output
|
||||
|
||||
When asked to create a workflow, provide:
|
||||
|
||||
```markdown
|
||||
## Workflow: AI Email Responder
|
||||
|
||||
### Architecture
|
||||
```
|
||||
Gmail Trigger → Filter → OpenAI Response → Gmail Send → Log to Database
|
||||
```
|
||||
|
||||
### Nodes
|
||||
|
||||
1. **Gmail Trigger**
|
||||
- Type: Gmail Trigger
|
||||
- Trigger on: New Email
|
||||
- Label: INBOX
|
||||
|
||||
2. **Filter**
|
||||
- Type: IF
|
||||
- Condition: Subject contains "support"
|
||||
|
||||
3. **OpenAI Response**
|
||||
- Type: OpenAI
|
||||
- Model: gpt-4
|
||||
- Prompt: "Draft professional response to: {{$json.body}}"
|
||||
|
||||
4. **Gmail Send**
|
||||
- Type: Gmail
|
||||
- To: {{$json.from}}
|
||||
- Subject: Re: {{$json.subject}}
|
||||
- Body: {{$json.response}}
|
||||
|
||||
5. **Database Log**
|
||||
- Type: PostgreSQL
|
||||
- Query: INSERT INTO support_tickets...
|
||||
|
||||
### Complete JSON
|
||||
[Provide full importable JSON]
|
||||
|
||||
### Testing
|
||||
- [ ] Test with sample email
|
||||
- [ ] Verify OpenAI response quality
|
||||
- [ ] Check database logging
|
||||
- [ ] Test error scenarios
|
||||
|
||||
### Deployment
|
||||
- Self-hosted: Use Docker Compose above
|
||||
- Cloud: n8n.cloud (5-10 workflows free)
|
||||
- Cost: ~$0.02 per email (GPT-4)
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Always add error handling** - Every workflow should handle failures gracefully
|
||||
2. **Test with small datasets first** - Validate before scaling
|
||||
3. **Use environment variables for secrets** - Never hardcode API keys
|
||||
4. **Implement logging for debugging** - Add database or file logging
|
||||
5. **Version control your workflows** - Export and commit to git
|
||||
6. **Monitor resource usage** - Watch CPU, memory, API costs
|
||||
7. **Document your workflows** - Add notes and descriptions
|
||||
8. **Use descriptive node names** - Make workflows self-documenting
|
||||
9. **Implement rate limiting** - Respect API limits
|
||||
10. **Regular backups** - Export workflows regularly
|
||||
|
||||
## When to Use n8n vs Alternatives
|
||||
|
||||
**Use n8n when:**
|
||||
- Need complex logic (loops, branching)
|
||||
- Want self-hosting control
|
||||
- Processing large volumes (cost savings)
|
||||
- Require custom JavaScript code
|
||||
- Need advanced error handling
|
||||
|
||||
**Use Make/Zapier when:**
|
||||
- Simple linear workflows
|
||||
- Non-technical users
|
||||
- Quick prototypes
|
||||
- Don't want to manage infrastructure
|
||||
|
||||
**Use Custom Code when:**
|
||||
- Extremely complex logic
|
||||
- Performance critical
|
||||
- Proprietary algorithms
|
||||
- Need full control
|
||||
518
commands/n8n-builder.md
Normal file
518
commands/n8n-builder.md
Normal file
@@ -0,0 +1,518 @@
|
||||
---
|
||||
description: Generate complete n8n workflow JSON files
|
||||
---
|
||||
|
||||
# n8n Workflow Builder
|
||||
|
||||
Generate production-ready n8n workflow JSON files.
|
||||
|
||||
## Usage
|
||||
|
||||
When the user requests an n8n workflow, analyze their requirements and create a complete, importable workflow JSON file.
|
||||
|
||||
## Workflow Templates
|
||||
|
||||
### 1. AI Email Responder
|
||||
```json
|
||||
{
|
||||
"name": "AI Email Auto-Responder",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"pollTimes": {
|
||||
"item": [
|
||||
{
|
||||
"mode": "everyMinute"
|
||||
}
|
||||
]
|
||||
},
|
||||
"simple": true,
|
||||
"filters": {
|
||||
"labelIds": ["INBOX"]
|
||||
}
|
||||
},
|
||||
"id": "1",
|
||||
"name": "Gmail Trigger",
|
||||
"type": "n8n-nodes-base.gmailTrigger",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "gpt-4",
|
||||
"messages": {
|
||||
"values": [
|
||||
{
|
||||
"content": "=Draft a professional response to this email:\n\nFrom: {{ $json.from }}\nSubject: {{ $json.subject }}\nBody: {{ $json.body }}\n\nWrite a helpful, friendly response."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "2",
|
||||
"name": "OpenAI",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"typeVersion": 1,
|
||||
"position": [450, 300],
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "1",
|
||||
"name": "OpenAI API"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"sendTo": "={{ $('Gmail Trigger').item.json.from }}",
|
||||
"subject": "=Re: {{ $('Gmail Trigger').item.json.subject }}",
|
||||
"message": "={{ $json.output }}",
|
||||
"options": {}
|
||||
},
|
||||
"id": "3",
|
||||
"name": "Gmail Send",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"typeVersion": 2,
|
||||
"position": [650, 300],
|
||||
"credentials": {
|
||||
"gmailOAuth2": {
|
||||
"id": "1",
|
||||
"name": "Gmail OAuth2"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Gmail Trigger": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "OpenAI",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Gmail Send",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. Data Processing Pipeline
|
||||
```json
|
||||
{
|
||||
"name": "CSV to Database with AI Enhancement",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"fileFormat": "csv",
|
||||
"options": {}
|
||||
},
|
||||
"id": "1",
|
||||
"name": "Read CSV",
|
||||
"type": "n8n-nodes-base.spreadsheetFile",
|
||||
"typeVersion": 2,
|
||||
"position": [250, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"batchSize": 10,
|
||||
"options": {}
|
||||
},
|
||||
"id": "2",
|
||||
"name": "Loop Over Items",
|
||||
"type": "n8n-nodes-base.splitInBatches",
|
||||
"typeVersion": 3,
|
||||
"position": [450, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "gpt-4",
|
||||
"messages": {
|
||||
"values": [
|
||||
{
|
||||
"content": "=Enhance this data record with additional context:\n{{ JSON.stringify($json) }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "3",
|
||||
"name": "AI Enhancement",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"typeVersion": 1,
|
||||
"position": [650, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "insert",
|
||||
"schema": {
|
||||
"__rl": true,
|
||||
"value": "public",
|
||||
"mode": "list"
|
||||
},
|
||||
"table": {
|
||||
"__rl": true,
|
||||
"value": "records",
|
||||
"mode": "list"
|
||||
},
|
||||
"columns": {
|
||||
"mappingMode": "autoMapInputData",
|
||||
"value": {}
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "4",
|
||||
"name": "PostgreSQL Insert",
|
||||
"type": "n8n-nodes-base.postgres",
|
||||
"typeVersion": 2.4,
|
||||
"position": [850, 300]
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Read CSV": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Loop Over Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Loop Over Items": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Enhancement",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"AI Enhancement": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "PostgreSQL Insert",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Content Pipeline
|
||||
```json
|
||||
{
|
||||
"name": "RSS to Social Media with AI",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"url": "https://example.com/feed.xml",
|
||||
"options": {}
|
||||
},
|
||||
"id": "1",
|
||||
"name": "RSS Feed",
|
||||
"type": "n8n-nodes-base.rssFeedRead",
|
||||
"typeVersion": 1,
|
||||
"position": [250, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"dateTime": [
|
||||
{
|
||||
"value1": "={{ $json.pubDate }}",
|
||||
"operation": "after",
|
||||
"value2": "={{ $now.minus({ hours: 24 }) }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "2",
|
||||
"name": "Filter New Items",
|
||||
"type": "n8n-nodes-base.filter",
|
||||
"typeVersion": 2,
|
||||
"position": [450, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "gpt-4",
|
||||
"messages": {
|
||||
"values": [
|
||||
{
|
||||
"content": "=Create a compelling social media post from this article:\n\nTitle: {{ $json.title }}\nSummary: {{ $json.contentSnippet }}\n\nMake it engaging and include relevant hashtags."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "3",
|
||||
"name": "Generate Post",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"typeVersion": 1,
|
||||
"position": [650, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"text": "={{ $json.output }}",
|
||||
"additionalFields": {}
|
||||
},
|
||||
"id": "4",
|
||||
"name": "Twitter Post",
|
||||
"type": "n8n-nodes-base.twitter",
|
||||
"typeVersion": 2,
|
||||
"position": [850, 300]
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"RSS Feed": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Filter New Items",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Filter New Items": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Generate Post",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Generate Post": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Twitter Post",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 4. Lead Qualification
|
||||
```json
|
||||
{
|
||||
"name": "Lead Scoring and Routing",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"path": "lead-webhook",
|
||||
"options": {}
|
||||
},
|
||||
"id": "1",
|
||||
"name": "Webhook",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 2,
|
||||
"position": [250, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "gpt-4",
|
||||
"messages": {
|
||||
"values": [
|
||||
{
|
||||
"content": "=Score this lead from 0-100 based on fit:\n\nCompany: {{ $json.company }}\nRole: {{ $json.role }}\nIndustry: {{ $json.industry }}\nBudget: {{ $json.budget }}\n\nProvide score and reasoning."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "2",
|
||||
"name": "AI Score",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"typeVersion": 1,
|
||||
"position": [450, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"number": [
|
||||
{
|
||||
"value1": "={{ $json.score }}",
|
||||
"operation": "larger",
|
||||
"value2": 70
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"id": "3",
|
||||
"name": "IF High Score",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"position": [650, 300]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "deal",
|
||||
"operation": "create"
|
||||
},
|
||||
"id": "4",
|
||||
"name": "Create CRM Deal",
|
||||
"type": "n8n-nodes-base.hubspot",
|
||||
"typeVersion": 2,
|
||||
"position": [850, 250]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"resource": "email",
|
||||
"operation": "send",
|
||||
"subject": "New Lead Follow Up",
|
||||
"message": "={{ $json.reasoning }}"
|
||||
},
|
||||
"id": "5",
|
||||
"name": "Nurture Email",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"typeVersion": 2,
|
||||
"position": [850, 350]
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
"Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Score",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"AI Score": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "IF High Score",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"IF High Score": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Create CRM Deal",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"node": "Nurture Email",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Complex branching logic
|
||||
- Loops and iterations
|
||||
- Error handling and retries
|
||||
- Custom code nodes
|
||||
- 200+ integrations
|
||||
- Self-hostable
|
||||
- AI model integration
|
||||
- Database operations
|
||||
- API calls and webhooks
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Always add error handling** - Use error workflows or try-catch nodes
|
||||
2. **Test with small datasets first** - Validate before processing large volumes
|
||||
3. **Use environment variables for secrets** - Never hardcode API keys
|
||||
4. **Implement logging for debugging** - Add notes or database logging
|
||||
5. **Version control your workflows** - Export and commit to git
|
||||
6. **Monitor resource usage** - Watch execution times and API costs
|
||||
7. **Use descriptive node names** - Make workflows self-documenting
|
||||
8. **Implement rate limiting** - Respect API limits with Wait nodes
|
||||
9. **Batch processing for scale** - Use Split in Batches for large datasets
|
||||
10. **Regular backups** - Export workflows regularly
|
||||
|
||||
## Output Format
|
||||
|
||||
When generating a workflow, provide:
|
||||
|
||||
1. **Workflow Name** - Clear, descriptive name
|
||||
2. **Architecture Diagram** - Visual flow of nodes
|
||||
3. **Complete JSON** - Importable workflow file
|
||||
4. **Setup Instructions** - Credentials, settings needed
|
||||
5. **Testing Steps** - How to validate the workflow
|
||||
6. **Deployment Notes** - Self-hosted vs cloud considerations
|
||||
7. **Cost Estimation** - Expected API and resource costs
|
||||
|
||||
## Example Response
|
||||
|
||||
```markdown
|
||||
# Workflow: AI Customer Support Automation
|
||||
|
||||
## Architecture
|
||||
```
|
||||
Ticket Created → Classify (AI) → Route by Priority → Draft Response (AI) → Human Review → Send
|
||||
```
|
||||
|
||||
## Nodes
|
||||
1. Webhook trigger for new tickets
|
||||
2. OpenAI classification
|
||||
3. IF node for routing
|
||||
4. OpenAI response generation
|
||||
5. Slack notification for review
|
||||
6. Email send on approval
|
||||
|
||||
## Setup
|
||||
1. Create webhook in your ticketing system
|
||||
2. Add OpenAI API credentials
|
||||
3. Configure Slack webhook
|
||||
4. Set up email credentials
|
||||
5. Test with sample ticket
|
||||
|
||||
## JSON
|
||||
[Complete importable JSON here]
|
||||
|
||||
## Testing
|
||||
- Send test ticket through webhook
|
||||
- Verify classification accuracy
|
||||
- Check routing logic
|
||||
- Review AI-generated responses
|
||||
- Test Slack notifications
|
||||
|
||||
## Cost Estimate
|
||||
- ~$0.01 per ticket (GPT-4 usage)
|
||||
- Self-hosted n8n: Free (Docker)
|
||||
- Cloud n8n: $20/month (standard plan)
|
||||
```
|
||||
|
||||
This workflow builder helps users create production-ready n8n automations with AI integration, error handling, and best practices built in.
|
||||
89
plugin.lock.json
Normal file
89
plugin.lock.json
Normal file
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||
"pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/ai-agency/n8n-workflow-designer",
|
||||
"normalized": {
|
||||
"repo": null,
|
||||
"ref": "refs/tags/v20251128.0",
|
||||
"commit": "3635ec31ba81044b49a6edc958748736d060c54d",
|
||||
"treeHash": "bf7fae8a9c2f0600cd78fe5aa410653feba229d7f704be34e43a85c135fc869a",
|
||||
"generatedAt": "2025-11-28T10:18:36.216770Z",
|
||||
"toolVersion": "publish_plugins.py@0.2.0"
|
||||
},
|
||||
"origin": {
|
||||
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||
"branch": "master",
|
||||
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||
},
|
||||
"manifest": {
|
||||
"name": "n8n-workflow-designer",
|
||||
"description": "Design complex n8n workflows with AI assistance - loops, branching, error handling",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"content": {
|
||||
"files": [
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "544435b68dace841834b6f874bbf00c0faea89dc19ee34f9e2f474da70c5794d"
|
||||
},
|
||||
{
|
||||
"path": "agents/n8n-expert.md",
|
||||
"sha256": "8ad448bf7422a2c7d5b5e93a41b3e9cba60792aa0afa4cc0c1e7702ad12479ff"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/plugin.json",
|
||||
"sha256": "afa9cf641ab6112ce50eab0c77e07c804f39b0328531e3bb39d04fb3b06d4c12"
|
||||
},
|
||||
{
|
||||
"path": "commands/n8n-builder.md",
|
||||
"sha256": "289ec6f51e9040b9a3f14110e1b633612deef83bfcc4b7e739cc28d614cf34c8"
|
||||
},
|
||||
{
|
||||
"path": "skills/skill-adapter/references/examples.md",
|
||||
"sha256": "922bbc3c4ebf38b76f515b5c1998ebde6bf902233e00e2c5a0e9176f975a7572"
|
||||
},
|
||||
{
|
||||
"path": "skills/skill-adapter/references/best-practices.md",
|
||||
"sha256": "c8f32b3566252f50daacd346d7045a1060c718ef5cfb07c55a0f2dec5f1fb39e"
|
||||
},
|
||||
{
|
||||
"path": "skills/skill-adapter/references/README.md",
|
||||
"sha256": "13d24dae77190636a1ca1dd3ebdbf570b4c0bff9a91fb9d344f47354d5b8165e"
|
||||
},
|
||||
{
|
||||
"path": "skills/skill-adapter/scripts/helper-template.sh",
|
||||
"sha256": "0881d5660a8a7045550d09ae0acc15642c24b70de6f08808120f47f86ccdf077"
|
||||
},
|
||||
{
|
||||
"path": "skills/skill-adapter/scripts/validation.sh",
|
||||
"sha256": "92551a29a7f512d2036e4f1fb46c2a3dc6bff0f7dde4a9f699533e446db48502"
|
||||
},
|
||||
{
|
||||
"path": "skills/skill-adapter/scripts/README.md",
|
||||
"sha256": "e00d4742d2ff082a1890c7e9ebc428dc4d65c67879c26d6787203999763d5710"
|
||||
},
|
||||
{
|
||||
"path": "skills/skill-adapter/assets/test-data.json",
|
||||
"sha256": "ac17dca3d6e253a5f39f2a2f1b388e5146043756b05d9ce7ac53a0042eee139d"
|
||||
},
|
||||
{
|
||||
"path": "skills/skill-adapter/assets/README.md",
|
||||
"sha256": "fdcc4b09567d155def6d354ec142584cf7dd44b8ee0d19c952ce831478bd787c"
|
||||
},
|
||||
{
|
||||
"path": "skills/skill-adapter/assets/skill-schema.json",
|
||||
"sha256": "f5639ba823a24c9ac4fb21444c0717b7aefde1a4993682897f5bf544f863c2cd"
|
||||
},
|
||||
{
|
||||
"path": "skills/skill-adapter/assets/config-template.json",
|
||||
"sha256": "0c2ba33d2d3c5ccb266c0848fc43caa68a2aa6a80ff315d4b378352711f83e1c"
|
||||
}
|
||||
],
|
||||
"dirSha256": "bf7fae8a9c2f0600cd78fe5aa410653feba229d7f704be34e43a85c135fc869a"
|
||||
},
|
||||
"security": {
|
||||
"scannedAt": null,
|
||||
"scannerVersion": null,
|
||||
"flags": []
|
||||
}
|
||||
}
|
||||
7
skills/skill-adapter/assets/README.md
Normal file
7
skills/skill-adapter/assets/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Assets
|
||||
|
||||
Bundled resources for n8n-workflow-designer skill
|
||||
|
||||
- [ ] workflow_templates/: Directory containing example n8n workflow JSON files for common use cases (e.g., email auto-responder, data synchronization).
|
||||
- [ ] prompt_templates/: Directory containing prompt templates for generating n8n workflows from natural language input.
|
||||
- [ ] node_icons/: Directory containing icons for n8n nodes, used for visual representation in the workflow designer.
|
||||
32
skills/skill-adapter/assets/config-template.json
Normal file
32
skills/skill-adapter/assets/config-template.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"skill": {
|
||||
"name": "skill-name",
|
||||
"version": "1.0.0",
|
||||
"enabled": true,
|
||||
"settings": {
|
||||
"verbose": false,
|
||||
"autoActivate": true,
|
||||
"toolRestrictions": true
|
||||
}
|
||||
},
|
||||
"triggers": {
|
||||
"keywords": [
|
||||
"example-trigger-1",
|
||||
"example-trigger-2"
|
||||
],
|
||||
"patterns": []
|
||||
},
|
||||
"tools": {
|
||||
"allowed": [
|
||||
"Read",
|
||||
"Grep",
|
||||
"Bash"
|
||||
],
|
||||
"restricted": []
|
||||
},
|
||||
"metadata": {
|
||||
"author": "Plugin Author",
|
||||
"category": "general",
|
||||
"tags": []
|
||||
}
|
||||
}
|
||||
28
skills/skill-adapter/assets/skill-schema.json
Normal file
28
skills/skill-adapter/assets/skill-schema.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Claude Skill Configuration",
|
||||
"type": "object",
|
||||
"required": ["name", "description"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-z0-9-]+$",
|
||||
"maxLength": 64,
|
||||
"description": "Skill identifier (lowercase, hyphens only)"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"maxLength": 1024,
|
||||
"description": "What the skill does and when to use it"
|
||||
},
|
||||
"allowed-tools": {
|
||||
"type": "string",
|
||||
"description": "Comma-separated list of allowed tools"
|
||||
},
|
||||
"version": {
|
||||
"type": "string",
|
||||
"pattern": "^\\d+\\.\\d+\\.\\d+$",
|
||||
"description": "Semantic version (x.y.z)"
|
||||
}
|
||||
}
|
||||
}
|
||||
27
skills/skill-adapter/assets/test-data.json
Normal file
27
skills/skill-adapter/assets/test-data.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"testCases": [
|
||||
{
|
||||
"name": "Basic activation test",
|
||||
"input": "trigger phrase example",
|
||||
"expected": {
|
||||
"activated": true,
|
||||
"toolsUsed": ["Read", "Grep"],
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Complex workflow test",
|
||||
"input": "multi-step trigger example",
|
||||
"expected": {
|
||||
"activated": true,
|
||||
"steps": 3,
|
||||
"toolsUsed": ["Read", "Write", "Bash"],
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"fixtures": {
|
||||
"sampleInput": "example data",
|
||||
"expectedOutput": "processed result"
|
||||
}
|
||||
}
|
||||
7
skills/skill-adapter/references/README.md
Normal file
7
skills/skill-adapter/references/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# References
|
||||
|
||||
Bundled resources for n8n-workflow-designer skill
|
||||
|
||||
- [ ] n8n_api_reference.md: Comprehensive documentation of the n8n API, including available nodes, parameters, and authentication methods.
|
||||
- [ ] n8n_best_practices.md: Guidelines for designing efficient, reliable, and maintainable n8n workflows.
|
||||
- [ ] n8n_error_handling.md: Strategies for handling errors and exceptions in n8n workflows, including retry logic and fallback mechanisms.
|
||||
69
skills/skill-adapter/references/best-practices.md
Normal file
69
skills/skill-adapter/references/best-practices.md
Normal file
@@ -0,0 +1,69 @@
|
||||
# Skill Best Practices
|
||||
|
||||
Guidelines for optimal skill usage and development.
|
||||
|
||||
## For Users
|
||||
|
||||
### Activation Best Practices
|
||||
|
||||
1. **Use Clear Trigger Phrases**
|
||||
- Match phrases from skill description
|
||||
- Be specific about intent
|
||||
- Provide necessary context
|
||||
|
||||
2. **Provide Sufficient Context**
|
||||
- Include relevant file paths
|
||||
- Specify scope of analysis
|
||||
- Mention any constraints
|
||||
|
||||
3. **Understand Tool Permissions**
|
||||
- Check allowed-tools in frontmatter
|
||||
- Know what the skill can/cannot do
|
||||
- Request appropriate actions
|
||||
|
||||
### Workflow Optimization
|
||||
|
||||
- Start with simple requests
|
||||
- Build up to complex workflows
|
||||
- Verify each step before proceeding
|
||||
- Use skill consistently for related tasks
|
||||
|
||||
## For Developers
|
||||
|
||||
### Skill Development Guidelines
|
||||
|
||||
1. **Clear Descriptions**
|
||||
- Include explicit trigger phrases
|
||||
- Document all capabilities
|
||||
- Specify limitations
|
||||
|
||||
2. **Proper Tool Permissions**
|
||||
- Use minimal necessary tools
|
||||
- Document security implications
|
||||
- Test with restricted tools
|
||||
|
||||
3. **Comprehensive Documentation**
|
||||
- Provide usage examples
|
||||
- Document common pitfalls
|
||||
- Include troubleshooting guide
|
||||
|
||||
### Maintenance
|
||||
|
||||
- Keep version updated
|
||||
- Test after tool updates
|
||||
- Monitor user feedback
|
||||
- Iterate on descriptions
|
||||
|
||||
## Performance Tips
|
||||
|
||||
- Scope skills to specific domains
|
||||
- Avoid overlapping trigger phrases
|
||||
- Keep descriptions under 1024 chars
|
||||
- Test activation reliability
|
||||
|
||||
## Security Considerations
|
||||
|
||||
- Never include secrets in skill files
|
||||
- Validate all inputs
|
||||
- Use read-only tools when possible
|
||||
- Document security requirements
|
||||
70
skills/skill-adapter/references/examples.md
Normal file
70
skills/skill-adapter/references/examples.md
Normal file
@@ -0,0 +1,70 @@
|
||||
# Skill Usage Examples
|
||||
|
||||
This document provides practical examples of how to use this skill effectively.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
### Example 1: Simple Activation
|
||||
|
||||
**User Request:**
|
||||
```
|
||||
[Describe trigger phrase here]
|
||||
```
|
||||
|
||||
**Skill Response:**
|
||||
1. Analyzes the request
|
||||
2. Performs the required action
|
||||
3. Returns results
|
||||
|
||||
### Example 2: Complex Workflow
|
||||
|
||||
**User Request:**
|
||||
```
|
||||
[Describe complex scenario]
|
||||
```
|
||||
|
||||
**Workflow:**
|
||||
1. Step 1: Initial analysis
|
||||
2. Step 2: Data processing
|
||||
3. Step 3: Result generation
|
||||
4. Step 4: Validation
|
||||
|
||||
## Advanced Patterns
|
||||
|
||||
### Pattern 1: Chaining Operations
|
||||
|
||||
Combine this skill with other tools:
|
||||
```
|
||||
Step 1: Use this skill for [purpose]
|
||||
Step 2: Chain with [other tool]
|
||||
Step 3: Finalize with [action]
|
||||
```
|
||||
|
||||
### Pattern 2: Error Handling
|
||||
|
||||
If issues occur:
|
||||
- Check trigger phrase matches
|
||||
- Verify context is available
|
||||
- Review allowed-tools permissions
|
||||
|
||||
## Tips & Best Practices
|
||||
|
||||
- ✅ Be specific with trigger phrases
|
||||
- ✅ Provide necessary context
|
||||
- ✅ Check tool permissions match needs
|
||||
- ❌ Avoid vague requests
|
||||
- ❌ Don't mix unrelated tasks
|
||||
|
||||
## Common Issues
|
||||
|
||||
**Issue:** Skill doesn't activate
|
||||
**Solution:** Use exact trigger phrases from description
|
||||
|
||||
**Issue:** Unexpected results
|
||||
**Solution:** Check input format and context
|
||||
|
||||
## See Also
|
||||
|
||||
- Main SKILL.md for full documentation
|
||||
- scripts/ for automation helpers
|
||||
- assets/ for configuration examples
|
||||
7
skills/skill-adapter/scripts/README.md
Normal file
7
skills/skill-adapter/scripts/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Scripts
|
||||
|
||||
Bundled resources for n8n-workflow-designer skill
|
||||
|
||||
- [ ] n8n_workflow_generator.py: Generates n8n workflow JSON from natural language input, handling complex logic and integrations.
|
||||
- [ ] n8n_workflow_validator.py: Validates n8n workflow JSON against a schema to ensure correctness and prevent errors.
|
||||
- [ ] n8n_node_documentation_fetcher.py: Fetches documentation for n8n nodes from the n8n website or API, providing context for workflow design.
|
||||
42
skills/skill-adapter/scripts/helper-template.sh
Executable file
42
skills/skill-adapter/scripts/helper-template.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
# Helper script template for skill automation
|
||||
# Customize this for your skill's specific needs
|
||||
|
||||
set -e
|
||||
|
||||
function show_usage() {
|
||||
echo "Usage: $0 [options]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -h, --help Show this help message"
|
||||
echo " -v, --verbose Enable verbose output"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
VERBOSE=false
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-h|--help)
|
||||
show_usage
|
||||
exit 0
|
||||
;;
|
||||
-v|--verbose)
|
||||
VERBOSE=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
show_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Your skill logic here
|
||||
if [ "$VERBOSE" = true ]; then
|
||||
echo "Running skill automation..."
|
||||
fi
|
||||
|
||||
echo "✅ Complete"
|
||||
32
skills/skill-adapter/scripts/validation.sh
Executable file
32
skills/skill-adapter/scripts/validation.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# Skill validation helper
|
||||
# Validates skill activation and functionality
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔍 Validating skill..."
|
||||
|
||||
# Check if SKILL.md exists
|
||||
if [ ! -f "../SKILL.md" ]; then
|
||||
echo "❌ Error: SKILL.md not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validate frontmatter
|
||||
if ! grep -q "^---$" "../SKILL.md"; then
|
||||
echo "❌ Error: No frontmatter found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check required fields
|
||||
if ! grep -q "^name:" "../SKILL.md"; then
|
||||
echo "❌ Error: Missing 'name' field"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! grep -q "^description:" "../SKILL.md"; then
|
||||
echo "❌ Error: Missing 'description' field"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✅ Skill validation passed"
|
||||
Reference in New Issue
Block a user