refactor(autominator): create standalone module independent from BMM
- Create new autominator module at src/modules/autominator/ - Move agent from bmm/agents/ to autominator/agents/ - Move workflows from bmm/workflows/autominator/ to autominator/workflows/ - Update module metadata from 'bmm' to 'autominator' - Update all path references in workflow files - Add module README.md with comprehensive documentation - Module is now independent and separately distributable
This commit is contained in:
parent
0edda967a5
commit
b7239c1ec3
|
|
@ -0,0 +1,306 @@
|
|||
# Autominator - n8n Workflow Automation Module
|
||||
|
||||
**Arnold the Autominator - I'll be back... with your workflows automated!** 🦾
|
||||
|
||||
Standalone module for n8n workflow automation, creation, migration, and optimization. Build, modify, migrate, and optimize n8n workflows with expert guidance and up-to-date documentation.
|
||||
|
||||
## Overview
|
||||
|
||||
Autominator is an independent BMAD module that specializes in n8n workflow automation. Whether you're building new workflows from scratch, migrating from other platforms, or optimizing existing workflows, Arnold has you covered.
|
||||
|
||||
## Agent
|
||||
|
||||
**Arnold** - n8n Workflow Automation Specialist
|
||||
|
||||
- Expert in n8n workflow creation, modification, and optimization
|
||||
- Specializes in platform migration (Zapier, Make, HubSpot, Power Automate)
|
||||
- Uses Context7 MCP for up-to-date n8n documentation
|
||||
- Smart elicitation for accurate requirement gathering
|
||||
- Comprehensive workflow validation and testing
|
||||
|
||||
## Workflows
|
||||
|
||||
### 1. Create Workflow
|
||||
|
||||
Build new n8n workflows from scratch based on your requirements.
|
||||
|
||||
**Triggers:**
|
||||
|
||||
- `*create-workflow`
|
||||
|
||||
**Features:**
|
||||
|
||||
- Smart elicitation to understand your needs
|
||||
- Workflow type selection (webhook, scheduled, event-driven, manual, database-driven)
|
||||
- Integration selection and configuration
|
||||
- Complexity assessment
|
||||
- Error handling strategy planning
|
||||
- Context7 MCP integration for latest n8n docs
|
||||
- Automatic JSON validation
|
||||
|
||||
### 2. Modify Workflow
|
||||
|
||||
Edit or update existing n8n workflows with backup and safety checks.
|
||||
|
||||
**Triggers:**
|
||||
|
||||
- `*modify-workflow`
|
||||
|
||||
**Features:**
|
||||
|
||||
- Load existing workflows from file or paste
|
||||
- Selective modification (add, modify, or remove nodes)
|
||||
- Connection management
|
||||
- Automatic backup creation
|
||||
- Change validation
|
||||
- Rollback capability
|
||||
|
||||
### 3. Migrate Workflow
|
||||
|
||||
Migrate automation workflows from other platforms to n8n.
|
||||
|
||||
**Supported Platforms:**
|
||||
|
||||
- Zapier
|
||||
- Make (Integromat)
|
||||
- HubSpot Workflows
|
||||
- Microsoft Power Automate
|
||||
- IFTTT
|
||||
- Custom platforms
|
||||
|
||||
**Triggers:**
|
||||
|
||||
- `*migrate-workflow`
|
||||
|
||||
**Features:**
|
||||
|
||||
- Platform-specific mapping
|
||||
- Trigger and action conversion
|
||||
- Data transformation planning
|
||||
- Credential requirement identification
|
||||
- Migration notes and documentation
|
||||
- Post-migration testing guidance
|
||||
|
||||
### 4. Optimize Workflow
|
||||
|
||||
Analyze and improve existing n8n workflows for performance and best practices.
|
||||
|
||||
**Triggers:**
|
||||
|
||||
- `*optimize-workflow`
|
||||
|
||||
**Features:**
|
||||
|
||||
- Comprehensive workflow analysis
|
||||
- Performance optimization recommendations
|
||||
- Error handling improvements
|
||||
- Code quality assessment
|
||||
- Structure optimization
|
||||
- Best practices validation
|
||||
- Security review
|
||||
- Automatic backup before changes
|
||||
- Selective optimization application
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Load Arnold Agent
|
||||
|
||||
```bash
|
||||
# In your IDE, load the Autominator agent
|
||||
agent autominator/autominator
|
||||
|
||||
# Or use the agent trigger
|
||||
*autominator
|
||||
```
|
||||
|
||||
### Create a Workflow
|
||||
|
||||
```bash
|
||||
# Start the create workflow process
|
||||
*create-workflow
|
||||
|
||||
# Follow the interactive prompts to:
|
||||
# 1. Describe your workflow type
|
||||
# 2. Select integrations
|
||||
# 3. Define complexity level
|
||||
# 4. Configure error handling
|
||||
# 5. Review and confirm
|
||||
```
|
||||
|
||||
### Migrate from Another Platform
|
||||
|
||||
```bash
|
||||
# Start the migration process
|
||||
*migrate-workflow
|
||||
|
||||
# Provide:
|
||||
# 1. Source platform (Zapier, Make, HubSpot, etc.)
|
||||
# 2. Workflow details or export file
|
||||
# 3. Integration list
|
||||
# 4. Desired output location
|
||||
```
|
||||
|
||||
### Optimize Existing Workflow
|
||||
|
||||
```bash
|
||||
# Analyze and improve a workflow
|
||||
*optimize-workflow
|
||||
|
||||
# Select optimization focus:
|
||||
# - Performance
|
||||
# - Error Handling
|
||||
# - Code Quality
|
||||
# - Structure
|
||||
# - Best Practices
|
||||
# - Security
|
||||
# - All
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
### Context7 MCP Integration
|
||||
|
||||
- Automatic Context7 availability check
|
||||
- Fallback to built-in knowledge if unavailable
|
||||
- IDE-agnostic setup guidance
|
||||
- Up-to-date n8n documentation access
|
||||
|
||||
### Smart Elicitation
|
||||
|
||||
- Contextual analysis of existing information
|
||||
- Numbered option selection
|
||||
- Progressive requirement gathering
|
||||
- Validation before execution
|
||||
|
||||
### Comprehensive Validation
|
||||
|
||||
- JSON syntax validation
|
||||
- Schema compliance checking
|
||||
- Connection integrity verification
|
||||
- Error recovery (never deletes files)
|
||||
|
||||
### Platform Mappings
|
||||
|
||||
Built-in mappings for:
|
||||
|
||||
- Zapier triggers and actions
|
||||
- Make modules and routers
|
||||
- HubSpot workflow actions
|
||||
- Power Automate flows
|
||||
- Common automation patterns
|
||||
|
||||
### Shared Resources
|
||||
|
||||
- **n8n-helpers.md** - Node creation guidelines and patterns
|
||||
- **n8n-templates.yaml** - 8 reusable workflow templates
|
||||
- **platform-mappings.yaml** - Platform conversion reference
|
||||
|
||||
## Module Structure
|
||||
|
||||
```
|
||||
autominator/
|
||||
├── _module-installer/
|
||||
│ └── install-config.yaml
|
||||
├── agents/
|
||||
│ └── autominator.agent.yaml
|
||||
├── workflows/
|
||||
│ ├── _shared/
|
||||
│ │ ├── n8n-helpers.md
|
||||
│ │ ├── n8n-templates.yaml
|
||||
│ │ └── platform-mappings.yaml
|
||||
│ ├── create-workflow/
|
||||
│ │ ├── workflow.yaml
|
||||
│ │ ├── instructions.md
|
||||
│ │ └── checklist.md
|
||||
│ ├── modify-workflow/
|
||||
│ │ ├── workflow.yaml
|
||||
│ │ ├── instructions.md
|
||||
│ │ └── checklist.md
|
||||
│ ├── migrate-workflow/
|
||||
│ │ ├── workflow.yaml
|
||||
│ │ ├── instructions.md
|
||||
│ │ └── checklist.md
|
||||
│ └── optimize-workflow/
|
||||
│ ├── workflow.yaml
|
||||
│ ├── instructions.md
|
||||
│ └── checklist.md
|
||||
└── README.md
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- n8n instance or account
|
||||
- Context7 MCP server (optional, for latest docs)
|
||||
- IDE with BMAD support
|
||||
|
||||
## Installation
|
||||
|
||||
Autominator is a standalone module and can be installed independently:
|
||||
|
||||
```bash
|
||||
# Install via BMAD
|
||||
npx bmad-method@alpha install autominator
|
||||
|
||||
# Or manually copy to your BMAD installation
|
||||
cp -r autominator/ /path/to/bmad/src/modules/
|
||||
```
|
||||
|
||||
## Integration with Other Modules
|
||||
|
||||
Autominator is independent but can be used alongside:
|
||||
|
||||
- **BMM** - For project lifecycle management
|
||||
- **CIS** - For creative workflow design
|
||||
- **BMB** - For module building
|
||||
- **BMGD** - For game development workflows
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Provide Clear Context** - Describe your workflow purpose and requirements
|
||||
2. **Use Smart Elicitation** - Let Arnold ask clarifying questions
|
||||
3. **Test Before Activation** - Always test workflows with sample data
|
||||
4. **Monitor Initial Runs** - Watch for errors in first executions
|
||||
5. **Document Changes** - Keep notes on workflow modifications
|
||||
6. **Backup Regularly** - Use modify-workflow's backup feature
|
||||
7. **Review Optimizations** - Understand changes before applying
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Context7 MCP Not Available
|
||||
|
||||
- Install uv: `curl -LsSf https://astral.sh/uv/install.sh | sh`
|
||||
- Configure Context7 in your IDE's MCP settings
|
||||
- Restart MCP servers
|
||||
|
||||
### Workflow JSON Validation Fails
|
||||
|
||||
- Check for missing commas or brackets
|
||||
- Verify all node IDs are unique
|
||||
- Ensure all connections reference existing nodes
|
||||
- Use the error location to fix syntax
|
||||
|
||||
### Workflow Execution Issues
|
||||
|
||||
- Verify all credentials are configured
|
||||
- Test with sample data first
|
||||
- Check error handling settings
|
||||
- Review workflow logs for details
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- **[n8n Documentation](https://docs.n8n.io/)** - Official n8n docs
|
||||
- **[BMAD Method](../bmm/README.md)** - Core BMAD framework
|
||||
- **[CIS Module](../cis/README.md)** - Creative facilitation
|
||||
- **[BMB Module](../bmb/README.md)** - Module building
|
||||
|
||||
## Support
|
||||
|
||||
- **Issues** - Report bugs on GitHub
|
||||
- **Questions** - Check the troubleshooting section
|
||||
- **Feedback** - Share suggestions for improvements
|
||||
|
||||
---
|
||||
|
||||
**Ready to automate?** Load Arnold and start with `*create-workflow`!
|
||||
|
||||
Part of BMad Method - Transform automation potential through expert AI guidance.
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
# Autominator Module Installation Configuration
|
||||
|
||||
code: autominator
|
||||
name: "Autominator: n8n Workflow Automation"
|
||||
default_selected: false
|
||||
|
||||
header: "Autominator - n8n Workflow Automation Module"
|
||||
subheader: "Configure the settings for the Autominator module"
|
||||
|
||||
# Core config values automatically inherited:
|
||||
## user_name
|
||||
## communication_language
|
||||
## document_output_language
|
||||
## output_folder
|
||||
## bmad_folder
|
||||
## install_user_docs
|
||||
## kb_install
|
||||
|
||||
n8n_instance_url:
|
||||
prompt: "What is your n8n instance URL? (optional, for reference)"
|
||||
default: "https://n8n.example.com"
|
||||
result: "{value}"
|
||||
|
||||
workflow_output_folder:
|
||||
prompt: "Where should generated workflows be stored?"
|
||||
default: "{output_folder}/n8n-workflows"
|
||||
result: "{project-root}/{value}"
|
||||
|
||||
automation_experience:
|
||||
prompt: "What is your n8n/automation experience level?"
|
||||
default: "intermediate"
|
||||
result: "{value}"
|
||||
single-select:
|
||||
- value: "beginner"
|
||||
label: "Beginner - New to n8n, provide detailed guidance"
|
||||
- value: "intermediate"
|
||||
label: "Intermediate - Familiar with n8n concepts, balanced approach"
|
||||
- value: "expert"
|
||||
label: "Expert - Experienced n8n developer, be direct and technical"
|
||||
|
||||
primary_integrations:
|
||||
prompt: "Which integrations do you primarily use? (select all that apply)"
|
||||
default: ["http", "database"]
|
||||
result: "{value}"
|
||||
multi-select:
|
||||
- value: "http"
|
||||
label: "HTTP/REST APIs"
|
||||
- value: "database"
|
||||
label: "Databases (PostgreSQL, MySQL, MongoDB)"
|
||||
- value: "cloud"
|
||||
label: "Cloud Services (Google Sheets, Slack, Notion, Airtable)"
|
||||
- value: "crm"
|
||||
label: "CRM Systems (HubSpot, Salesforce)"
|
||||
- value: "email"
|
||||
label: "Email"
|
||||
- value: "custom"
|
||||
label: "Custom/Other"
|
||||
|
||||
enable_context7:
|
||||
prompt: "Enable Context7 MCP for up-to-date n8n documentation?"
|
||||
default: true
|
||||
result: "{value}"
|
||||
single-select:
|
||||
- value: true
|
||||
label: "Yes - Use Context7 for latest docs"
|
||||
- value: false
|
||||
label: "No - Use built-in knowledge"
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
# Autominator - Arnold the Automation Expert
|
||||
|
||||
agent:
|
||||
webskip: true
|
||||
metadata:
|
||||
id: "{bmad_folder}/autominator/agents/autominator.md"
|
||||
name: Arnold
|
||||
title: Arnold the Autominator
|
||||
icon: 🦾
|
||||
module: autominator
|
||||
|
||||
persona:
|
||||
role: n8n Workflow Automation Specialist
|
||||
identity: Arnold the Autominator - I'll be back... with your workflows automated! 🦾 Expert in n8n workflow creation, migration, and optimization. Specializes in building automation workflows, migrating from other platforms (Zapier, Make, HubSpot), and optimizing existing n8n workflows using up-to-date documentation via Context7.
|
||||
communication_style: Automation-first, elicitation-driven, solution-oriented. Presents options as numbered lists for easy selection. Always validates understanding before building. Direct, confident, and results-focused.
|
||||
principles: |
|
||||
- Context7 Integration - Always use latest n8n documentation via Context7 MCP server for accurate, up-to-date implementations.
|
||||
- Elicitation First - Understand requirements thoroughly before suggesting or building solutions.
|
||||
- Lazy Loading - Load files and documentation only when needed to minimize context pollution.
|
||||
- Validation - Always validate workflow JSON syntax after creation.
|
||||
- Platform Agnostic - Support migration from any automation platform with proper mapping.
|
||||
- Error Recovery - NEVER delete files due to syntax errors, always fix them using error location information.
|
||||
- Structured Approach - Follow task-specific workflows for different automation scenarios.
|
||||
|
||||
menu:
|
||||
- trigger: create-workflow
|
||||
workflow: "{project-root}/{bmad_folder}/autominator/workflows/create-workflow/workflow.yaml"
|
||||
description: Create new n8n workflow from scratch based on requirements
|
||||
|
||||
- trigger: modify-workflow
|
||||
workflow: "{project-root}/{bmad_folder}/autominator/workflows/modify-workflow/workflow.yaml"
|
||||
description: Edit or update existing n8n workflow
|
||||
|
||||
- trigger: migrate-workflow
|
||||
workflow: "{project-root}/{bmad_folder}/autominator/workflows/migrate-workflow/workflow.yaml"
|
||||
description: Migrate workflows from other platforms (Zapier, Make, HubSpot, etc.) to n8n
|
||||
|
||||
- trigger: optimize-workflow
|
||||
workflow: "{project-root}/{bmad_folder}/autominator/workflows/optimize-workflow/workflow.yaml"
|
||||
description: Review and improve existing n8n workflows for performance and best practices
|
||||
|
||||
- trigger: party-mode
|
||||
workflow: "{project-root}/{bmad_folder}/core/workflows/party-mode/workflow.yaml"
|
||||
description: Bring the whole team in to chat with other expert agents from the party
|
||||
|
|
@ -0,0 +1,201 @@
|
|||
# n8n Workflow Helpers
|
||||
|
||||
## Node Creation Guidelines
|
||||
|
||||
### Basic Node Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "unique-node-id",
|
||||
"name": "Node Name",
|
||||
"type": "n8n-nodes-base.nodeName",
|
||||
"typeVersion": 1,
|
||||
"position": [x, y],
|
||||
"parameters": {},
|
||||
"credentials": {}
|
||||
}
|
||||
```
|
||||
|
||||
### Node Positioning
|
||||
|
||||
- Start node: [250, 300]
|
||||
- Horizontal spacing: 220px between nodes
|
||||
- Vertical spacing: 100px for parallel branches
|
||||
- Grid alignment: Snap to 20px grid for clean layout
|
||||
|
||||
### Common Node Types
|
||||
|
||||
**Trigger Nodes:**
|
||||
|
||||
- `n8n-nodes-base.webhook` - HTTP webhook trigger
|
||||
- `n8n-nodes-base.scheduleTrigger` - Cron/interval trigger
|
||||
- `n8n-nodes-base.manualTrigger` - Manual execution trigger
|
||||
- `n8n-nodes-base.emailTrigger` - Email trigger
|
||||
|
||||
**Action Nodes:**
|
||||
|
||||
- `n8n-nodes-base.httpRequest` - HTTP API calls
|
||||
- `n8n-nodes-base.set` - Data transformation
|
||||
- `n8n-nodes-base.code` - Custom JavaScript/Python code
|
||||
- `n8n-nodes-base.if` - Conditional branching
|
||||
- `n8n-nodes-base.merge` - Merge data from multiple branches
|
||||
- `n8n-nodes-base.splitInBatches` - Process data in batches
|
||||
|
||||
**Integration Nodes:**
|
||||
|
||||
- `n8n-nodes-base.googleSheets` - Google Sheets
|
||||
- `n8n-nodes-base.slack` - Slack
|
||||
- `n8n-nodes-base.notion` - Notion
|
||||
- `n8n-nodes-base.airtable` - Airtable
|
||||
- `n8n-nodes-base.postgres` - PostgreSQL
|
||||
- `n8n-nodes-base.mysql` - MySQL
|
||||
|
||||
## Connection Guidelines
|
||||
|
||||
### Connection Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"node": "Source Node Name",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
```
|
||||
|
||||
### Connection Rules
|
||||
|
||||
1. Each connection has a source node and target node
|
||||
2. Main connections use type: "main"
|
||||
3. Index 0 is default output, index 1+ for conditional branches
|
||||
4. IF nodes have index 0 (true) and index 1 (false)
|
||||
5. Always validate that referenced node names exist
|
||||
|
||||
### Connection Patterns
|
||||
|
||||
**Linear Flow:**
|
||||
|
||||
```
|
||||
Trigger → Action1 → Action2 → End
|
||||
```
|
||||
|
||||
**Conditional Branch:**
|
||||
|
||||
```
|
||||
Trigger → IF Node → [true: Action1, false: Action2] → Merge
|
||||
```
|
||||
|
||||
**Parallel Processing:**
|
||||
|
||||
```
|
||||
Trigger → Split → [Branch1, Branch2, Branch3] → Merge
|
||||
```
|
||||
|
||||
## Error Handling Best Practices
|
||||
|
||||
### Error Workflow Pattern
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Error Handler",
|
||||
"type": "n8n-nodes-base.errorTrigger",
|
||||
"parameters": {
|
||||
"errorWorkflows": ["workflow-id"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Retry Configuration
|
||||
|
||||
```json
|
||||
{
|
||||
"retryOnFail": true,
|
||||
"maxTries": 3,
|
||||
"waitBetweenTries": 1000
|
||||
}
|
||||
```
|
||||
|
||||
## Data Transformation Patterns
|
||||
|
||||
### Using Set Node
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Transform Data",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"parameters": {
|
||||
"mode": "manual",
|
||||
"values": {
|
||||
"string": [
|
||||
{
|
||||
"name": "outputField",
|
||||
"value": "={{ $json.inputField }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Using Code Node
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Custom Logic",
|
||||
"type": "n8n-nodes-base.code",
|
||||
"parameters": {
|
||||
"language": "javaScript",
|
||||
"jsCode": "return items.map(item => ({ json: { ...item.json, processed: true } }));"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Credentials Management
|
||||
|
||||
### Credential Reference
|
||||
|
||||
```json
|
||||
{
|
||||
"credentials": {
|
||||
"httpBasicAuth": {
|
||||
"id": "credential-id",
|
||||
"name": "My API Credentials"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Common Credential Types
|
||||
|
||||
- `httpBasicAuth` - Basic authentication
|
||||
- `oAuth2Api` - OAuth2
|
||||
- `httpHeaderAuth` - Header-based auth
|
||||
- `httpQueryAuth` - Query parameter auth
|
||||
|
||||
## Workflow Metadata
|
||||
|
||||
### Required Fields
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Workflow Name",
|
||||
"nodes": [],
|
||||
"connections": {},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
```
|
||||
|
||||
## Validation Checklist
|
||||
|
||||
- [ ] All node IDs are unique
|
||||
- [ ] All node names are unique
|
||||
- [ ] All connections reference existing nodes
|
||||
- [ ] Trigger node exists and is properly configured
|
||||
- [ ] Node positions don't overlap
|
||||
- [ ] Required parameters are set for each node
|
||||
- [ ] Credentials are properly referenced
|
||||
- [ ] Error handling is configured where needed
|
||||
- [ ] JSON syntax is valid
|
||||
|
|
@ -0,0 +1,299 @@
|
|||
# n8n Workflow Templates
|
||||
|
||||
# Basic webhook workflow template
|
||||
webhook_workflow:
|
||||
name: "Webhook Workflow"
|
||||
nodes:
|
||||
- id: "webhook_trigger"
|
||||
name: "Webhook"
|
||||
type: "n8n-nodes-base.webhook"
|
||||
typeVersion: 1
|
||||
position: [250, 300]
|
||||
parameters:
|
||||
httpMethod: "POST"
|
||||
path: "webhook-path"
|
||||
responseMode: "onReceived"
|
||||
- id: "process_data"
|
||||
name: "Process Data"
|
||||
type: "n8n-nodes-base.set"
|
||||
typeVersion: 1
|
||||
position: [470, 300]
|
||||
parameters:
|
||||
mode: "manual"
|
||||
values: {}
|
||||
connections:
|
||||
Webhook:
|
||||
- - node: "Process Data"
|
||||
type: "main"
|
||||
index: 0
|
||||
|
||||
# Scheduled workflow template
|
||||
scheduled_workflow:
|
||||
name: "Scheduled Workflow"
|
||||
nodes:
|
||||
- id: "schedule_trigger"
|
||||
name: "Schedule Trigger"
|
||||
type: "n8n-nodes-base.scheduleTrigger"
|
||||
typeVersion: 1
|
||||
position: [250, 300]
|
||||
parameters:
|
||||
rule:
|
||||
interval:
|
||||
- field: "hours"
|
||||
hoursInterval: 1
|
||||
- id: "execute_action"
|
||||
name: "Execute Action"
|
||||
type: "n8n-nodes-base.httpRequest"
|
||||
typeVersion: 1
|
||||
position: [470, 300]
|
||||
parameters:
|
||||
method: "GET"
|
||||
url: ""
|
||||
connections:
|
||||
Schedule Trigger:
|
||||
- - node: "Execute Action"
|
||||
type: "main"
|
||||
index: 0
|
||||
|
||||
# Conditional workflow template
|
||||
conditional_workflow:
|
||||
name: "Conditional Workflow"
|
||||
nodes:
|
||||
- id: "manual_trigger"
|
||||
name: "Manual Trigger"
|
||||
type: "n8n-nodes-base.manualTrigger"
|
||||
typeVersion: 1
|
||||
position: [250, 300]
|
||||
parameters: {}
|
||||
- id: "if_condition"
|
||||
name: "IF"
|
||||
type: "n8n-nodes-base.if"
|
||||
typeVersion: 1
|
||||
position: [470, 300]
|
||||
parameters:
|
||||
conditions:
|
||||
boolean: []
|
||||
number: []
|
||||
string: []
|
||||
- id: "true_branch"
|
||||
name: "True Branch"
|
||||
type: "n8n-nodes-base.noOp"
|
||||
typeVersion: 1
|
||||
position: [690, 200]
|
||||
parameters: {}
|
||||
- id: "false_branch"
|
||||
name: "False Branch"
|
||||
type: "n8n-nodes-base.noOp"
|
||||
typeVersion: 1
|
||||
position: [690, 400]
|
||||
parameters: {}
|
||||
connections:
|
||||
Manual Trigger:
|
||||
- - node: "IF"
|
||||
type: "main"
|
||||
index: 0
|
||||
IF:
|
||||
- - node: "True Branch"
|
||||
type: "main"
|
||||
index: 0
|
||||
- - node: "False Branch"
|
||||
type: "main"
|
||||
index: 0
|
||||
|
||||
# API integration workflow template
|
||||
api_integration_workflow:
|
||||
name: "API Integration Workflow"
|
||||
nodes:
|
||||
- id: "webhook_trigger"
|
||||
name: "Webhook"
|
||||
type: "n8n-nodes-base.webhook"
|
||||
typeVersion: 1
|
||||
position: [250, 300]
|
||||
parameters:
|
||||
httpMethod: "POST"
|
||||
path: "api-webhook"
|
||||
responseMode: "onReceived"
|
||||
- id: "http_request"
|
||||
name: "HTTP Request"
|
||||
type: "n8n-nodes-base.httpRequest"
|
||||
typeVersion: 1
|
||||
position: [470, 300]
|
||||
parameters:
|
||||
method: "POST"
|
||||
url: ""
|
||||
jsonParameters: true
|
||||
options: {}
|
||||
- id: "transform_response"
|
||||
name: "Transform Response"
|
||||
type: "n8n-nodes-base.set"
|
||||
typeVersion: 1
|
||||
position: [690, 300]
|
||||
parameters:
|
||||
mode: "manual"
|
||||
values: {}
|
||||
connections:
|
||||
Webhook:
|
||||
- - node: "HTTP Request"
|
||||
type: "main"
|
||||
index: 0
|
||||
HTTP Request:
|
||||
- - node: "Transform Response"
|
||||
type: "main"
|
||||
index: 0
|
||||
|
||||
# Database workflow template
|
||||
database_workflow:
|
||||
name: "Database Workflow"
|
||||
nodes:
|
||||
- id: "schedule_trigger"
|
||||
name: "Schedule Trigger"
|
||||
type: "n8n-nodes-base.scheduleTrigger"
|
||||
typeVersion: 1
|
||||
position: [250, 300]
|
||||
parameters:
|
||||
rule:
|
||||
interval:
|
||||
- field: "minutes"
|
||||
minutesInterval: 15
|
||||
- id: "postgres_query"
|
||||
name: "Postgres"
|
||||
type: "n8n-nodes-base.postgres"
|
||||
typeVersion: 1
|
||||
position: [470, 300]
|
||||
parameters:
|
||||
operation: "executeQuery"
|
||||
query: ""
|
||||
- id: "process_results"
|
||||
name: "Process Results"
|
||||
type: "n8n-nodes-base.code"
|
||||
typeVersion: 1
|
||||
position: [690, 300]
|
||||
parameters:
|
||||
language: "javaScript"
|
||||
jsCode: "return items;"
|
||||
connections:
|
||||
Schedule Trigger:
|
||||
- - node: "Postgres"
|
||||
type: "main"
|
||||
index: 0
|
||||
Postgres:
|
||||
- - node: "Process Results"
|
||||
type: "main"
|
||||
index: 0
|
||||
|
||||
# Error handling workflow template
|
||||
error_handling_workflow:
|
||||
name: "Error Handling Workflow"
|
||||
nodes:
|
||||
- id: "manual_trigger"
|
||||
name: "Manual Trigger"
|
||||
type: "n8n-nodes-base.manualTrigger"
|
||||
typeVersion: 1
|
||||
position: [250, 300]
|
||||
parameters: {}
|
||||
- id: "risky_operation"
|
||||
name: "Risky Operation"
|
||||
type: "n8n-nodes-base.httpRequest"
|
||||
typeVersion: 1
|
||||
position: [470, 300]
|
||||
parameters:
|
||||
method: "GET"
|
||||
url: ""
|
||||
continueOnFail: true
|
||||
retryOnFail: true
|
||||
maxTries: 3
|
||||
waitBetweenTries: 1000
|
||||
- id: "check_error"
|
||||
name: "Check for Error"
|
||||
type: "n8n-nodes-base.if"
|
||||
typeVersion: 1
|
||||
position: [690, 300]
|
||||
parameters:
|
||||
conditions:
|
||||
boolean:
|
||||
- value1: "={{ $json.error !== undefined }}"
|
||||
value2: true
|
||||
- id: "handle_error"
|
||||
name: "Handle Error"
|
||||
type: "n8n-nodes-base.set"
|
||||
typeVersion: 1
|
||||
position: [910, 200]
|
||||
parameters:
|
||||
mode: "manual"
|
||||
values:
|
||||
string:
|
||||
- name: "status"
|
||||
value: "error"
|
||||
- id: "success_path"
|
||||
name: "Success Path"
|
||||
type: "n8n-nodes-base.noOp"
|
||||
typeVersion: 1
|
||||
position: [910, 400]
|
||||
parameters: {}
|
||||
connections:
|
||||
Manual Trigger:
|
||||
- - node: "Risky Operation"
|
||||
type: "main"
|
||||
index: 0
|
||||
Risky Operation:
|
||||
- - node: "Check for Error"
|
||||
type: "main"
|
||||
index: 0
|
||||
Check for Error:
|
||||
- - node: "Handle Error"
|
||||
type: "main"
|
||||
index: 0
|
||||
- - node: "Success Path"
|
||||
type: "main"
|
||||
index: 0
|
||||
|
||||
# Batch processing workflow template
|
||||
batch_processing_workflow:
|
||||
name: "Batch Processing Workflow"
|
||||
nodes:
|
||||
- id: "manual_trigger"
|
||||
name: "Manual Trigger"
|
||||
type: "n8n-nodes-base.manualTrigger"
|
||||
typeVersion: 1
|
||||
position: [250, 300]
|
||||
parameters: {}
|
||||
- id: "get_data"
|
||||
name: "Get Data"
|
||||
type: "n8n-nodes-base.httpRequest"
|
||||
typeVersion: 1
|
||||
position: [470, 300]
|
||||
parameters:
|
||||
method: "GET"
|
||||
url: ""
|
||||
- id: "split_batches"
|
||||
name: "Split In Batches"
|
||||
type: "n8n-nodes-base.splitInBatches"
|
||||
typeVersion: 1
|
||||
position: [690, 300]
|
||||
parameters:
|
||||
batchSize: 10
|
||||
- id: "process_batch"
|
||||
name: "Process Batch"
|
||||
type: "n8n-nodes-base.code"
|
||||
typeVersion: 1
|
||||
position: [910, 300]
|
||||
parameters:
|
||||
language: "javaScript"
|
||||
jsCode: "return items;"
|
||||
connections:
|
||||
Manual Trigger:
|
||||
- - node: "Get Data"
|
||||
type: "main"
|
||||
index: 0
|
||||
Get Data:
|
||||
- - node: "Split In Batches"
|
||||
type: "main"
|
||||
index: 0
|
||||
Split In Batches:
|
||||
- - node: "Process Batch"
|
||||
type: "main"
|
||||
index: 0
|
||||
Process Batch:
|
||||
- - node: "Split In Batches"
|
||||
type: "main"
|
||||
index: 0
|
||||
|
|
@ -0,0 +1,282 @@
|
|||
# Platform Migration Mappings
|
||||
# Maps common automation platform concepts to n8n equivalents
|
||||
|
||||
# Zapier to n8n mappings
|
||||
zapier:
|
||||
triggers:
|
||||
"New Email":
|
||||
n8n_node: "n8n-nodes-base.emailTrigger"
|
||||
notes: "Configure IMAP/POP3 credentials"
|
||||
"Webhook":
|
||||
n8n_node: "n8n-nodes-base.webhook"
|
||||
notes: "Use POST method by default"
|
||||
"Schedule":
|
||||
n8n_node: "n8n-nodes-base.scheduleTrigger"
|
||||
notes: "Convert Zapier schedule format to cron"
|
||||
"New Row in Google Sheets":
|
||||
n8n_node: "n8n-nodes-base.googleSheetsTrigger"
|
||||
notes: "Requires Google OAuth credentials"
|
||||
"New Slack Message":
|
||||
n8n_node: "n8n-nodes-base.slackTrigger"
|
||||
notes: "Configure channel and event type"
|
||||
|
||||
actions:
|
||||
"Send Email":
|
||||
n8n_node: "n8n-nodes-base.emailSend"
|
||||
notes: "Configure SMTP credentials"
|
||||
"HTTP Request":
|
||||
n8n_node: "n8n-nodes-base.httpRequest"
|
||||
notes: "Map method, URL, headers, and body"
|
||||
"Create Google Sheets Row":
|
||||
n8n_node: "n8n-nodes-base.googleSheets"
|
||||
parameters:
|
||||
operation: "append"
|
||||
"Send Slack Message":
|
||||
n8n_node: "n8n-nodes-base.slack"
|
||||
parameters:
|
||||
operation: "post"
|
||||
resource: "message"
|
||||
"Delay":
|
||||
n8n_node: "n8n-nodes-base.wait"
|
||||
notes: "Convert delay duration to milliseconds"
|
||||
"Filter":
|
||||
n8n_node: "n8n-nodes-base.if"
|
||||
notes: "Convert filter conditions to IF node logic"
|
||||
"Formatter":
|
||||
n8n_node: "n8n-nodes-base.set"
|
||||
notes: "Use Set node for data transformation"
|
||||
"Code":
|
||||
n8n_node: "n8n-nodes-base.code"
|
||||
notes: "JavaScript or Python code execution"
|
||||
|
||||
concepts:
|
||||
"Multi-step Zap":
|
||||
n8n_equivalent: "Linear workflow with connected nodes"
|
||||
"Paths":
|
||||
n8n_equivalent: "IF node with multiple branches"
|
||||
"Filters":
|
||||
n8n_equivalent: "IF node with conditions"
|
||||
"Formatter":
|
||||
n8n_equivalent: "Set node or Code node"
|
||||
"Looping":
|
||||
n8n_equivalent: "Split In Batches node"
|
||||
|
||||
# Make (Integromat) to n8n mappings
|
||||
make:
|
||||
triggers:
|
||||
"Webhook":
|
||||
n8n_node: "n8n-nodes-base.webhook"
|
||||
notes: "Direct equivalent"
|
||||
"Watch Records":
|
||||
n8n_node: "n8n-nodes-base.scheduleTrigger"
|
||||
notes: "Combine with polling logic in Code node"
|
||||
"Custom Webhook":
|
||||
n8n_node: "n8n-nodes-base.webhook"
|
||||
notes: "Configure response mode"
|
||||
|
||||
actions:
|
||||
"HTTP Request":
|
||||
n8n_node: "n8n-nodes-base.httpRequest"
|
||||
notes: "Map all HTTP parameters"
|
||||
"Router":
|
||||
n8n_node: "n8n-nodes-base.switch"
|
||||
notes: "Multiple conditional branches"
|
||||
"Iterator":
|
||||
n8n_node: "n8n-nodes-base.splitInBatches"
|
||||
notes: "Process array items individually"
|
||||
"Aggregator":
|
||||
n8n_node: "n8n-nodes-base.merge"
|
||||
notes: "Combine data from multiple sources"
|
||||
"Data Store":
|
||||
n8n_node: "n8n-nodes-base.redis"
|
||||
notes: "Use Redis or database node for storage"
|
||||
"JSON Parser":
|
||||
n8n_node: "n8n-nodes-base.code"
|
||||
notes: "Parse JSON in Code node"
|
||||
"Text Parser":
|
||||
n8n_node: "n8n-nodes-base.set"
|
||||
notes: "Use expressions for text manipulation"
|
||||
|
||||
concepts:
|
||||
"Scenario":
|
||||
n8n_equivalent: "Workflow"
|
||||
"Module":
|
||||
n8n_equivalent: "Node"
|
||||
"Route":
|
||||
n8n_equivalent: "Connection"
|
||||
"Filter":
|
||||
n8n_equivalent: "IF node"
|
||||
"Router":
|
||||
n8n_equivalent: "Switch node or multiple IF nodes"
|
||||
"Iterator":
|
||||
n8n_equivalent: "Split In Batches node"
|
||||
"Aggregator":
|
||||
n8n_equivalent: "Merge node"
|
||||
|
||||
# HubSpot Workflows to n8n mappings
|
||||
hubspot:
|
||||
triggers:
|
||||
"Contact Property Change":
|
||||
n8n_node: "n8n-nodes-base.hubspotTrigger"
|
||||
notes: "Configure webhook for property updates"
|
||||
"Deal Stage Change":
|
||||
n8n_node: "n8n-nodes-base.hubspotTrigger"
|
||||
notes: "Monitor deal pipeline changes"
|
||||
"Form Submission":
|
||||
n8n_node: "n8n-nodes-base.hubspotTrigger"
|
||||
notes: "Webhook for form submissions"
|
||||
"List Membership":
|
||||
n8n_node: "n8n-nodes-base.scheduleTrigger"
|
||||
notes: "Poll HubSpot API for list changes"
|
||||
|
||||
actions:
|
||||
"Update Contact Property":
|
||||
n8n_node: "n8n-nodes-base.hubspot"
|
||||
parameters:
|
||||
resource: "contact"
|
||||
operation: "update"
|
||||
"Create Deal":
|
||||
n8n_node: "n8n-nodes-base.hubspot"
|
||||
parameters:
|
||||
resource: "deal"
|
||||
operation: "create"
|
||||
"Send Email":
|
||||
n8n_node: "n8n-nodes-base.hubspot"
|
||||
parameters:
|
||||
resource: "email"
|
||||
operation: "send"
|
||||
"Add to List":
|
||||
n8n_node: "n8n-nodes-base.hubspot"
|
||||
parameters:
|
||||
resource: "contact"
|
||||
operation: "addToList"
|
||||
"Create Task":
|
||||
n8n_node: "n8n-nodes-base.hubspot"
|
||||
parameters:
|
||||
resource: "task"
|
||||
operation: "create"
|
||||
|
||||
concepts:
|
||||
"Enrollment Trigger":
|
||||
n8n_equivalent: "Trigger node (webhook or schedule)"
|
||||
"If/Then Branch":
|
||||
n8n_equivalent: "IF node"
|
||||
"Delay":
|
||||
n8n_equivalent: "Wait node"
|
||||
"Goal":
|
||||
n8n_equivalent: "IF node checking completion criteria"
|
||||
"Re-enrollment":
|
||||
n8n_equivalent: "Workflow settings with loop detection"
|
||||
|
||||
# Microsoft Power Automate to n8n mappings
|
||||
power_automate:
|
||||
triggers:
|
||||
"When an item is created":
|
||||
n8n_node: "n8n-nodes-base.webhook"
|
||||
notes: "Configure webhook for item creation events"
|
||||
"Recurrence":
|
||||
n8n_node: "n8n-nodes-base.scheduleTrigger"
|
||||
notes: "Convert recurrence pattern to cron"
|
||||
"When a HTTP request is received":
|
||||
n8n_node: "n8n-nodes-base.webhook"
|
||||
notes: "Direct equivalent"
|
||||
|
||||
actions:
|
||||
"HTTP":
|
||||
n8n_node: "n8n-nodes-base.httpRequest"
|
||||
notes: "Map all HTTP parameters"
|
||||
"Condition":
|
||||
n8n_node: "n8n-nodes-base.if"
|
||||
notes: "Convert condition logic"
|
||||
"Apply to each":
|
||||
n8n_node: "n8n-nodes-base.splitInBatches"
|
||||
notes: "Process array items"
|
||||
"Compose":
|
||||
n8n_node: "n8n-nodes-base.set"
|
||||
notes: "Data transformation"
|
||||
"Parse JSON":
|
||||
n8n_node: "n8n-nodes-base.code"
|
||||
notes: "Parse JSON in Code node"
|
||||
"Delay":
|
||||
n8n_node: "n8n-nodes-base.wait"
|
||||
notes: "Convert delay duration"
|
||||
|
||||
concepts:
|
||||
"Flow":
|
||||
n8n_equivalent: "Workflow"
|
||||
"Action":
|
||||
n8n_equivalent: "Node"
|
||||
"Condition":
|
||||
n8n_equivalent: "IF node"
|
||||
"Switch":
|
||||
n8n_equivalent: "Switch node"
|
||||
"Scope":
|
||||
n8n_equivalent: "Error handling with try/catch in Code node"
|
||||
"Apply to each":
|
||||
n8n_equivalent: "Split In Batches node"
|
||||
|
||||
# Common patterns across platforms
|
||||
common_patterns:
|
||||
conditional_logic:
|
||||
description: "If/then/else branching"
|
||||
n8n_implementation: "IF node with true/false branches"
|
||||
|
||||
loops:
|
||||
description: "Iterate over array items"
|
||||
n8n_implementation: "Split In Batches node"
|
||||
|
||||
data_transformation:
|
||||
description: "Transform, format, or map data"
|
||||
n8n_implementation: "Set node or Code node"
|
||||
|
||||
error_handling:
|
||||
description: "Handle errors and retries"
|
||||
n8n_implementation: "Node settings: continueOnFail, retryOnFail, maxTries"
|
||||
|
||||
delays:
|
||||
description: "Wait before next action"
|
||||
n8n_implementation: "Wait node with duration"
|
||||
|
||||
webhooks:
|
||||
description: "Receive HTTP requests"
|
||||
n8n_implementation: "Webhook node with response configuration"
|
||||
|
||||
api_calls:
|
||||
description: "Make HTTP requests to APIs"
|
||||
n8n_implementation: "HTTP Request node"
|
||||
|
||||
parallel_execution:
|
||||
description: "Execute multiple actions simultaneously"
|
||||
n8n_implementation: "Multiple connections from single node"
|
||||
|
||||
merge_data:
|
||||
description: "Combine data from multiple sources"
|
||||
n8n_implementation: "Merge node"
|
||||
|
||||
# Migration considerations
|
||||
migration_notes:
|
||||
authentication:
|
||||
- "Recreate all credentials in n8n"
|
||||
- "OAuth flows may need re-authorization"
|
||||
- "API keys and tokens must be securely stored"
|
||||
|
||||
scheduling:
|
||||
- "Convert platform-specific schedules to cron expressions"
|
||||
- "Consider timezone differences"
|
||||
- "Test schedule triggers before going live"
|
||||
|
||||
data_formats:
|
||||
- "Verify JSON structure compatibility"
|
||||
- "Check date/time format conversions"
|
||||
- "Validate data type mappings"
|
||||
|
||||
error_handling:
|
||||
- "Implement retry logic where needed"
|
||||
- "Add error notification workflows"
|
||||
- "Test failure scenarios"
|
||||
|
||||
testing:
|
||||
- "Test with sample data first"
|
||||
- "Verify all integrations work correctly"
|
||||
- "Monitor initial executions closely"
|
||||
- "Compare outputs with original platform"
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
# Create n8n Workflow - Validation Checklist
|
||||
|
||||
## Workflow Structure
|
||||
|
||||
- [ ] Workflow has a valid name
|
||||
- [ ] Workflow contains at least one trigger node
|
||||
- [ ] All nodes have unique IDs
|
||||
- [ ] All nodes have unique names
|
||||
- [ ] Workflow JSON is valid and parseable
|
||||
|
||||
## Node Configuration
|
||||
|
||||
- [ ] Trigger node is properly configured
|
||||
- [ ] All action nodes have required parameters set
|
||||
- [ ] Node types are valid n8n node types
|
||||
- [ ] Node positions are set and don't overlap
|
||||
- [ ] TypeVersion is set for all nodes (usually 1)
|
||||
|
||||
## Connections
|
||||
|
||||
- [ ] All nodes are connected (no orphaned nodes except trigger)
|
||||
- [ ] All connections reference existing node names
|
||||
- [ ] Connection types are set correctly (usually "main")
|
||||
- [ ] Connection indices are correct (0 for default, 0/1 for IF nodes)
|
||||
- [ ] No circular dependencies (unless intentional loops)
|
||||
|
||||
## Error Handling
|
||||
|
||||
- [ ] Error handling strategy matches requirements
|
||||
- [ ] Critical nodes have retry logic if needed
|
||||
- [ ] continueOnFail is set appropriately
|
||||
- [ ] maxTries and waitBetweenTries are configured if retries enabled
|
||||
|
||||
## Data Flow
|
||||
|
||||
- [ ] Data transformations are properly configured
|
||||
- [ ] Set nodes have correct value mappings
|
||||
- [ ] Code nodes have valid JavaScript/Python code
|
||||
- [ ] Expressions use correct n8n syntax (={{ }})
|
||||
|
||||
## Integrations
|
||||
|
||||
- [ ] All required integrations are included
|
||||
- [ ] Credential placeholders are set for authenticated services
|
||||
- [ ] API endpoints and methods are correct
|
||||
- [ ] Request/response formats are properly configured
|
||||
|
||||
## Best Practices
|
||||
|
||||
- [ ] Workflow follows n8n naming conventions
|
||||
- [ ] Nodes are logically organized and positioned
|
||||
- [ ] Complex logic is broken into manageable steps
|
||||
- [ ] Workflow is documented (node names are descriptive)
|
||||
|
||||
## Testing Readiness
|
||||
|
||||
- [ ] Workflow can be imported into n8n without errors
|
||||
- [ ] All required credentials are identified
|
||||
- [ ] Test data requirements are clear
|
||||
- [ ] Expected outputs are defined
|
||||
|
||||
## File Output
|
||||
|
||||
- [ ] File is saved to correct location
|
||||
- [ ] File has .json extension
|
||||
- [ ] File is valid JSON (passes JSON.parse)
|
||||
- [ ] File size is reasonable (not corrupted)
|
||||
|
||||
## Documentation
|
||||
|
||||
- [ ] User has been informed how to import workflow
|
||||
- [ ] Credential requirements have been communicated
|
||||
- [ ] Testing instructions have been provided
|
||||
- [ ] Any special configuration notes have been shared
|
||||
|
|
@ -0,0 +1,350 @@
|
|||
# Create n8n Workflow - Workflow Instructions
|
||||
|
||||
```xml
|
||||
<critical>The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml</critical>
|
||||
<critical>You MUST have already loaded and processed: {installed_path}/workflow.yaml</critical>
|
||||
<critical>This workflow creates a new n8n workflow from scratch based on user requirements.</critical>
|
||||
|
||||
<workflow>
|
||||
|
||||
<step n="0" goal="Contextual Analysis (Smart Elicitation)">
|
||||
<critical>Before asking any questions, analyze what the user has already told you</critical>
|
||||
|
||||
<action>Review the user's initial request and conversation history</action>
|
||||
<action>Extract any mentioned: workflow type, trigger, integrations, complexity, requirements</action>
|
||||
|
||||
<check if="ALL requirements are clear from context">
|
||||
<action>Summarize your understanding</action>
|
||||
<action>Skip directly to Step 2 (Check Context7 MCP)</action>
|
||||
</check>
|
||||
|
||||
<check if="SOME requirements are clear">
|
||||
<action>Note what you already know</action>
|
||||
<action>Only ask about missing information in Step 1</action>
|
||||
</check>
|
||||
|
||||
<check if="requirements are unclear or minimal">
|
||||
<action>Proceed with full elicitation in Step 1</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="1" goal="Gather Requirements" elicit="true">
|
||||
<action>Ask Question 1: "What type of automation workflow do you need?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Webhook-based - Receive HTTP requests and process data
|
||||
2. Scheduled - Run on a schedule (cron/interval)
|
||||
3. Event-driven - Trigger from external service events
|
||||
4. Manual - Execute on demand
|
||||
5. Database-driven - Trigger from database changes
|
||||
6. Other - Describe your specific trigger needs
|
||||
</action>
|
||||
<action>WAIT for user selection (1-6)</action>
|
||||
<action>Store selection in {{workflow_type}}</action>
|
||||
|
||||
<check if="selection is 6 (Other)">
|
||||
<action>Ask: "Please describe your trigger requirements"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{workflow_type}}</action>
|
||||
</check>
|
||||
|
||||
<action>Ask Question 2: "What integrations or services will this workflow use?"</action>
|
||||
<action>Present numbered options:
|
||||
1. HTTP/REST APIs - Generic API calls
|
||||
2. Databases - PostgreSQL, MySQL, MongoDB, etc.
|
||||
3. Cloud Services - Google Sheets, Slack, Notion, Airtable
|
||||
4. Email - Send/receive emails
|
||||
5. CRM - HubSpot, Salesforce, etc.
|
||||
6. Custom Code - JavaScript/Python logic
|
||||
7. Multiple - Combination of above
|
||||
8. Other - Specify integrations
|
||||
</action>
|
||||
<action>WAIT for user selection (1-8)</action>
|
||||
<action>Store selection in {{integrations}}</action>
|
||||
|
||||
<check if="selection is 7 or 8">
|
||||
<action>Ask: "Please list all integrations needed (comma-separated)"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{integrations}}</action>
|
||||
</check>
|
||||
|
||||
<action>Ask Question 3: "How complex is your workflow logic?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Simple (3-5 nodes) - Linear flow with minimal logic
|
||||
2. Medium (6-10 nodes) - Some conditional logic or branching
|
||||
3. Complex (11-20 nodes) - Multiple branches, loops, or error handling
|
||||
4. Very Complex (20+ nodes) - Advanced logic with parallel processing
|
||||
</action>
|
||||
<action>WAIT for user selection (1-4)</action>
|
||||
<action>Store selection in {{complexity}}</action>
|
||||
|
||||
<action>Ask Question 4: "Do you need error handling and retry logic?"</action>
|
||||
<action>Present numbered options:
|
||||
1. No - Simple workflow without error handling
|
||||
2. Basic - Retry failed operations automatically
|
||||
3. Advanced - Custom error handling with notifications
|
||||
4. Comprehensive - Full error workflow with logging and alerts
|
||||
</action>
|
||||
<action>WAIT for user selection (1-4)</action>
|
||||
<action>Store selection in {{error_handling}}</action>
|
||||
|
||||
<action>Ask Question 5: "What should the workflow be named?"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{workflow_name}}</action>
|
||||
|
||||
<action>Ask Question 6: "Where should the workflow file be saved?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Default location - workflows/[workflow-name].json
|
||||
2. Custom path - Specify your own file path
|
||||
3. Project root - Save in main project directory
|
||||
4. Specific folder - Choose from existing folders
|
||||
</action>
|
||||
<action>WAIT for user selection (1-4)</action>
|
||||
<check if="selection is 2 or 4">
|
||||
<action>Ask for specific path</action>
|
||||
<action>WAIT for user input</action>
|
||||
</check>
|
||||
<action>Store final path in {{save_location}}</action>
|
||||
|
||||
<action>Ask Question 7: "Any additional requirements or specific logic needed?"</action>
|
||||
<action>Present numbered options:
|
||||
1. No - Proceed with current requirements
|
||||
2. Yes - Describe additional requirements
|
||||
</action>
|
||||
<action>WAIT for user selection (1-2)</action>
|
||||
<check if="selection is 2">
|
||||
<action>Ask: "Please describe additional requirements"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{additional_requirements}}</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="2" goal="Check Context7 MCP Availability">
|
||||
<action>Check if Context7 MCP server is configured</action>
|
||||
<action>Try to list available MCP tools</action>
|
||||
|
||||
<check if="Context7 MCP is available">
|
||||
<action>Store true in {{context7_available}}</action>
|
||||
<action>Proceed to Step 3</action>
|
||||
</check>
|
||||
|
||||
<check if="Context7 MCP is NOT available">
|
||||
<action>Store false in {{context7_available}}</action>
|
||||
<action>Inform user: "Context7 MCP server is not configured. This provides up-to-date n8n documentation."</action>
|
||||
<action>Ask: "Would you like help setting up Context7 MCP? (yes/no)"</action>
|
||||
<action>WAIT for user response</action>
|
||||
|
||||
<check if="user says yes">
|
||||
<action>Guide user through Context7 MCP setup:</action>
|
||||
<action>1. Inform user: "Context7 MCP requires the 'uvx' command (part of uv Python package manager)"</action>
|
||||
<action>2. Ask: "Do you have 'uv' installed? (yes/no/not sure)"</action>
|
||||
<action>WAIT for response</action>
|
||||
|
||||
<check if="user says no or not sure">
|
||||
<action>Provide installation guidance:</action>
|
||||
<action>- macOS/Linux: curl -LsSf https://astral.sh/uv/install.sh | sh</action>
|
||||
<action>- Windows: powershell -c "irm https://astral.sh/uv/install.ps1 | iex"</action>
|
||||
<action>- Or via pip: pip install uv</action>
|
||||
<action>Ask user to install and confirm when ready</action>
|
||||
<action>WAIT for confirmation</action>
|
||||
</check>
|
||||
|
||||
<action>3. Inform user: "Please configure Context7 MCP in your IDE's MCP settings with:"</action>
|
||||
<action>
|
||||
Server name: context7
|
||||
Command: uvx
|
||||
Args: ["context7"]
|
||||
Auto-approve tools: ["resolve-library-id", "get-library-docs"]
|
||||
</action>
|
||||
<action>4. Ask user to reconnect/restart MCP servers in their IDE</action>
|
||||
<action>5. Wait for user confirmation that MCP is reconnected</action>
|
||||
<action>6. Verify Context7 is now available</action>
|
||||
<action>Store result in {{context7_available}}</action>
|
||||
</check>
|
||||
|
||||
<check if="user says no">
|
||||
<action>Inform: "Proceeding without Context7. Using built-in n8n knowledge."</action>
|
||||
<action>Proceed to Step 4</action>
|
||||
</check>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="3" goal="Query Context7 for n8n Documentation">
|
||||
<check if="{{context7_available}} is true">
|
||||
<action>Resolve n8n library ID using Context7</action>
|
||||
<action>Query Context7 for relevant n8n documentation based on:</action>
|
||||
<action>- Workflow type: {{workflow_type}}</action>
|
||||
<action>- Integrations: {{integrations}}</action>
|
||||
<action>- Complexity: {{complexity}}</action>
|
||||
<action>Store relevant documentation snippets for reference</action>
|
||||
</check>
|
||||
|
||||
<check if="{{context7_available}} is false">
|
||||
<action>Skip Context7 query</action>
|
||||
<action>Use built-in knowledge and templates</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="4" goal="Plan Workflow Structure">
|
||||
<action>Based on gathered requirements, plan the workflow structure:</action>
|
||||
<action>1. Identify trigger node type</action>
|
||||
<action>2. List all action nodes needed</action>
|
||||
<action>3. Identify conditional logic (IF nodes)</action>
|
||||
<action>4. Plan data transformations (Set/Code nodes)</action>
|
||||
<action>5. Design error handling strategy</action>
|
||||
<action>6. Map node connections</action>
|
||||
|
||||
<action>Present the planned structure to user in clear format:</action>
|
||||
<action>- Trigger: [trigger type]</action>
|
||||
<action>- Nodes: [list of nodes with descriptions]</action>
|
||||
<action>- Logic: [conditional branches, loops]</action>
|
||||
<action>- Error Handling: [strategy]</action>
|
||||
|
||||
<action>Ask: "Does this structure meet your needs?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Yes - Proceed with this structure
|
||||
2. No - Adjust the structure
|
||||
3. Add more details - Provide additional requirements
|
||||
</action>
|
||||
<action>WAIT for user selection (1-3)</action>
|
||||
|
||||
<check if="selection is 2 or 3">
|
||||
<action>Ask: "What changes or additions are needed?"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Adjust structure based on feedback</action>
|
||||
<action>Repeat this step</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="5" goal="Load Templates and Resources">
|
||||
<action>Load {{templates}} file</action>
|
||||
<action>Identify closest matching template based on workflow type</action>
|
||||
<action>Load {{helpers}} for node creation guidelines</action>
|
||||
<action>Extract relevant template sections</action>
|
||||
</step>
|
||||
|
||||
<step n="6" goal="Build Workflow JSON">
|
||||
<critical>Follow guidelines from {{helpers}} for proper node creation</critical>
|
||||
|
||||
<action>Initialize workflow structure:</action>
|
||||
<substep>
|
||||
{
|
||||
"name": "{{workflow_name}}",
|
||||
"nodes": [],
|
||||
"connections": {},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
</substep>
|
||||
|
||||
<action>Build nodes ONE at a time following these rules:</action>
|
||||
|
||||
<substep>For Each Node:
|
||||
1. Generate unique node ID
|
||||
2. Set node name (unique, descriptive)
|
||||
3. Set node type (e.g., n8n-nodes-base.webhook)
|
||||
4. Set typeVersion (usually 1)
|
||||
5. Calculate position:
|
||||
- First node (trigger): [250, 300]
|
||||
- Subsequent nodes: add 220 to x for each step
|
||||
- Branches: adjust y by ±100
|
||||
6. Configure parameters based on node type
|
||||
7. Add credentials if needed
|
||||
8. Set error handling options if required:
|
||||
- continueOnFail: true/false
|
||||
- retryOnFail: true/false
|
||||
- maxTries: number
|
||||
- waitBetweenTries: milliseconds
|
||||
</substep>
|
||||
|
||||
<substep>For Each Connection:
|
||||
1. Identify source node name
|
||||
2. Identify target node name
|
||||
3. Create connection entry in connections object:
|
||||
"Source Node Name": [
|
||||
[
|
||||
{
|
||||
"node": "Target Node Name",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
4. For IF nodes:
|
||||
- index 0 = true branch
|
||||
- index 1 = false branch
|
||||
5. Validate all referenced nodes exist
|
||||
</substep>
|
||||
|
||||
<substep>Node Building Order:
|
||||
1. Trigger node
|
||||
2. Main flow action nodes
|
||||
3. Conditional nodes (IF/Switch)
|
||||
4. Branch nodes
|
||||
5. Merge nodes
|
||||
6. Final action nodes
|
||||
7. Connect all nodes
|
||||
</substep>
|
||||
|
||||
<action>Apply error handling based on {{error_handling}} selection</action>
|
||||
<action>Validate all node IDs are unique</action>
|
||||
<action>Validate all node names are unique</action>
|
||||
<action>Validate all connections reference existing nodes</action>
|
||||
</step>
|
||||
|
||||
<step n="7" goal="Optimize and Save">
|
||||
<action>Review workflow for optimization:</action>
|
||||
<action>- Remove any unused nodes</action>
|
||||
<action>- Verify node positions don't overlap</action>
|
||||
<action>- Ensure proper spacing and alignment</action>
|
||||
<action>- Validate all required parameters are set</action>
|
||||
|
||||
<action>Save workflow to {{save_location}}</action>
|
||||
</step>
|
||||
|
||||
<step n="8" goal="Validate JSON Syntax">
|
||||
<critical>NEVER delete the file if validation fails - always fix syntax errors</critical>
|
||||
|
||||
<action>Run: node -e "JSON.parse(require('fs').readFileSync('{{save_location}}', 'utf8')); console.log('✓ Valid JSON')"</action>
|
||||
|
||||
<check if="validation fails (exit code 1)">
|
||||
<action>Read the error message carefully - it shows the syntax error and position</action>
|
||||
<action>Open the file and navigate to the error location</action>
|
||||
<action>Fix the syntax error (add missing comma, bracket, or quote as indicated)</action>
|
||||
<action>Save the file</action>
|
||||
<action>Re-run validation with the same command</action>
|
||||
<action>Repeat until validation passes</action>
|
||||
</check>
|
||||
|
||||
<action>Once validation passes, confirm with user: "n8n workflow created at {{save_location}}"</action>
|
||||
</step>
|
||||
|
||||
<step n="9" goal="Provide Usage Instructions">
|
||||
<action>Inform user how to use the workflow:</action>
|
||||
<action>1. Import the JSON file into n8n</action>
|
||||
<action>2. Configure credentials for integrated services</action>
|
||||
<action>3. Test the workflow with sample data</action>
|
||||
<action>4. Activate the workflow when ready</action>
|
||||
|
||||
<action>Ask: "Would you like me to explain any part of the workflow?"</action>
|
||||
<action>Present numbered options:
|
||||
1. No - I'm good to go
|
||||
2. Yes - Explain specific nodes
|
||||
3. Yes - Explain the overall flow
|
||||
4. Yes - Explain how to test it
|
||||
</action>
|
||||
<action>WAIT for user selection (1-4)</action>
|
||||
|
||||
<check if="selection is 2, 3, or 4">
|
||||
<action>Provide requested explanation</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="10" goal="Validate Content">
|
||||
<invoke-task>Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml</invoke-task>
|
||||
</step>
|
||||
|
||||
</workflow>
|
||||
```
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
name: create-workflow
|
||||
description: "Create new n8n workflow from scratch based on requirements"
|
||||
author: "Saif"
|
||||
|
||||
# Workflow components
|
||||
installed_path: "{project-root}/{bmad_folder}/autominator/workflows/create-workflow"
|
||||
shared_path: "{project-root}/{bmad_folder}/autominator/workflows/_shared"
|
||||
instructions: "{installed_path}/instructions.md"
|
||||
validation: "{installed_path}/checklist.md"
|
||||
|
||||
# Shared resources
|
||||
helpers: "{shared_path}/n8n-helpers.md"
|
||||
templates: "{shared_path}/n8n-templates.yaml"
|
||||
platform_mappings: "{shared_path}/platform-mappings.yaml"
|
||||
|
||||
# Variables
|
||||
variables:
|
||||
workflow_type: "" # Will be elicited
|
||||
trigger_type: "" # Will be elicited
|
||||
integrations: [] # Will be elicited
|
||||
complexity: "" # Will be elicited
|
||||
error_handling: "" # Will be elicited
|
||||
save_location: "" # Will be elicited
|
||||
workflow_name: "" # Will be elicited
|
||||
additional_requirements: "" # Will be elicited
|
||||
context7_available: false # Will be checked
|
||||
|
||||
default_output_file: "{project-root}/workflows/workflow-{timestamp}.json"
|
||||
|
||||
standalone: true
|
||||
web_bundle: false
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
# Migrate Workflow to n8n - Validation Checklist
|
||||
|
||||
## Source Analysis
|
||||
|
||||
- [ ] Source platform was identified
|
||||
- [ ] Source workflow details were gathered
|
||||
- [ ] Trigger type was identified
|
||||
- [ ] All integrations were identified
|
||||
- [ ] Workflow complexity was assessed
|
||||
|
||||
## Platform Mapping
|
||||
|
||||
- [ ] Platform mappings were loaded
|
||||
- [ ] Source trigger was mapped to n8n trigger
|
||||
- [ ] All source actions were mapped to n8n nodes
|
||||
- [ ] Conditional logic was mapped correctly
|
||||
- [ ] Loops/iterations were mapped correctly
|
||||
- [ ] Data transformations were identified
|
||||
|
||||
## Workflow Structure
|
||||
|
||||
- [ ] n8n workflow has valid JSON structure
|
||||
- [ ] Workflow name is set
|
||||
- [ ] Migration tag is added (migrated-from-[platform])
|
||||
- [ ] All nodes have unique IDs
|
||||
- [ ] All nodes have unique names
|
||||
- [ ] Trigger node is properly configured
|
||||
|
||||
## Node Configuration
|
||||
|
||||
- [ ] All mapped nodes are created
|
||||
- [ ] Node types are valid n8n types
|
||||
- [ ] Node parameters are configured
|
||||
- [ ] Credentials placeholders are set
|
||||
- [ ] Node positions are calculated correctly
|
||||
- [ ] No overlapping nodes
|
||||
|
||||
## Data Mappings
|
||||
|
||||
- [ ] Field mappings from source to n8n are correct
|
||||
- [ ] Data type conversions are handled
|
||||
- [ ] Date/time format differences are addressed
|
||||
- [ ] Expressions use correct n8n syntax (={{ }})
|
||||
- [ ] Set nodes are used for simple transformations
|
||||
- [ ] Code nodes are used for complex transformations
|
||||
|
||||
## Conditional Logic
|
||||
|
||||
- [ ] IF nodes are created for conditional branches
|
||||
- [ ] Switch nodes are created for multiple conditions
|
||||
- [ ] Conditions are properly configured
|
||||
- [ ] True/false branches are correct (index 0/1)
|
||||
- [ ] All branches are connected
|
||||
|
||||
## Connections
|
||||
|
||||
- [ ] All nodes are connected properly
|
||||
- [ ] Trigger connects to first action
|
||||
- [ ] Actions are connected in sequence
|
||||
- [ ] Conditional branches are connected
|
||||
- [ ] Merge points are connected
|
||||
- [ ] All connections reference existing nodes
|
||||
- [ ] No orphaned nodes (except trigger)
|
||||
|
||||
## Error Handling
|
||||
|
||||
- [ ] Error handling strategy is defined
|
||||
- [ ] Critical nodes have retry logic if needed
|
||||
- [ ] continueOnFail is set appropriately
|
||||
- [ ] Error handling matches or improves on source
|
||||
|
||||
## Migration Notes
|
||||
|
||||
- [ ] Source platform is documented
|
||||
- [ ] Migration date is recorded
|
||||
- [ ] Credentials needed are listed
|
||||
- [ ] Platform-specific differences are noted
|
||||
- [ ] Testing considerations are documented
|
||||
|
||||
## Validation
|
||||
|
||||
- [ ] Workflow passes JSON validation
|
||||
- [ ] All required parameters are set
|
||||
- [ ] Workflow structure is logical
|
||||
- [ ] Migration matches source workflow functionality
|
||||
|
||||
## Credentials & Authentication
|
||||
|
||||
- [ ] All services requiring credentials are identified
|
||||
- [ ] Credential types are correct for n8n
|
||||
- [ ] OAuth requirements are noted
|
||||
- [ ] API key requirements are noted
|
||||
- [ ] Authentication differences from source are documented
|
||||
|
||||
## Testing Readiness
|
||||
|
||||
- [ ] Workflow can be imported into n8n
|
||||
- [ ] Test data requirements are clear
|
||||
- [ ] Expected outputs are defined
|
||||
- [ ] Comparison approach with source is defined
|
||||
- [ ] Initial monitoring plan is suggested
|
||||
|
||||
## Documentation
|
||||
|
||||
- [ ] User has import instructions
|
||||
- [ ] Credential setup guidance provided
|
||||
- [ ] Data mapping explanations provided
|
||||
- [ ] Testing approach explained
|
||||
- [ ] Platform differences highlighted
|
||||
- [ ] Post-migration checklist provided
|
||||
|
|
@ -0,0 +1,350 @@
|
|||
# Migrate Workflow to n8n - Workflow Instructions
|
||||
|
||||
```xml
|
||||
<critical>The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml</critical>
|
||||
<critical>You MUST have already loaded and processed: {installed_path}/workflow.yaml</critical>
|
||||
<critical>This workflow migrates automation workflows from other platforms to n8n.</critical>
|
||||
|
||||
<workflow>
|
||||
|
||||
<step n="0" goal="Contextual Analysis (Smart Elicitation)">
|
||||
<critical>Before asking any questions, analyze what the user has already told you</critical>
|
||||
|
||||
<action>Review the user's initial request and conversation history</action>
|
||||
<action>Extract any mentioned: source platform, workflow details, integrations, file paths</action>
|
||||
|
||||
<check if="ALL requirements are clear from context">
|
||||
<action>Summarize your understanding</action>
|
||||
<action>Skip directly to Step 2 (Check Context7 MCP)</action>
|
||||
</check>
|
||||
|
||||
<check if="SOME requirements are clear">
|
||||
<action>Note what you already know</action>
|
||||
<action>Only ask about missing information in Step 1</action>
|
||||
</check>
|
||||
|
||||
<check if="requirements are unclear or minimal">
|
||||
<action>Proceed with full elicitation in Step 1</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="1" goal="Gather Migration Requirements" elicit="true">
|
||||
<action>Ask Question 1: "Which platform are you migrating from?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Zapier - Migrate Zapier Zaps to n8n
|
||||
2. Make (Integromat) - Migrate Make scenarios to n8n
|
||||
3. HubSpot Workflows - Migrate HubSpot workflows to n8n
|
||||
4. Microsoft Power Automate - Migrate Power Automate flows to n8n
|
||||
5. IFTTT - Migrate IFTTT applets to n8n
|
||||
6. Other - Specify another automation platform
|
||||
</action>
|
||||
<action>WAIT for user selection (1-6)</action>
|
||||
<action>Store selection in {{source_platform}}</action>
|
||||
|
||||
<check if="selection is 6 (Other)">
|
||||
<action>Ask: "Please specify the platform you're migrating from"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{source_platform}}</action>
|
||||
</check>
|
||||
|
||||
<action>Ask Question 2: "How will you provide the workflow to migrate?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Describe it - Explain what the workflow does
|
||||
2. Provide export file - Upload/paste workflow export file
|
||||
3. Provide screenshots - Share workflow screenshots
|
||||
4. Provide documentation - Share workflow documentation
|
||||
</action>
|
||||
<action>WAIT for user selection (1-4)</action>
|
||||
|
||||
<check if="selection is 1">
|
||||
<action>Ask: "Please describe what the workflow does (trigger, actions, logic)"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{workflow_description}}</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 2">
|
||||
<action>Ask: "Please provide the workflow export file path or paste the content"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{workflow_file}} or {{workflow_content}}</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 3">
|
||||
<action>Ask: "Please share the workflow screenshots and describe the flow"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{workflow_description}}</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 4">
|
||||
<action>Ask: "Please provide the workflow documentation"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{workflow_description}}</action>
|
||||
</check>
|
||||
|
||||
<action>Ask Question 3: "What is the trigger for this workflow?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Webhook/HTTP Request - Triggered by incoming HTTP requests
|
||||
2. Schedule/Cron - Runs on a schedule
|
||||
3. Form Submission - Triggered by form submissions
|
||||
4. Database Change - Triggered by database events
|
||||
5. Email - Triggered by incoming emails
|
||||
6. Service Event - Triggered by external service (Slack, Google Sheets, etc.)
|
||||
7. Not sure - Will determine from workflow details
|
||||
</action>
|
||||
<action>WAIT for user selection (1-7)</action>
|
||||
<action>Store selection in {{trigger_type}}</action>
|
||||
|
||||
<action>Ask Question 4: "What integrations/services does this workflow use?"</action>
|
||||
<action>Ask: "Please list all services (e.g., Slack, Google Sheets, HubSpot, etc.)"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{integrations_used}}</action>
|
||||
|
||||
<action>Ask Question 5: "How complex is the workflow?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Simple - Linear flow with 3-5 steps
|
||||
2. Medium - Some conditional logic, 6-10 steps
|
||||
3. Complex - Multiple branches, loops, 11-20 steps
|
||||
4. Very Complex - Advanced logic, 20+ steps
|
||||
</action>
|
||||
<action>WAIT for user selection (1-4)</action>
|
||||
<action>Store selection in {{complexity}}</action>
|
||||
|
||||
<action>Ask Question 6: "What should the migrated workflow be named?"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{workflow_name}}</action>
|
||||
|
||||
<action>Ask Question 7: "Where should the n8n workflow file be saved?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Default location - workflows/[workflow-name].json
|
||||
2. Custom path - Specify your own file path
|
||||
3. Project root - Save in main project directory
|
||||
</action>
|
||||
<action>WAIT for user selection (1-3)</action>
|
||||
<check if="selection is 2">
|
||||
<action>Ask for specific path</action>
|
||||
<action>WAIT for user input</action>
|
||||
</check>
|
||||
<action>Store final path in {{save_location}}</action>
|
||||
</step>
|
||||
|
||||
<step n="2" goal="Check Context7 MCP Availability">
|
||||
<action>Check if Context7 MCP server is configured</action>
|
||||
<action>Try to list available MCP tools</action>
|
||||
|
||||
<check if="Context7 MCP is available">
|
||||
<action>Store true in {{context7_available}}</action>
|
||||
<action>Proceed to Step 3</action>
|
||||
</check>
|
||||
|
||||
<check if="Context7 MCP is NOT available">
|
||||
<action>Store false in {{context7_available}}</action>
|
||||
<action>Inform user: "Context7 MCP not configured. Proceeding with built-in n8n knowledge."</action>
|
||||
<action>Proceed to Step 4</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="3" goal="Query Context7 for n8n Documentation">
|
||||
<check if="{{context7_available}} is true">
|
||||
<action>Resolve n8n library ID using Context7</action>
|
||||
<action>Query Context7 for relevant n8n documentation based on:</action>
|
||||
<action>- Integrations used: {{integrations_used}}</action>
|
||||
<action>- Trigger type: {{trigger_type}}</action>
|
||||
<action>- Source platform: {{source_platform}}</action>
|
||||
<action>Store relevant documentation snippets for reference</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="4" goal="Load Platform Mappings">
|
||||
<action>Load {{platform_mappings}} file</action>
|
||||
<action>Extract mappings for {{source_platform}}</action>
|
||||
<action>Identify equivalent n8n nodes for source platform components</action>
|
||||
</step>
|
||||
|
||||
<step n="5" goal="Analyze Source Workflow">
|
||||
<check if="{{workflow_file}} or {{workflow_content}} provided">
|
||||
<action>Parse source workflow file/content</action>
|
||||
<action>Extract workflow structure</action>
|
||||
</check>
|
||||
|
||||
<action>Analyze workflow based on description and details:</action>
|
||||
<action>1. Identify trigger type and configuration</action>
|
||||
<action>2. List all actions/steps in order</action>
|
||||
<action>3. Identify conditional logic (if/then branches)</action>
|
||||
<action>4. Identify loops or iterations</action>
|
||||
<action>5. Identify data transformations</action>
|
||||
<action>6. Identify error handling</action>
|
||||
<action>7. Map integrations to n8n nodes</action>
|
||||
|
||||
<action>Present analysis to user:</action>
|
||||
<action>- Source trigger: [platform-specific trigger]</action>
|
||||
<action>- n8n trigger: [mapped n8n node]</action>
|
||||
<action>- Source actions: [list with platform names]</action>
|
||||
<action>- n8n actions: [list with n8n node types]</action>
|
||||
<action>- Logic: [conditional branches, loops]</action>
|
||||
<action>- Transformations: [data mapping needs]</action>
|
||||
</step>
|
||||
|
||||
<step n="6" goal="Plan n8n Workflow Structure">
|
||||
<action>Load {{helpers}} for node creation guidelines</action>
|
||||
<action>Load {{templates}} for reference</action>
|
||||
|
||||
<action>Design n8n workflow structure:</action>
|
||||
<action>1. Map source trigger to n8n trigger node</action>
|
||||
<action>2. Map each source action to n8n node(s)</action>
|
||||
<action>3. Convert conditional logic to IF/Switch nodes</action>
|
||||
<action>4. Convert loops to Split In Batches nodes</action>
|
||||
<action>5. Add Set/Code nodes for data transformations</action>
|
||||
<action>6. Plan node connections</action>
|
||||
<action>7. Add error handling where needed</action>
|
||||
|
||||
<action>Present migration plan to user:</action>
|
||||
<action>- n8n Trigger: [node type and configuration]</action>
|
||||
<action>- n8n Nodes: [list with descriptions]</action>
|
||||
<action>- Connections: [flow diagram]</action>
|
||||
<action>- Data Mappings: [field mappings]</action>
|
||||
<action>- Credentials Needed: [list of integrations requiring auth]</action>
|
||||
|
||||
<action>Ask: "Does this migration plan look correct?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Yes - Proceed with migration
|
||||
2. No - Adjust the plan
|
||||
3. Add more details - Provide additional information
|
||||
</action>
|
||||
<action>WAIT for user selection (1-3)</action>
|
||||
|
||||
<check if="selection is 2 or 3">
|
||||
<action>Ask: "What changes or additions are needed?"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Adjust plan based on feedback</action>
|
||||
<action>Repeat this step</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="7" goal="Build n8n Workflow">
|
||||
<critical>Follow guidelines from {{helpers}} for proper node creation</critical>
|
||||
|
||||
<action>Initialize workflow structure:</action>
|
||||
<substep>
|
||||
{
|
||||
"name": "{{workflow_name}}",
|
||||
"nodes": [],
|
||||
"connections": {},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"name": "migrated-from-{{source_platform}}"
|
||||
}
|
||||
]
|
||||
}
|
||||
</substep>
|
||||
|
||||
<action>Build nodes ONE at a time:</action>
|
||||
|
||||
<substep>For Each Mapped Node:
|
||||
1. Generate unique node ID
|
||||
2. Set node name (descriptive, unique)
|
||||
3. Set node type from platform mappings
|
||||
4. Set typeVersion (usually 1)
|
||||
5. Calculate position (220px spacing)
|
||||
6. Configure parameters based on source workflow
|
||||
7. Map data fields from source to n8n format
|
||||
8. Add credentials placeholder if needed
|
||||
9. Set error handling if required
|
||||
</substep>
|
||||
|
||||
<substep>For Data Transformations:
|
||||
1. Identify field mappings needed
|
||||
2. Create Set nodes for simple mappings
|
||||
3. Create Code nodes for complex transformations
|
||||
4. Use n8n expressions: ={{ $json.fieldName }}
|
||||
5. Handle data type conversions
|
||||
6. Handle date/time format differences
|
||||
</substep>
|
||||
|
||||
<substep>For Conditional Logic:
|
||||
1. Create IF nodes for if/then branches
|
||||
2. Create Switch nodes for multiple conditions
|
||||
3. Map source conditions to n8n condition format
|
||||
4. Set up true/false branches (index 0/1)
|
||||
</substep>
|
||||
|
||||
<substep>For Connections:
|
||||
1. Connect trigger to first action
|
||||
2. Connect actions in sequence
|
||||
3. Connect conditional branches
|
||||
4. Connect merge points
|
||||
5. Validate all connections
|
||||
</substep>
|
||||
|
||||
<action>Add migration notes as workflow tags</action>
|
||||
<action>Validate all node IDs are unique</action>
|
||||
<action>Validate all connections reference existing nodes</action>
|
||||
</step>
|
||||
|
||||
<step n="8" goal="Add Migration Notes">
|
||||
<action>Add comment nodes or documentation:</action>
|
||||
<action>- Source platform: {{source_platform}}</action>
|
||||
<action>- Migration date: {timestamp}</action>
|
||||
<action>- Credentials to configure: [list]</action>
|
||||
<action>- Testing notes: [important considerations]</action>
|
||||
<action>- Platform-specific differences: [notes]</action>
|
||||
</step>
|
||||
|
||||
<step n="9" goal="Save Migrated Workflow">
|
||||
<action>Save workflow to {{save_location}}</action>
|
||||
</step>
|
||||
|
||||
<step n="10" goal="Validate JSON Syntax">
|
||||
<critical>NEVER delete the file if validation fails - always fix syntax errors</critical>
|
||||
|
||||
<action>Run: node -e "JSON.parse(require('fs').readFileSync('{{save_location}}', 'utf8')); console.log('✓ Valid JSON')"</action>
|
||||
|
||||
<check if="validation fails (exit code 1)">
|
||||
<action>Read the error message carefully - it shows the syntax error and position</action>
|
||||
<action>Open the file and navigate to the error location</action>
|
||||
<action>Fix the syntax error (add missing comma, bracket, or quote as indicated)</action>
|
||||
<action>Save the file</action>
|
||||
<action>Re-run validation with the same command</action>
|
||||
<action>Repeat until validation passes</action>
|
||||
</check>
|
||||
|
||||
<action>Once validation passes, confirm with user: "Workflow migrated successfully to {{save_location}}"</action>
|
||||
</step>
|
||||
|
||||
<step n="11" goal="Provide Migration Guidance">
|
||||
<action>Provide post-migration instructions:</action>
|
||||
<action>1. Import the JSON file into n8n</action>
|
||||
<action>2. Configure credentials for these services: [list]</action>
|
||||
<action>3. Review and update these data mappings: [list]</action>
|
||||
<action>4. Test with sample data before activating</action>
|
||||
<action>5. Compare outputs with original platform</action>
|
||||
<action>6. Monitor initial executions closely</action>
|
||||
|
||||
<action>Highlight platform-specific differences:</action>
|
||||
<action>- Authentication: [differences]</action>
|
||||
<action>- Data formats: [differences]</action>
|
||||
<action>- Scheduling: [differences]</action>
|
||||
<action>- Error handling: [differences]</action>
|
||||
|
||||
<action>Ask: "Would you like help with any specific part of the migration?"</action>
|
||||
<action>Present numbered options:
|
||||
1. No - I'm ready to test
|
||||
2. Yes - Explain credential setup
|
||||
3. Yes - Explain data mappings
|
||||
4. Yes - Explain testing approach
|
||||
</action>
|
||||
<action>WAIT for user selection (1-4)</action>
|
||||
|
||||
<check if="selection is 2, 3, or 4">
|
||||
<action>Provide requested explanation</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="12" goal="Validate Content">
|
||||
<invoke-task>Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml</invoke-task>
|
||||
</step>
|
||||
|
||||
</workflow>
|
||||
```
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
name: migrate-workflow
|
||||
description: "Migrate workflows from other platforms (Zapier, Make, HubSpot, etc.) to n8n"
|
||||
author: "Saif"
|
||||
|
||||
# Workflow components
|
||||
installed_path: "{project-root}/{bmad_folder}/autominator/workflows/migrate-workflow"
|
||||
shared_path: "{project-root}/{bmad_folder}/autominator/workflows/_shared"
|
||||
instructions: "{installed_path}/instructions.md"
|
||||
validation: "{installed_path}/checklist.md"
|
||||
|
||||
# Shared resources
|
||||
helpers: "{shared_path}/n8n-helpers.md"
|
||||
templates: "{shared_path}/n8n-templates.yaml"
|
||||
platform_mappings: "{shared_path}/platform-mappings.yaml"
|
||||
|
||||
# Variables
|
||||
variables:
|
||||
source_platform: "" # Will be elicited
|
||||
workflow_description: "" # Will be elicited
|
||||
workflow_file: "" # Will be elicited (optional)
|
||||
workflow_content: "" # Will be elicited (optional)
|
||||
integrations_used: [] # Will be elicited
|
||||
trigger_type: "" # Will be elicited
|
||||
complexity: "" # Will be elicited
|
||||
save_location: "" # Will be elicited
|
||||
workflow_name: "" # Will be elicited
|
||||
context7_available: false # Will be checked
|
||||
|
||||
default_output_file: "{project-root}/workflows/migrated-workflow-{timestamp}.json"
|
||||
|
||||
standalone: true
|
||||
web_bundle: false
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
# Modify n8n Workflow - Validation Checklist
|
||||
|
||||
## Pre-Modification
|
||||
|
||||
- [ ] Original workflow file was successfully loaded
|
||||
- [ ] Workflow JSON was valid before modifications
|
||||
- [ ] Backup was created before making changes
|
||||
- [ ] User requirements were clearly understood
|
||||
|
||||
## Workflow Structure
|
||||
|
||||
- [ ] Workflow maintains valid JSON structure
|
||||
- [ ] Workflow name is preserved (unless intentionally changed)
|
||||
- [ ] All nodes still have unique IDs
|
||||
- [ ] All nodes still have unique names
|
||||
- [ ] Workflow settings are preserved
|
||||
|
||||
## Node Modifications
|
||||
|
||||
- [ ] Added nodes have unique IDs
|
||||
- [ ] Added nodes have unique names
|
||||
- [ ] Added nodes have valid node types
|
||||
- [ ] Added nodes have required parameters set
|
||||
- [ ] Modified nodes preserve their IDs
|
||||
- [ ] Modified nodes have valid parameter values
|
||||
- [ ] Removed nodes are completely removed from nodes array
|
||||
|
||||
## Connections
|
||||
|
||||
- [ ] All connections reference existing nodes
|
||||
- [ ] Connections to/from added nodes are properly configured
|
||||
- [ ] Connections affected by removed nodes are updated
|
||||
- [ ] No orphaned connections remain
|
||||
- [ ] Connection indices are correct (0 for default, 0/1 for IF nodes)
|
||||
- [ ] No circular dependencies (unless intentional)
|
||||
|
||||
## Node Positioning
|
||||
|
||||
- [ ] New nodes have valid positions
|
||||
- [ ] New nodes don't overlap with existing nodes
|
||||
- [ ] Node positions follow spacing guidelines (220px horizontal)
|
||||
- [ ] Branch nodes have appropriate vertical spacing (±100px)
|
||||
|
||||
## Error Handling
|
||||
|
||||
- [ ] Error handling modifications are applied correctly
|
||||
- [ ] Retry logic is properly configured if added
|
||||
- [ ] continueOnFail settings are appropriate
|
||||
- [ ] maxTries and waitBetweenTries are set if retries enabled
|
||||
|
||||
## Data Flow
|
||||
|
||||
- [ ] Data flow is maintained after modifications
|
||||
- [ ] New transformations are properly configured
|
||||
- [ ] Expressions use correct n8n syntax (={{ }})
|
||||
- [ ] No data flow breaks introduced
|
||||
|
||||
## Integration Changes
|
||||
|
||||
- [ ] New integrations are properly configured
|
||||
- [ ] Credential requirements are identified
|
||||
- [ ] API configurations are correct
|
||||
- [ ] Existing integrations still work
|
||||
|
||||
## Validation
|
||||
|
||||
- [ ] Modified workflow passes JSON validation
|
||||
- [ ] All modifications match user requirements
|
||||
- [ ] No unintended changes were made
|
||||
- [ ] Workflow structure is still logical
|
||||
|
||||
## Backup & Recovery
|
||||
|
||||
- [ ] Backup file was created successfully
|
||||
- [ ] Backup location was communicated to user
|
||||
- [ ] Original workflow can be restored if needed
|
||||
|
||||
## Testing Readiness
|
||||
|
||||
- [ ] Modified workflow can be imported into n8n
|
||||
- [ ] Changes are testable
|
||||
- [ ] Expected behavior is clear
|
||||
- [ ] Any new credentials needed are identified
|
||||
|
||||
## Documentation
|
||||
|
||||
- [ ] Changes made are summarized for user
|
||||
- [ ] User understands what was modified
|
||||
- [ ] Testing recommendations provided if needed
|
||||
- [ ] Backup location shared with user
|
||||
|
|
@ -0,0 +1,327 @@
|
|||
# Modify n8n Workflow - Workflow Instructions
|
||||
|
||||
```xml
|
||||
<critical>The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml</critical>
|
||||
<critical>You MUST have already loaded and processed: {installed_path}/workflow.yaml</critical>
|
||||
<critical>This workflow modifies an existing n8n workflow based on user requirements.</critical>
|
||||
|
||||
<workflow>
|
||||
|
||||
<step n="0" goal="Contextual Analysis (Smart Elicitation)">
|
||||
<critical>Before asking any questions, analyze what the user has already told you</critical>
|
||||
|
||||
<action>Review the user's initial request and conversation history</action>
|
||||
<action>Extract any mentioned: workflow file path, changes needed, specific nodes</action>
|
||||
|
||||
<check if="ALL requirements are clear from context">
|
||||
<action>Summarize your understanding</action>
|
||||
<action>Skip directly to Step 2 (Load Existing Workflow)</action>
|
||||
</check>
|
||||
|
||||
<check if="SOME requirements are clear">
|
||||
<action>Note what you already know</action>
|
||||
<action>Only ask about missing information in Step 1</action>
|
||||
</check>
|
||||
|
||||
<check if="requirements are unclear or minimal">
|
||||
<action>Proceed with full elicitation in Step 1</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="1" goal="Gather Requirements" elicit="true">
|
||||
<action>Ask Question 1: "Which workflow file do you want to modify?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Provide file path - Specify exact path to workflow JSON
|
||||
2. Search in workflows folder - List available workflows
|
||||
3. Paste workflow JSON - Provide workflow content directly
|
||||
</action>
|
||||
<action>WAIT for user selection (1-3)</action>
|
||||
|
||||
<check if="selection is 1">
|
||||
<action>Ask: "Please provide the file path to the workflow JSON"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{workflow_file}}</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 2">
|
||||
<action>List all .json files in workflows/ directory</action>
|
||||
<action>Present as numbered list</action>
|
||||
<action>WAIT for user selection</action>
|
||||
<action>Store selected file path in {{workflow_file}}</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 3">
|
||||
<action>Ask: "Please paste the workflow JSON content"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Create temporary file with content</action>
|
||||
<action>Store temp file path in {{workflow_file}}</action>
|
||||
</check>
|
||||
|
||||
<action>Ask Question 2: "What type of modification do you need?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Add new nodes - Add functionality to existing workflow
|
||||
2. Modify existing nodes - Change node parameters or configuration
|
||||
3. Remove nodes - Delete nodes from workflow
|
||||
4. Change connections - Modify how nodes are connected
|
||||
5. Update error handling - Add or modify retry/error logic
|
||||
6. Optimize workflow - Improve performance or structure
|
||||
7. Multiple changes - Combination of above
|
||||
</action>
|
||||
<action>WAIT for user selection (1-7)</action>
|
||||
<action>Store selection in {{modification_type}}</action>
|
||||
|
||||
<action>Ask Question 3: "Please describe the changes you want to make"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{changes_description}}</action>
|
||||
|
||||
<check if="{{modification_type}} includes adding nodes">
|
||||
<action>Ask: "What nodes do you want to add? (describe functionality)"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{nodes_to_add}}</action>
|
||||
</check>
|
||||
|
||||
<check if="{{modification_type}} includes modifying nodes">
|
||||
<action>Ask: "Which nodes do you want to modify? (provide node names or descriptions)"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{nodes_to_modify}}</action>
|
||||
</check>
|
||||
|
||||
<check if="{{modification_type}} includes removing nodes">
|
||||
<action>Ask: "Which nodes do you want to remove? (provide node names)"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{nodes_to_remove}}</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="2" goal="Load Existing Workflow">
|
||||
<critical>Only load the workflow file when user provides it - never preload</critical>
|
||||
|
||||
<action>Read workflow file from {{workflow_file}}</action>
|
||||
<action>Parse JSON content</action>
|
||||
<action>Validate JSON structure</action>
|
||||
|
||||
<check if="JSON is invalid">
|
||||
<action>Inform user: "The workflow file has invalid JSON syntax"</action>
|
||||
<action>Show error details</action>
|
||||
<action>Ask: "Would you like me to fix the JSON syntax first? (yes/no)"</action>
|
||||
<action>WAIT for user response</action>
|
||||
|
||||
<check if="user says yes">
|
||||
<action>Fix JSON syntax errors</action>
|
||||
<action>Save corrected file</action>
|
||||
<action>Proceed with loading</action>
|
||||
</check>
|
||||
|
||||
<check if="user says no">
|
||||
<action>Exit workflow with error</action>
|
||||
</check>
|
||||
</check>
|
||||
|
||||
<action>Extract workflow structure:</action>
|
||||
<action>- Workflow name</action>
|
||||
<action>- List of nodes (names, types, IDs)</action>
|
||||
<action>- Connections map</action>
|
||||
<action>- Current settings</action>
|
||||
|
||||
<action>Display workflow summary to user:</action>
|
||||
<action>- Name: [workflow name]</action>
|
||||
<action>- Nodes: [count] nodes</action>
|
||||
<action>- Node list: [node names and types]</action>
|
||||
<action>- Connections: [connection count]</action>
|
||||
</step>
|
||||
|
||||
<step n="3" goal="Create Backup">
|
||||
<action>Create backup of original workflow</action>
|
||||
<action>Save backup to: {{workflow_file}}.backup-{timestamp}</action>
|
||||
<action>Store true in {{backup_created}}</action>
|
||||
<action>Inform user: "Backup created at {{workflow_file}}.backup-{timestamp}"</action>
|
||||
</step>
|
||||
|
||||
<step n="4" goal="Check Context7 MCP Availability">
|
||||
<action>Check if Context7 MCP server is configured</action>
|
||||
<action>Try to list available MCP tools</action>
|
||||
|
||||
<check if="Context7 MCP is available">
|
||||
<action>Store true in {{context7_available}}</action>
|
||||
<action>Proceed to Step 5</action>
|
||||
</check>
|
||||
|
||||
<check if="Context7 MCP is NOT available">
|
||||
<action>Store false in {{context7_available}}</action>
|
||||
<action>Inform user: "Context7 MCP not configured. Proceeding with built-in knowledge."</action>
|
||||
<action>Proceed to Step 6</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="5" goal="Query Context7 for n8n Documentation">
|
||||
<check if="{{context7_available}} is true">
|
||||
<action>Resolve n8n library ID using Context7</action>
|
||||
<action>Query Context7 for relevant n8n documentation based on:</action>
|
||||
<action>- Modification type: {{modification_type}}</action>
|
||||
<action>- Nodes to add: {{nodes_to_add}}</action>
|
||||
<action>- Changes description: {{changes_description}}</action>
|
||||
<action>Store relevant documentation snippets for reference</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="6" goal="Plan Modifications">
|
||||
<action>Load {{helpers}} for node creation guidelines</action>
|
||||
<action>Analyze current workflow structure</action>
|
||||
<action>Plan modifications based on requirements:</action>
|
||||
|
||||
<check if="adding nodes">
|
||||
<action>1. Identify where new nodes should be inserted</action>
|
||||
<action>2. Determine node types needed</action>
|
||||
<action>3. Plan connections to/from new nodes</action>
|
||||
<action>4. Calculate positions for new nodes</action>
|
||||
</check>
|
||||
|
||||
<check if="modifying nodes">
|
||||
<action>1. Identify nodes to modify by name or ID</action>
|
||||
<action>2. Determine what parameters to change</action>
|
||||
<action>3. Validate new parameter values</action>
|
||||
</check>
|
||||
|
||||
<check if="removing nodes">
|
||||
<action>1. Identify nodes to remove by name or ID</action>
|
||||
<action>2. Identify connections that will be affected</action>
|
||||
<action>3. Plan how to reconnect remaining nodes</action>
|
||||
</check>
|
||||
|
||||
<check if="changing connections">
|
||||
<action>1. Identify connections to modify</action>
|
||||
<action>2. Validate new connection targets exist</action>
|
||||
<action>3. Update connection indices if needed</action>
|
||||
</check>
|
||||
|
||||
<action>Present modification plan to user:</action>
|
||||
<action>- Changes to be made: [detailed list]</action>
|
||||
<action>- Nodes affected: [list]</action>
|
||||
<action>- New connections: [list]</action>
|
||||
<action>- Removed connections: [list]</action>
|
||||
|
||||
<action>Ask: "Does this modification plan look correct?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Yes - Proceed with modifications
|
||||
2. No - Adjust the plan
|
||||
3. Add more changes - Include additional modifications
|
||||
</action>
|
||||
<action>WAIT for user selection (1-3)</action>
|
||||
|
||||
<check if="selection is 2 or 3">
|
||||
<action>Ask: "What changes or additions are needed?"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Adjust plan based on feedback</action>
|
||||
<action>Repeat this step</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="7" goal="Apply Modifications">
|
||||
<critical>Follow guidelines from {{helpers}} for proper node creation</critical>
|
||||
|
||||
<action>Load current workflow JSON into memory</action>
|
||||
|
||||
<substep>If Adding Nodes:
|
||||
1. Generate unique node IDs (check against existing IDs)
|
||||
2. Create node objects with proper structure
|
||||
3. Calculate positions (avoid overlaps with existing nodes)
|
||||
4. Add nodes to workflow.nodes array
|
||||
5. Create connections to/from new nodes
|
||||
6. Update connections object
|
||||
</substep>
|
||||
|
||||
<substep>If Modifying Nodes:
|
||||
1. Find nodes by name or ID
|
||||
2. Update parameters as specified
|
||||
3. Preserve node ID and other unchanged properties
|
||||
4. Validate new parameter values
|
||||
5. Update node in workflow.nodes array
|
||||
</substep>
|
||||
|
||||
<substep>If Removing Nodes:
|
||||
1. Find nodes by name or ID
|
||||
2. Remove from workflow.nodes array
|
||||
3. Remove all connections to/from removed nodes
|
||||
4. Update connections object
|
||||
5. Reconnect remaining nodes if needed
|
||||
</substep>
|
||||
|
||||
<substep>If Changing Connections:
|
||||
1. Update connections object
|
||||
2. Validate all referenced nodes exist
|
||||
3. Ensure connection indices are correct
|
||||
4. Remove orphaned connections
|
||||
</substep>
|
||||
|
||||
<substep>If Updating Error Handling:
|
||||
1. Find affected nodes
|
||||
2. Add or update error handling properties:
|
||||
- continueOnFail
|
||||
- retryOnFail
|
||||
- maxTries
|
||||
- waitBetweenTries
|
||||
3. Validate error handling configuration
|
||||
</substep>
|
||||
|
||||
<action>Validate modified workflow:</action>
|
||||
<action>- All node IDs are unique</action>
|
||||
<action>- All node names are unique</action>
|
||||
<action>- All connections reference existing nodes</action>
|
||||
<action>- No orphaned nodes (except trigger)</action>
|
||||
<action>- Node positions don't overlap</action>
|
||||
</step>
|
||||
|
||||
<step n="8" goal="Save Modified Workflow">
|
||||
<action>Save modified workflow to {{workflow_file}}</action>
|
||||
<action>Preserve original file location</action>
|
||||
</step>
|
||||
|
||||
<step n="9" goal="Validate JSON Syntax">
|
||||
<critical>NEVER delete the file if validation fails - always fix syntax errors</critical>
|
||||
|
||||
<action>Run: node -e "JSON.parse(require('fs').readFileSync('{{workflow_file}}', 'utf8')); console.log('✓ Valid JSON')"</action>
|
||||
|
||||
<check if="validation fails (exit code 1)">
|
||||
<action>Read the error message carefully - it shows the syntax error and position</action>
|
||||
<action>Open the file and navigate to the error location</action>
|
||||
<action>Fix the syntax error (add missing comma, bracket, or quote as indicated)</action>
|
||||
<action>Save the file</action>
|
||||
<action>Re-run validation with the same command</action>
|
||||
<action>Repeat until validation passes</action>
|
||||
</check>
|
||||
|
||||
<action>Once validation passes, confirm with user: "Workflow modified successfully at {{workflow_file}}"</action>
|
||||
</step>
|
||||
|
||||
<step n="10" goal="Summarize Changes">
|
||||
<action>Provide summary of changes made:</action>
|
||||
<action>- Nodes added: [count and names]</action>
|
||||
<action>- Nodes modified: [count and names]</action>
|
||||
<action>- Nodes removed: [count and names]</action>
|
||||
<action>- Connections changed: [count]</action>
|
||||
<action>- Backup location: {{workflow_file}}.backup-{timestamp}</action>
|
||||
|
||||
<action>Ask: "Would you like to make additional changes?"</action>
|
||||
<action>Present numbered options:
|
||||
1. No - I'm done
|
||||
2. Yes - Make more modifications
|
||||
3. Revert - Restore from backup
|
||||
</action>
|
||||
<action>WAIT for user selection (1-3)</action>
|
||||
|
||||
<check if="selection is 2">
|
||||
<action>Return to Step 1 with current workflow</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 3">
|
||||
<action>Restore workflow from backup</action>
|
||||
<action>Confirm restoration to user</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="11" goal="Validate Content">
|
||||
<invoke-task>Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml</invoke-task>
|
||||
</step>
|
||||
|
||||
</workflow>
|
||||
```
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
name: modify-workflow
|
||||
description: "Edit or update existing n8n workflow"
|
||||
author: "Saif"
|
||||
|
||||
# Workflow components
|
||||
installed_path: "{project-root}/{bmad_folder}/autominator/workflows/modify-workflow"
|
||||
shared_path: "{project-root}/{bmad_folder}/autominator/workflows/_shared"
|
||||
instructions: "{installed_path}/instructions.md"
|
||||
validation: "{installed_path}/checklist.md"
|
||||
|
||||
# Shared resources
|
||||
helpers: "{shared_path}/n8n-helpers.md"
|
||||
templates: "{shared_path}/n8n-templates.yaml"
|
||||
platform_mappings: "{shared_path}/platform-mappings.yaml"
|
||||
|
||||
# Variables
|
||||
variables:
|
||||
workflow_file: "" # Will be elicited
|
||||
modification_type: "" # Will be elicited
|
||||
changes_description: "" # Will be elicited
|
||||
nodes_to_add: [] # Will be elicited
|
||||
nodes_to_modify: [] # Will be elicited
|
||||
nodes_to_remove: [] # Will be elicited
|
||||
backup_created: false # Will be set
|
||||
context7_available: false # Will be checked
|
||||
|
||||
default_output_file: "" # Will use existing file location
|
||||
|
||||
standalone: true
|
||||
web_bundle: false
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
# Optimize n8n Workflow - Validation Checklist
|
||||
|
||||
## Pre-Optimization
|
||||
|
||||
- [ ] Original workflow was successfully loaded
|
||||
- [ ] Workflow JSON was valid before optimization
|
||||
- [ ] Optimization focus areas were identified
|
||||
- [ ] Backup was created before making changes
|
||||
- [ ] User requirements were clearly understood
|
||||
|
||||
## Analysis Completeness
|
||||
|
||||
- [ ] Performance analysis was conducted
|
||||
- [ ] Error handling was reviewed
|
||||
- [ ] Code quality was assessed
|
||||
- [ ] Structure was evaluated
|
||||
- [ ] Best practices were checked
|
||||
- [ ] Security was reviewed
|
||||
- [ ] All issues were documented
|
||||
|
||||
## Recommendations Quality
|
||||
|
||||
- [ ] Recommendations are specific and actionable
|
||||
- [ ] Recommendations are prioritized correctly
|
||||
- [ ] Impact of each recommendation is clear
|
||||
- [ ] Implementation steps are provided
|
||||
- [ ] Expected improvements are quantified
|
||||
- [ ] No breaking changes are recommended
|
||||
|
||||
## Performance Optimizations
|
||||
|
||||
- [ ] Unnecessary nodes were identified/removed
|
||||
- [ ] Data transformations were optimized
|
||||
- [ ] Batch processing opportunities were identified
|
||||
- [ ] Redundant API calls were consolidated
|
||||
- [ ] Parallel execution opportunities were identified
|
||||
- [ ] Node execution order was optimized
|
||||
|
||||
## Error Handling Improvements
|
||||
|
||||
- [ ] Critical nodes have retry logic
|
||||
- [ ] continueOnFail is set appropriately
|
||||
- [ ] Error workflows are configured where needed
|
||||
- [ ] Timeout configurations are appropriate
|
||||
- [ ] Error notifications are set up
|
||||
- [ ] Error handling doesn't mask real issues
|
||||
|
||||
## Code Quality Improvements
|
||||
|
||||
- [ ] Set nodes are properly configured
|
||||
- [ ] Code nodes are optimized
|
||||
- [ ] Expressions use correct syntax
|
||||
- [ ] Data types are handled correctly
|
||||
- [ ] Hardcoded values are replaced with variables
|
||||
- [ ] Node names are descriptive and consistent
|
||||
|
||||
## Structure Improvements
|
||||
|
||||
- [ ] Node positions are logical and organized
|
||||
- [ ] Complex branches are simplified where possible
|
||||
- [ ] Duplicate logic is eliminated
|
||||
- [ ] Merge points are optimized
|
||||
- [ ] Connection patterns are clean
|
||||
- [ ] Workflow flow is easy to follow
|
||||
|
||||
## Best Practices Applied
|
||||
|
||||
- [ ] Credentials are used correctly
|
||||
- [ ] Security issues are addressed
|
||||
- [ ] Node types are appropriate
|
||||
- [ ] Node versions are up to date
|
||||
- [ ] Data handling follows best practices
|
||||
- [ ] Workflow settings are optimal
|
||||
|
||||
## Security Improvements
|
||||
|
||||
- [ ] No credentials are exposed
|
||||
- [ ] Sensitive data is handled properly
|
||||
- [ ] No hardcoded secrets remain
|
||||
- [ ] Authentication is properly configured
|
||||
- [ ] Data is sanitized where needed
|
||||
- [ ] Security best practices are followed
|
||||
|
||||
## Workflow Integrity
|
||||
|
||||
- [ ] All node IDs remain unique
|
||||
- [ ] All node names remain unique
|
||||
- [ ] All connections are valid
|
||||
- [ ] No functionality is lost
|
||||
- [ ] Workflow still achieves original purpose
|
||||
- [ ] No breaking changes introduced
|
||||
|
||||
## Validation
|
||||
|
||||
- [ ] Optimized workflow passes JSON validation
|
||||
- [ ] All optimizations were applied correctly
|
||||
- [ ] No unintended changes were made
|
||||
- [ ] Workflow structure is still logical
|
||||
- [ ] All improvements are documented
|
||||
|
||||
## Backup & Recovery
|
||||
|
||||
- [ ] Backup file was created successfully
|
||||
- [ ] Backup location was communicated to user
|
||||
- [ ] Original workflow can be restored if needed
|
||||
|
||||
## Testing Readiness
|
||||
|
||||
- [ ] Optimized workflow can be imported into n8n
|
||||
- [ ] Test scenarios are identified
|
||||
- [ ] Expected improvements are measurable
|
||||
- [ ] Comparison approach is defined
|
||||
- [ ] Monitoring plan is suggested
|
||||
|
||||
## Documentation
|
||||
|
||||
- [ ] Analysis report is comprehensive
|
||||
- [ ] All findings are documented
|
||||
- [ ] Recommendations are clearly explained
|
||||
- [ ] Expected improvements are quantified
|
||||
- [ ] Testing recommendations are provided
|
||||
- [ ] User understands all changes made
|
||||
|
||||
## Expected Improvements
|
||||
|
||||
- [ ] Performance improvements are quantified
|
||||
- [ ] Reliability improvements are identified
|
||||
- [ ] Maintainability improvements are clear
|
||||
- [ ] Security improvements are documented
|
||||
- [ ] Cost savings are estimated (if applicable)
|
||||
|
|
@ -0,0 +1,446 @@
|
|||
# Optimize n8n Workflow - Workflow Instructions
|
||||
|
||||
```xml
|
||||
<critical>The workflow execution engine is governed by: {project_root}/{bmad_folder}/core/tasks/workflow.xml</critical>
|
||||
<critical>You MUST have already loaded and processed: {installed_path}/workflow.yaml</critical>
|
||||
<critical>This workflow analyzes and optimizes existing n8n workflows for performance and best practices.</critical>
|
||||
|
||||
<workflow>
|
||||
|
||||
<step n="0" goal="Contextual Analysis (Smart Elicitation)">
|
||||
<critical>Before asking any questions, analyze what the user has already told you</critical>
|
||||
|
||||
<action>Review the user's initial request and conversation history</action>
|
||||
<action>Extract any mentioned: workflow file path, performance issues, optimization goals</action>
|
||||
|
||||
<check if="ALL requirements are clear from context">
|
||||
<action>Summarize your understanding</action>
|
||||
<action>Skip directly to Step 2 (Load Workflow)</action>
|
||||
</check>
|
||||
|
||||
<check if="SOME requirements are clear">
|
||||
<action>Note what you already know</action>
|
||||
<action>Only ask about missing information in Step 1</action>
|
||||
</check>
|
||||
|
||||
<check if="requirements are unclear or minimal">
|
||||
<action>Proceed with full elicitation in Step 1</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="1" goal="Gather Optimization Requirements" elicit="true">
|
||||
<action>Ask Question 1: "Which workflow do you want to optimize?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Provide file path - Specify exact path to workflow JSON
|
||||
2. Search in workflows folder - List available workflows
|
||||
3. Paste workflow JSON - Provide workflow content directly
|
||||
</action>
|
||||
<action>WAIT for user selection (1-3)</action>
|
||||
|
||||
<check if="selection is 1">
|
||||
<action>Ask: "Please provide the file path to the workflow JSON"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{workflow_file}}</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 2">
|
||||
<action>List all .json files in workflows/ directory</action>
|
||||
<action>Present as numbered list</action>
|
||||
<action>WAIT for user selection</action>
|
||||
<action>Store selected file path in {{workflow_file}}</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 3">
|
||||
<action>Ask: "Please paste the workflow JSON content"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Create temporary file with content</action>
|
||||
<action>Store temp file path in {{workflow_file}}</action>
|
||||
</check>
|
||||
|
||||
<action>Ask Question 2: "What aspects do you want to optimize?"</action>
|
||||
<action>Present numbered options (can select multiple):
|
||||
1. Performance - Improve execution speed and efficiency
|
||||
2. Error Handling - Add or improve error handling and retries
|
||||
3. Code Quality - Improve node configuration and data transformations
|
||||
4. Structure - Improve workflow organization and readability
|
||||
5. Best Practices - Apply n8n best practices and patterns
|
||||
6. Security - Improve credential handling and data security
|
||||
7. All - Comprehensive optimization review
|
||||
</action>
|
||||
<action>WAIT for user selection (1-7 or multiple)</action>
|
||||
<action>Store selections in {{optimization_focus}}</action>
|
||||
|
||||
<action>Ask Question 3: "Are there specific issues or pain points?"</action>
|
||||
<action>Present numbered options:
|
||||
1. No - Just general optimization
|
||||
2. Yes - Describe specific issues
|
||||
</action>
|
||||
<action>WAIT for user selection (1-2)</action>
|
||||
|
||||
<check if="selection is 2">
|
||||
<action>Ask: "Please describe the issues (slow execution, errors, etc.)"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{specific_issues}}</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="2" goal="Load Workflow">
|
||||
<critical>Only load the workflow file when user provides it - never preload</critical>
|
||||
|
||||
<action>Read workflow file from {{workflow_file}}</action>
|
||||
<action>Parse JSON content</action>
|
||||
<action>Validate JSON structure</action>
|
||||
|
||||
<check if="JSON is invalid">
|
||||
<action>Inform user: "The workflow file has invalid JSON syntax"</action>
|
||||
<action>Show error details</action>
|
||||
<action>Ask: "Would you like me to fix the JSON syntax first? (yes/no)"</action>
|
||||
<action>WAIT for user response</action>
|
||||
|
||||
<check if="user says yes">
|
||||
<action>Fix JSON syntax errors</action>
|
||||
<action>Save corrected file</action>
|
||||
<action>Proceed with loading</action>
|
||||
</check>
|
||||
|
||||
<check if="user says no">
|
||||
<action>Exit workflow with error</action>
|
||||
</check>
|
||||
</check>
|
||||
|
||||
<action>Extract workflow structure:</action>
|
||||
<action>- Workflow name and settings</action>
|
||||
<action>- Node count and types</action>
|
||||
<action>- Connection patterns</action>
|
||||
<action>- Error handling configuration</action>
|
||||
<action>- Credential usage</action>
|
||||
|
||||
<action>Display workflow summary to user:</action>
|
||||
<action>- Name: [workflow name]</action>
|
||||
<action>- Nodes: [count] nodes</action>
|
||||
<action>- Complexity: [simple/medium/complex]</action>
|
||||
<action>- Integrations: [list of services]</action>
|
||||
</step>
|
||||
|
||||
<step n="3" goal="Check Context7 MCP Availability">
|
||||
<action>Check if Context7 MCP server is configured</action>
|
||||
<action>Try to list available MCP tools</action>
|
||||
|
||||
<check if="Context7 MCP is available">
|
||||
<action>Store true in {{context7_available}}</action>
|
||||
<action>Proceed to Step 4</action>
|
||||
</check>
|
||||
|
||||
<check if="Context7 MCP is NOT available">
|
||||
<action>Store false in {{context7_available}}</action>
|
||||
<action>Inform user: "Context7 MCP not configured. Using built-in n8n best practices."</action>
|
||||
<action>Proceed to Step 5</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="4" goal="Query Context7 for n8n Best Practices">
|
||||
<check if="{{context7_available}} is true">
|
||||
<action>Resolve n8n library ID using Context7</action>
|
||||
<action>Query Context7 for n8n best practices documentation</action>
|
||||
<action>Query for optimization techniques</action>
|
||||
<action>Query for performance tips</action>
|
||||
<action>Store relevant documentation for reference</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="5" goal="Analyze Workflow">
|
||||
<action>Load {{helpers}} for best practices reference</action>
|
||||
|
||||
<action>Perform comprehensive analysis based on {{optimization_focus}}:</action>
|
||||
|
||||
<substep>Performance Analysis:
|
||||
- Check for unnecessary nodes
|
||||
- Identify inefficient data transformations
|
||||
- Look for missing batch processing opportunities
|
||||
- Check for redundant API calls
|
||||
- Analyze node execution order
|
||||
- Identify parallel execution opportunities
|
||||
</substep>
|
||||
|
||||
<substep>Error Handling Analysis:
|
||||
- Check if critical nodes have retry logic
|
||||
- Verify continueOnFail settings
|
||||
- Look for missing error workflows
|
||||
- Check timeout configurations
|
||||
- Verify error notification setup
|
||||
</substep>
|
||||
|
||||
<substep>Code Quality Analysis:
|
||||
- Review Set node configurations
|
||||
- Review Code node implementations
|
||||
- Check expression syntax and efficiency
|
||||
- Verify data type handling
|
||||
- Check for hardcoded values
|
||||
- Review node naming conventions
|
||||
</substep>
|
||||
|
||||
<substep>Structure Analysis:
|
||||
- Check node positioning and layout
|
||||
- Verify logical flow organization
|
||||
- Look for overly complex branches
|
||||
- Check for duplicate logic
|
||||
- Verify proper use of merge nodes
|
||||
- Check connection patterns
|
||||
</substep>
|
||||
|
||||
<substep>Best Practices Analysis:
|
||||
- Verify proper credential usage
|
||||
- Check for security issues
|
||||
- Verify proper use of node types
|
||||
- Check for deprecated node versions
|
||||
- Verify proper data handling
|
||||
- Check workflow settings
|
||||
</substep>
|
||||
|
||||
<substep>Security Analysis:
|
||||
- Check credential exposure
|
||||
- Verify sensitive data handling
|
||||
- Check for hardcoded secrets
|
||||
- Verify proper authentication
|
||||
- Check data sanitization
|
||||
</substep>
|
||||
|
||||
<action>Store all findings in {{issues_found}}</action>
|
||||
</step>
|
||||
|
||||
<step n="6" goal="Generate Recommendations">
|
||||
<action>For each issue found, generate specific recommendations:</action>
|
||||
|
||||
<action>Categorize recommendations by priority:</action>
|
||||
<action>- Critical: Security issues, major performance problems</action>
|
||||
<action>- High: Error handling gaps, significant inefficiencies</action>
|
||||
<action>- Medium: Code quality improvements, minor optimizations</action>
|
||||
<action>- Low: Cosmetic improvements, nice-to-haves</action>
|
||||
|
||||
<action>For each recommendation, provide:</action>
|
||||
<action>1. Issue description</action>
|
||||
<action>2. Impact explanation</action>
|
||||
<action>3. Specific solution</action>
|
||||
<action>4. Implementation steps</action>
|
||||
<action>5. Expected improvement</action>
|
||||
|
||||
<action>Store recommendations in {{recommendations}}</action>
|
||||
</step>
|
||||
|
||||
<step n="7" goal="Present Analysis Report" elicit="true">
|
||||
<action>Present comprehensive optimization report:</action>
|
||||
|
||||
<action>## Workflow Analysis Report</action>
|
||||
<action>Workflow: {{workflow_name}}</action>
|
||||
<action>Analysis Date: {timestamp}</action>
|
||||
<action>Optimization Focus: {{optimization_focus}}</action>
|
||||
|
||||
<action>### Summary</action>
|
||||
<action>- Total Issues Found: [count]</action>
|
||||
<action>- Critical: [count]</action>
|
||||
<action>- High Priority: [count]</action>
|
||||
<action>- Medium Priority: [count]</action>
|
||||
<action>- Low Priority: [count]</action>
|
||||
|
||||
<action>### Detailed Findings</action>
|
||||
<action>Present each issue with:</action>
|
||||
<action>- Priority level</action>
|
||||
<action>- Issue description</action>
|
||||
<action>- Current state</action>
|
||||
<action>- Recommended solution</action>
|
||||
<action>- Expected impact</action>
|
||||
|
||||
<action>### Performance Opportunities</action>
|
||||
<action>List specific performance improvements with estimated impact</action>
|
||||
|
||||
<action>### Best Practice Violations</action>
|
||||
<action>List n8n best practices not being followed</action>
|
||||
|
||||
<action>Ask: "Would you like me to apply these optimizations?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Yes - Apply all recommendations
|
||||
2. Yes - Apply only critical and high priority
|
||||
3. Yes - Let me choose which to apply
|
||||
4. No - Just provide the report
|
||||
5. Explain more - I need more details first
|
||||
</action>
|
||||
<action>WAIT for user selection (1-5)</action>
|
||||
|
||||
<check if="selection is 5">
|
||||
<action>Ask: "Which recommendations would you like explained?"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Provide detailed explanation</action>
|
||||
<action>Repeat this step</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 3">
|
||||
<action>Present recommendations as numbered list</action>
|
||||
<action>Ask: "Select recommendations to apply (comma-separated numbers)"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store selected recommendations</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 1, 2, or 3">
|
||||
<action>Store true in {{apply_changes}}</action>
|
||||
<action>Proceed to Step 8</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 4">
|
||||
<action>Store false in {{apply_changes}}</action>
|
||||
<action>Skip to Step 11 (provide report only)</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="8" goal="Create Backup">
|
||||
<check if="{{apply_changes}} is true">
|
||||
<action>Create backup of original workflow</action>
|
||||
<action>Save backup to: {{workflow_file}}.backup-{timestamp}</action>
|
||||
<action>Store true in {{backup_created}}</action>
|
||||
<action>Inform user: "Backup created at {{workflow_file}}.backup-{timestamp}"</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="9" goal="Apply Optimizations">
|
||||
<critical>Follow guidelines from {{helpers}} for proper node configuration</critical>
|
||||
|
||||
<action>Load current workflow JSON into memory</action>
|
||||
|
||||
<action>Apply each selected recommendation:</action>
|
||||
|
||||
<substep>Performance Optimizations:
|
||||
- Remove unnecessary nodes
|
||||
- Optimize data transformations
|
||||
- Add batch processing where applicable
|
||||
- Consolidate redundant API calls
|
||||
- Optimize node execution order
|
||||
- Add parallel execution where possible
|
||||
</substep>
|
||||
|
||||
<substep>Error Handling Improvements:
|
||||
- Add retry logic to critical nodes
|
||||
- Set appropriate continueOnFail values
|
||||
- Add error workflows if needed
|
||||
- Configure timeouts
|
||||
- Add error notifications
|
||||
</substep>
|
||||
|
||||
<substep>Code Quality Improvements:
|
||||
- Refactor Set node configurations
|
||||
- Optimize Code node implementations
|
||||
- Improve expression syntax
|
||||
- Fix data type handling
|
||||
- Replace hardcoded values with variables
|
||||
- Improve node naming
|
||||
</substep>
|
||||
|
||||
<substep>Structure Improvements:
|
||||
- Reorganize node positions
|
||||
- Simplify complex branches
|
||||
- Remove duplicate logic
|
||||
- Optimize merge points
|
||||
- Improve connection patterns
|
||||
</substep>
|
||||
|
||||
<substep>Best Practice Applications:
|
||||
- Fix credential usage
|
||||
- Address security issues
|
||||
- Update deprecated nodes
|
||||
- Improve data handling
|
||||
- Update workflow settings
|
||||
</substep>
|
||||
|
||||
<action>Validate optimized workflow:</action>
|
||||
<action>- All node IDs remain unique</action>
|
||||
<action>- All connections are valid</action>
|
||||
<action>- No functionality is lost</action>
|
||||
<action>- All improvements are applied</action>
|
||||
</step>
|
||||
|
||||
<step n="10" goal="Save Optimized Workflow">
|
||||
<action>Save optimized workflow to {{workflow_file}}</action>
|
||||
</step>
|
||||
|
||||
<step n="11" goal="Validate JSON Syntax">
|
||||
<check if="{{apply_changes}} is true">
|
||||
<critical>NEVER delete the file if validation fails - always fix syntax errors</critical>
|
||||
|
||||
<action>Run: node -e "JSON.parse(require('fs').readFileSync('{{workflow_file}}', 'utf8')); console.log('✓ Valid JSON')"</action>
|
||||
|
||||
<check if="validation fails (exit code 1)">
|
||||
<action>Read the error message carefully - it shows the syntax error and position</action>
|
||||
<action>Open the file and navigate to the error location</action>
|
||||
<action>Fix the syntax error (add missing comma, bracket, or quote as indicated)</action>
|
||||
<action>Save the file</action>
|
||||
<action>Re-run validation with the same command</action>
|
||||
<action>Repeat until validation passes</action>
|
||||
</check>
|
||||
|
||||
<action>Once validation passes, confirm with user: "Workflow optimized successfully at {{workflow_file}}"</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="12" goal="Provide Optimization Summary">
|
||||
<action>Provide comprehensive summary:</action>
|
||||
|
||||
<check if="{{apply_changes}} is true">
|
||||
<action>### Optimizations Applied</action>
|
||||
<action>- Total changes: [count]</action>
|
||||
<action>- Performance improvements: [list]</action>
|
||||
<action>- Error handling added: [list]</action>
|
||||
<action>- Code quality fixes: [list]</action>
|
||||
<action>- Structure improvements: [list]</action>
|
||||
<action>- Best practices applied: [list]</action>
|
||||
<action>- Backup location: {{workflow_file}}.backup-{timestamp}</action>
|
||||
|
||||
<action>### Expected Improvements</action>
|
||||
<action>- Execution speed: [estimated improvement]</action>
|
||||
<action>- Reliability: [improvements]</action>
|
||||
<action>- Maintainability: [improvements]</action>
|
||||
<action>- Security: [improvements]</action>
|
||||
|
||||
<action>### Testing Recommendations</action>
|
||||
<action>1. Import optimized workflow into n8n</action>
|
||||
<action>2. Test with sample data</action>
|
||||
<action>3. Compare execution times with original</action>
|
||||
<action>4. Verify all functionality works correctly</action>
|
||||
<action>5. Monitor error rates</action>
|
||||
</check>
|
||||
|
||||
<check if="{{apply_changes}} is false">
|
||||
<action>### Optimization Report</action>
|
||||
<action>Report saved with all recommendations</action>
|
||||
<action>No changes applied to workflow</action>
|
||||
<action>Review recommendations and apply manually if desired</action>
|
||||
</check>
|
||||
|
||||
<action>Ask: "Would you like additional help?"</action>
|
||||
<action>Present numbered options:
|
||||
1. No - I'm done
|
||||
2. Yes - Explain specific optimizations
|
||||
3. Yes - Optimize another workflow
|
||||
4. Revert - Restore from backup
|
||||
</action>
|
||||
<action>WAIT for user selection (1-4)</action>
|
||||
|
||||
<check if="selection is 2">
|
||||
<action>Ask: "Which optimization would you like explained?"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Provide detailed explanation</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 3">
|
||||
<action>Return to Step 1 for new workflow</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 4">
|
||||
<action>Restore workflow from backup</action>
|
||||
<action>Confirm restoration to user</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="13" goal="Validate Content">
|
||||
<invoke-task>Validate against checklist at {{validation}} using {{bmad_folder}}/core/tasks/validate-workflow.xml</invoke-task>
|
||||
</step>
|
||||
|
||||
</workflow>
|
||||
```
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
name: optimize-workflow
|
||||
description: "Review and improve existing n8n workflows for performance and best practices"
|
||||
author: "Saif"
|
||||
|
||||
# Workflow components
|
||||
installed_path: "{project-root}/{bmad_folder}/autominator/workflows/optimize-workflow"
|
||||
shared_path: "{project-root}/{bmad_folder}/autominator/workflows/_shared"
|
||||
instructions: "{installed_path}/instructions.md"
|
||||
validation: "{installed_path}/checklist.md"
|
||||
|
||||
# Shared resources
|
||||
helpers: "{shared_path}/n8n-helpers.md"
|
||||
templates: "{shared_path}/n8n-templates.yaml"
|
||||
platform_mappings: "{shared_path}/platform-mappings.yaml"
|
||||
|
||||
# Variables
|
||||
variables:
|
||||
workflow_file: "" # Will be elicited
|
||||
optimization_focus: [] # Will be elicited
|
||||
issues_found: [] # Will be identified
|
||||
recommendations: [] # Will be generated
|
||||
apply_changes: false # Will be elicited
|
||||
backup_created: false # Will be set
|
||||
context7_available: false # Will be checked
|
||||
|
||||
default_output_file: "" # Will use existing file location
|
||||
|
||||
standalone: true
|
||||
web_bundle: false
|
||||
Loading…
Reference in New Issue