Compare commits
19 Commits
f82cdef6cf
...
7dc3223738
| Author | SHA1 | Date |
|---|---|---|
|
|
7dc3223738 | |
|
|
c6e53dbbc7 | |
|
|
93db60b8f6 | |
|
|
f344e5cdc2 | |
|
|
8a91c6fffe | |
|
|
36ce3c42d2 | |
|
|
82b4f1dcb4 | |
|
|
6d1da5fc72 | |
|
|
ffe6f6c26b | |
|
|
3fa0865542 | |
|
|
ebc5acd2aa | |
|
|
b7239c1ec3 | |
|
|
0edda967a5 | |
|
|
5077941621 | |
|
|
74240cf842 | |
|
|
83c0a59887 | |
|
|
02d07ed254 | |
|
|
9edc699a8f | |
|
|
28c5b581e9 |
|
|
@ -0,0 +1,335 @@
|
|||
# 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 web search to access up-to-date n8n documentation
|
||||
- Smart elicitation for accurate requirement gathering
|
||||
- Comprehensive workflow validation and testing
|
||||
|
||||
## Workflows
|
||||
|
||||
### 1. Gather Requirements
|
||||
|
||||
Gather and document workflow requirements before creating n8n workflows.
|
||||
|
||||
**Triggers:**
|
||||
|
||||
- `*gather-requirements`
|
||||
|
||||
**Features:**
|
||||
|
||||
- Interactive requirement gathering
|
||||
- Documents problem statement, triggers, integrations
|
||||
- Creates requirement file for workflow creation
|
||||
- Saves to `docs/workflow-requirements/`
|
||||
- Required before creating workflows
|
||||
|
||||
### 2. Create Workflow
|
||||
|
||||
Build new n8n workflows from scratch based on 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
|
||||
- Web search integration for latest n8n docs
|
||||
- Automatic JSON validation
|
||||
|
||||
### 3. 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
|
||||
|
||||
### 4. 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
|
||||
|
||||
### 5. 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
|
||||
```
|
||||
|
||||
### Gather Requirements (Recommended First Step)
|
||||
|
||||
```bash
|
||||
# Start the requirements gathering process
|
||||
*gather-requirements
|
||||
|
||||
# Follow the interactive prompts to:
|
||||
# 1. Describe the problem you're solving
|
||||
# 2. Define trigger type
|
||||
# 3. Specify data requirements
|
||||
# 4. Define desired outcome
|
||||
# 5. List integrations
|
||||
# 6. Define conditional logic
|
||||
# 7. Set criticality level
|
||||
# 8. Name the workflow
|
||||
|
||||
# Requirements are saved to: docs/workflow-requirements/req-{name}.md
|
||||
```
|
||||
|
||||
### Create a Workflow
|
||||
|
||||
```bash
|
||||
# Start the create workflow process
|
||||
*create-workflow
|
||||
|
||||
# Arnold will:
|
||||
# 1. Check for requirements file (or prompt to create one)
|
||||
# 2. Load requirements automatically
|
||||
# 3. Research n8n documentation
|
||||
# 4. Design workflow structure
|
||||
# 5. Build and validate workflow JSON
|
||||
# 6. Save to docs/workflows/{name}.json
|
||||
```
|
||||
|
||||
### 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
|
||||
|
||||
### Web Search Integration
|
||||
|
||||
- Automatic web search for n8n documentation
|
||||
- Accesses official docs.n8n.io resources
|
||||
- Up-to-date node configurations and best practices
|
||||
- Problem-specific solution research
|
||||
|
||||
### 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
|
||||
- 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
|
||||
|
||||
### 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,57 @@
|
|||
# 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"
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
# 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 web search.
|
||||
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: |
|
||||
- Web Search Integration - Always search for latest n8n documentation from docs.n8n.io 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: gather-requirements
|
||||
workflow: "{project-root}/{bmad_folder}/autominator/workflows/gather-requirements/workflow.yaml"
|
||||
description: Gather and document workflow requirements (run this first before creating workflows)
|
||||
|
||||
- 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,405 @@
|
|||
# n8n Workflow Helpers
|
||||
|
||||
## UUID Generation
|
||||
|
||||
n8n uses UUIDs for node IDs, workflow IDs, and webhook IDs. Generate UUIDs in this format:
|
||||
|
||||
**Full UUID (36 characters):** `f8b7ff4f-6375-4c79-9b2c-9814bfdd0c92`
|
||||
|
||||
- Used for: node `id`, `webhookId`, `versionId`
|
||||
- Format: 8-4-4-4-12 hexadecimal characters with hyphens
|
||||
|
||||
**Short ID (16 characters):** `Wvmqb0POKmqwCoKy`
|
||||
|
||||
- Used for: workflow `id`, tag `id`
|
||||
- Format: alphanumeric (a-z, A-Z, 0-9)
|
||||
|
||||
**Assignment ID:** `id-1`, `id-2`, `id-3`
|
||||
|
||||
- Used for: Set node assignments, IF node conditions
|
||||
- Format: "id-" + sequential number
|
||||
|
||||
## Node Creation Guidelines
|
||||
|
||||
### Basic Node Structure (Modern n8n Format)
|
||||
|
||||
```json
|
||||
{
|
||||
"parameters": {},
|
||||
"id": "f8b7ff4f-6375-4c79-9b2c-9814bfdd0c92",
|
||||
"name": "Node Name",
|
||||
"type": "n8n-nodes-base.nodeName",
|
||||
"typeVersion": 2,
|
||||
"position": [1424, 496],
|
||||
"webhookId": "b5f0b784-2440-4371-bcf1-b59dd2b29e68",
|
||||
"credentials": {}
|
||||
}
|
||||
```
|
||||
|
||||
**Critical Rules:**
|
||||
|
||||
- `parameters` comes FIRST
|
||||
- `id` must be UUID format (e.g., "f8b7ff4f-6375-4c79-9b2c-9814bfdd0c92")
|
||||
- `type` must be `n8n-nodes-base.nodeName` format (NOT @n8n/n8n-nodes-\*)
|
||||
- `typeVersion` must be INTEGER (e.g., 2, 3, 4) NOT float (2.1, 3.4)
|
||||
- `position` must be array of integers: [x, y]
|
||||
- `webhookId` required for webhook nodes (UUID format)
|
||||
- Field order matters for n8n compatibility
|
||||
|
||||
### 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
|
||||
|
||||
### ⚠️ CRITICAL: Node Type Format Rules
|
||||
|
||||
**ALWAYS use format:** `n8n-nodes-base.nodeName`
|
||||
|
||||
**NEVER use these formats:**
|
||||
|
||||
- ❌ `@n8n/n8n-nodes-slack.slackTrigger` (wrong package format)
|
||||
- ❌ `n8n-nodes-slack.slackTrigger` (missing base)
|
||||
- ❌ `slackTrigger` (missing prefix)
|
||||
|
||||
**Correct Examples:**
|
||||
|
||||
- ✅ `n8n-nodes-base.webhook`
|
||||
- ✅ `n8n-nodes-base.slackTrigger`
|
||||
- ✅ `n8n-nodes-base.gmail`
|
||||
- ✅ `n8n-nodes-base.if`
|
||||
|
||||
**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
|
||||
- `n8n-nodes-base.slackTrigger` - Slack event 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 actions
|
||||
- `n8n-nodes-base.gmail` - Gmail
|
||||
- `n8n-nodes-base.notion` - Notion
|
||||
- `n8n-nodes-base.airtable` - Airtable
|
||||
- `n8n-nodes-base.postgres` - PostgreSQL
|
||||
- `n8n-nodes-base.mysql` - MySQL
|
||||
|
||||
## Connection Guidelines
|
||||
|
||||
### Connection Structure
|
||||
|
||||
### ⚠️ CRITICAL: Connection Format Rules
|
||||
|
||||
**CORRECT Format:**
|
||||
|
||||
```json
|
||||
{
|
||||
"Source Node Name": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Target Node Name",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**WRONG Formats:**
|
||||
|
||||
```json
|
||||
// ❌ WRONG - Missing "main" wrapper
|
||||
{
|
||||
"Source Node Name": [
|
||||
[
|
||||
{
|
||||
"node": "Target Node Name",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
// ❌ WRONG - Direct array
|
||||
{
|
||||
"Source Node Name": [[{...}]]
|
||||
}
|
||||
```
|
||||
|
||||
### Connection Rules
|
||||
|
||||
1. Each connection has a source node and target node
|
||||
2. Connections object structure: `{"Source": {"main": [[{...}]]}}`
|
||||
3. The "main" key is REQUIRED (wraps the connection array)
|
||||
4. Index 0 is default output, index 1+ for conditional branches
|
||||
5. IF nodes have index 0 (true) and index 1 (false)
|
||||
6. 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 (Modern Format - typeVersion 3+)
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Transform Data",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 3,
|
||||
"parameters": {
|
||||
"assignments": {
|
||||
"assignments": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"name": "outputField",
|
||||
"value": "={{ $json.inputField }}",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"includeOtherFields": true,
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Critical Rules for Set Node:**
|
||||
|
||||
- Use `assignments.assignments` structure (not `values`)
|
||||
- Each assignment needs `id` field (e.g., "id-1", "id-2")
|
||||
- Each assignment needs `type` field ("string", "number", "boolean")
|
||||
- Include `includeOtherFields: true` to pass through other data
|
||||
- Include `options: {}` for compatibility
|
||||
|
||||
### Using Gmail Node (typeVersion 2+)
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Send Email",
|
||||
"type": "n8n-nodes-base.gmail",
|
||||
"typeVersion": 2,
|
||||
"parameters": {
|
||||
"sendTo": "user@example.com",
|
||||
"subject": "Email Subject",
|
||||
"message": "Email body content",
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Critical Rules for Gmail Node:**
|
||||
|
||||
- Use `message` parameter (NOT `text`)
|
||||
- Use `sendTo` (NOT `to`)
|
||||
- Include `options: {}` for compatibility
|
||||
|
||||
### Using Slack Node with Channel Selection
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Slack Action",
|
||||
"type": "n8n-nodes-base.slack",
|
||||
"typeVersion": 2,
|
||||
"parameters": {
|
||||
"channel": {
|
||||
"__rl": true,
|
||||
"value": "general",
|
||||
"mode": "list",
|
||||
"cachedResultName": "#general"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Critical Rules for Slack Channel:**
|
||||
|
||||
- Use `__rl: true` flag for resource locator
|
||||
- Include `mode: "list"` for channel selection
|
||||
- Include `cachedResultName` with # prefix
|
||||
|
||||
### Using IF Node (typeVersion 2+)
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Check Condition",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": false,
|
||||
"leftValue": "",
|
||||
"typeValidation": "loose"
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "id-1",
|
||||
"leftValue": "={{ $json.field }}",
|
||||
"rightValue": "value",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Critical Rules for IF Node:**
|
||||
|
||||
- Use `conditions.conditions` structure
|
||||
- Each condition needs `id` field
|
||||
- Do NOT include `name` field in conditions
|
||||
- Use `operator` object with `type` and `operation`
|
||||
- Include `options` at root level
|
||||
|
||||
### 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 (Modern n8n Format)
|
||||
|
||||
### Required Fields
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Workflow Name",
|
||||
"nodes": [],
|
||||
"pinData": {},
|
||||
"connections": {},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "7d745171-e378-411c-bd0a-25a8368a1cb6",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "2229c21690ffe7e7b16788a579be3103980c4445acb933f7ced2a6a17f0bd18b"
|
||||
},
|
||||
"id": "Wvmqb0POKmqwCoKy",
|
||||
"tags": [
|
||||
{
|
||||
"name": "Automation",
|
||||
"id": "7FHIZPUaIaChwuiS",
|
||||
"updatedAt": "2025-11-21T19:39:46.484Z",
|
||||
"createdAt": "2025-11-21T19:39:46.484Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Critical Rules:**
|
||||
|
||||
- `pinData` must be empty object `{}`
|
||||
- `versionId` must be UUID
|
||||
- `meta` object with `templateCredsSetupCompleted` and `instanceId`
|
||||
- `id` must be short alphanumeric (e.g., "Wvmqb0POKmqwCoKy")
|
||||
- `tags` must be array of objects (not strings) with id, name, createdAt, updatedAt
|
||||
|
||||
## 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,449 @@
|
|||
# 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="Load Config and Check Prerequisites">
|
||||
<critical>Load configuration and check for requirements file before proceeding</critical>
|
||||
|
||||
<action>Resolve variables from config_source: workflows_folder, requirements_folder, output_folder, user_name, communication_language</action>
|
||||
<action>Create {{workflows_folder}} directory if it does not exist</action>
|
||||
<action>Create {{requirements_folder}} directory if it does not exist</action>
|
||||
|
||||
<action>Search for requirements files in {{requirements_folder}}</action>
|
||||
<action>List all files matching pattern: req-*.md</action>
|
||||
|
||||
<check if="no requirements files found">
|
||||
<output>⚠️ No Requirements File Found
|
||||
|
||||
Before creating a workflow, you need to gather requirements.
|
||||
|
||||
**Options:**
|
||||
1. Run `*gather-requirements` to create a requirements file
|
||||
2. Provide requirements manually in this session
|
||||
|
||||
Would you like to:
|
||||
a) Run gather-requirements workflow now
|
||||
b) Continue without requirements file (manual elicitation)
|
||||
|
||||
Enter your choice (a/b):</output>
|
||||
<action>WAIT for user input</action>
|
||||
|
||||
<check if="user chooses 'a'">
|
||||
<action>Invoke workflow: {project-root}/{bmad_folder}/autominator/workflows/gather-requirements/workflow.yaml</action>
|
||||
<action>After gather-requirements completes, reload this step to find the new requirements file</action>
|
||||
</check>
|
||||
|
||||
<check if="user chooses 'b'">
|
||||
<action>Set {{requirements_file}} = empty</action>
|
||||
<action>Proceed to Step 1 for manual elicitation</action>
|
||||
</check>
|
||||
</check>
|
||||
|
||||
<check if="one requirements file found">
|
||||
<action>Set {{requirements_file}} to the found file path</action>
|
||||
<action>Load and parse requirements file COMPLETELY</action>
|
||||
<action>Extract requirements: workflow_name, problem_description, trigger_type, data_requirements, desired_outcome, integrations, conditional_logic, criticality</action>
|
||||
<action>Extract research findings: use_case_research, node_research, parameter_structures, workflow_pattern_research</action>
|
||||
<action>Display loaded requirements summary to user</action>
|
||||
<action>Skip to Step 4 (Plan Workflow Structure) - research already done</action>
|
||||
</check>
|
||||
|
||||
<check if="multiple requirements files found">
|
||||
<output>📋 Multiple Requirements Files Found:
|
||||
|
||||
[Display numbered list of files with workflow names]
|
||||
|
||||
Which requirements file would you like to use?
|
||||
Enter the number (1-N) or 'new' to create a new one:</output>
|
||||
<action>WAIT for user input</action>
|
||||
|
||||
<check if="user enters number">
|
||||
<action>Set {{requirements_file}} to selected file path</action>
|
||||
<action>Load and parse requirements file COMPLETELY</action>
|
||||
<action>Extract requirements: workflow_name, problem_description, trigger_type, data_requirements, desired_outcome, integrations, conditional_logic, criticality</action>
|
||||
<action>Extract research findings: use_case_research, node_research, parameter_structures, workflow_pattern_research</action>
|
||||
<action>Display loaded requirements summary to user</action>
|
||||
<action>Skip to Step 4 (Plan Workflow Structure) - research already done</action>
|
||||
</check>
|
||||
|
||||
<check if="user enters 'new'">
|
||||
<action>Invoke workflow: {project-root}/{bmad_folder}/autominator/workflows/gather-requirements/workflow.yaml</action>
|
||||
<action>After gather-requirements completes, reload this step to find the new requirements file</action>
|
||||
</check>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="1" goal="Gather Requirements" elicit="true">
|
||||
<critical>Start by understanding the ACTUAL PROBLEM the user wants to solve, not just technical requirements</critical>
|
||||
|
||||
<action>Ask Question 1: "What problem are you trying to solve with this automation?"</action>
|
||||
<action>Encourage detailed explanation: "Describe the current manual process, pain points, and desired outcome."</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{problem_description}}</action>
|
||||
|
||||
<action>Ask Question 2: "What triggers this process? When should the automation run?"</action>
|
||||
<action>Present numbered options:
|
||||
1. When data arrives - Webhook, form submission, API call
|
||||
2. On a schedule - Every hour, daily, weekly, custom cron
|
||||
3. When something changes - Database update, file change, service event
|
||||
4. Manually - On-demand execution
|
||||
5. Multiple triggers - Combination of above
|
||||
6. Not sure - Help me decide based on my problem
|
||||
</action>
|
||||
<action>WAIT for user selection (1-6)</action>
|
||||
<action>Store selection in {{trigger_type}}</action>
|
||||
|
||||
<check if="selection is 6 (Not sure)">
|
||||
<action>Analyze {{problem_description}} and suggest appropriate trigger</action>
|
||||
<action>Ask: "Based on your problem, I recommend [trigger type]. Does this make sense?"</action>
|
||||
<action>WAIT for confirmation or adjustment</action>
|
||||
<action>Store final trigger in {{trigger_type}}</action>
|
||||
</check>
|
||||
|
||||
<action>Ask Question 3: "What data or information does this workflow need to work with?"</action>
|
||||
<action>Examples: "Customer data, order details, form responses, API data, etc."</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{data_requirements}}</action>
|
||||
|
||||
<action>Ask Question 4: "What should happen with this data? What's the desired outcome?"</action>
|
||||
<action>Examples: "Send to Slack, update database, create invoice, notify team, etc."</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{desired_outcome}}</action>
|
||||
|
||||
<action>Ask Question 5: "What services or systems are involved?"</action>
|
||||
<action>Examples: "Slack, Google Sheets, PostgreSQL, HubSpot, custom API, etc."</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{integrations}}</action>
|
||||
|
||||
<action>Ask Question 6: "Are there any conditions or decision points in this process?"</action>
|
||||
<action>Examples: "If amount > $1000, notify manager; If status = 'urgent', send immediately"</action>
|
||||
<action>Present numbered options:
|
||||
1. No - Straight-through processing
|
||||
2. Yes - Describe the conditions
|
||||
</action>
|
||||
<action>WAIT for user selection (1-2)</action>
|
||||
<check if="selection is 2">
|
||||
<action>Ask: "Describe the conditions and what should happen in each case"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{conditional_logic}}</action>
|
||||
</check>
|
||||
|
||||
<action>Ask Question 7: "How critical is this workflow? What happens if it fails?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Low - Can retry manually if needed
|
||||
2. Medium - Should retry automatically, notify on failure
|
||||
3. High - Must succeed, need alerts and logging
|
||||
4. Critical - Business-critical, need comprehensive error handling
|
||||
</action>
|
||||
<action>WAIT for user selection (1-4)</action>
|
||||
<action>Store selection in {{criticality}}</action>
|
||||
|
||||
<action>Ask Question 8: "What should the workflow be named?"</action>
|
||||
<action>Suggest name based on {{problem_description}}</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{workflow_name}}</action>
|
||||
|
||||
<action>Ask Question 9: "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
|
||||
</action>
|
||||
<action>WAIT for user selection (1-2)</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>
|
||||
|
||||
<action>Summarize understanding:</action>
|
||||
<action>- Problem: {{problem_description}}</action>
|
||||
<action>- Trigger: {{trigger_type}}</action>
|
||||
<action>- Data: {{data_requirements}}</action>
|
||||
<action>- Outcome: {{desired_outcome}}</action>
|
||||
<action>- Services: {{integrations}}</action>
|
||||
<action>- Conditions: {{conditional_logic}}</action>
|
||||
<action>- Criticality: {{criticality}}</action>
|
||||
|
||||
<action>Ask: "Does this capture your requirements correctly?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Yes - Proceed with workflow creation
|
||||
2. No - Let me clarify or add details
|
||||
</action>
|
||||
<action>WAIT for user selection (1-2)</action>
|
||||
<check if="selection is 2">
|
||||
<action>Ask: "What needs to be clarified or added?"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Update relevant variables</action>
|
||||
<action>Repeat summary and confirmation</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="2" goal="Research n8n Documentation">
|
||||
<critical>Search for up-to-date n8n documentation based on user requirements</critical>
|
||||
|
||||
<action>Inform user: "Researching n8n documentation for your workflow requirements..."</action>
|
||||
|
||||
<action>Perform web search for n8n documentation on:</action>
|
||||
<action>1. Trigger type: {{trigger_type}}</action>
|
||||
<action>2. Integrations: {{integrations}}</action>
|
||||
<action>3. Conditional logic: {{conditional_logic}}</action>
|
||||
<action>4. Error handling: {{criticality}}</action>
|
||||
|
||||
<action>Search queries to use:</action>
|
||||
<action>- "n8n [trigger_type] node documentation"</action>
|
||||
<action>- "n8n [integration] node setup"</action>
|
||||
<action>- "n8n workflow best practices"</action>
|
||||
<action>- "n8n error handling retry logic"</action>
|
||||
|
||||
<action>Focus on official n8n documentation at docs.n8n.io</action>
|
||||
<action>Store relevant documentation snippets for reference</action>
|
||||
<action>Note any specific node configurations or parameters needed</action>
|
||||
</step>
|
||||
|
||||
<step n="3" goal="Verify Documentation Understanding">
|
||||
<action>Summarize key findings from documentation:</action>
|
||||
<action>- Available node types for requirements</action>
|
||||
<action>- Required parameters and configurations</action>
|
||||
<action>- Best practices for this use case</action>
|
||||
<action>- Any limitations or considerations</action>
|
||||
|
||||
<action>Inform user: "Based on n8n documentation, I found the necessary nodes and configurations for your workflow."</action>
|
||||
</step>
|
||||
|
||||
<step n="4" goal="Plan Workflow Structure">
|
||||
<critical>Design workflow based on the ACTUAL PROBLEM, not just technical specs</critical>
|
||||
|
||||
<action>Analyze the problem and requirements:</action>
|
||||
<action>- Problem to solve: {{problem_description}}</action>
|
||||
<action>- Trigger: {{trigger_type}}</action>
|
||||
<action>- Data needed: {{data_requirements}}</action>
|
||||
<action>- Desired outcome: {{desired_outcome}}</action>
|
||||
<action>- Services: {{integrations}}</action>
|
||||
<action>- Conditions: {{conditional_logic}}</action>
|
||||
<action>- Criticality: {{criticality}}</action>
|
||||
|
||||
<action>Design workflow structure that solves the problem:</action>
|
||||
<action>1. Map trigger to appropriate n8n trigger node</action>
|
||||
<action>2. Design data acquisition steps (API calls, database queries)</action>
|
||||
<action>3. Plan data transformations needed for the outcome</action>
|
||||
<action>4. Implement conditional logic from {{conditional_logic}}</action>
|
||||
<action>5. Design actions to achieve {{desired_outcome}}</action>
|
||||
<action>6. Add error handling based on {{criticality}}</action>
|
||||
<action>7. Plan node connections and data flow</action>
|
||||
|
||||
<action>Present the solution-focused workflow plan:</action>
|
||||
<action>## Workflow Solution for: {{problem_description}}</action>
|
||||
<action></action>
|
||||
<action>**How it works:**</action>
|
||||
<action>[Explain in plain language how the workflow solves the problem]</action>
|
||||
<action></action>
|
||||
<action>**Workflow Steps:**</action>
|
||||
<action>1. Trigger: [When/how it starts] - [n8n node type]</action>
|
||||
<action>2. Get Data: [What data is retrieved] - [n8n nodes]</action>
|
||||
<action>3. Process: [How data is transformed] - [n8n nodes]</action>
|
||||
<action>4. Decide: [Conditional logic if any] - [IF/Switch nodes]</action>
|
||||
<action>5. Act: [Final actions to achieve outcome] - [n8n nodes]</action>
|
||||
<action>6. Handle Errors: [Error strategy] - [Error handling config]</action>
|
||||
<action></action>
|
||||
<action>**Expected Result:**</action>
|
||||
<action>[Describe what happens when workflow runs successfully]</action>
|
||||
|
||||
<action>Ask: "Does this workflow solve your problem?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Yes - This solves my problem, proceed
|
||||
2. No - Missing something important
|
||||
3. Partially - Needs adjustments
|
||||
4. Explain more - I need clarification
|
||||
</action>
|
||||
<action>WAIT for user selection (1-4)</action>
|
||||
|
||||
<check if="selection is 2">
|
||||
<action>Ask: "What's missing? What else needs to happen?"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Adjust workflow design to include missing elements</action>
|
||||
<action>Repeat this step</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 3">
|
||||
<action>Ask: "What needs to be adjusted?"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Modify workflow design based on feedback</action>
|
||||
<action>Repeat this step</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 4">
|
||||
<action>Ask: "Which part needs clarification?"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Provide detailed explanation of that part</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>Use EXACT node types and parameter structures from {{node_research}} and {{parameter_structures}}</critical>
|
||||
<critical>Follow modern n8n format from {{helpers}}</critical>
|
||||
|
||||
<action>Initialize workflow structure with modern n8n format:</action>
|
||||
<substep>
|
||||
{
|
||||
"name": "{{workflow_name}}",
|
||||
"nodes": [],
|
||||
"pinData": {},
|
||||
"connections": {},
|
||||
"active": false,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "[generate UUID]",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "[generate UUID]"
|
||||
},
|
||||
"id": "[generate short ID]",
|
||||
"tags": []
|
||||
}
|
||||
</substep>
|
||||
|
||||
<action>Build nodes ONE at a time following these rules:</action>
|
||||
|
||||
<substep>For Each Node (Use EXACT structures from research):
|
||||
1. Generate UUID for node ID (format: "f8b7ff4f-6375-4c79-9b2c-9814bfdd0c92")
|
||||
2. Set node name (unique, descriptive)
|
||||
3. Use EXACT node type from {{node_research}}:
|
||||
- MUST be format: "n8n-nodes-base.nodeName"
|
||||
- NEVER use: "@n8n/n8n-nodes-*" format
|
||||
- Example: "n8n-nodes-base.gmail" NOT "@n8n/n8n-nodes-gmail.gmail"
|
||||
4. Use EXACT typeVersion from {{node_research}}:
|
||||
- MUST be INTEGER (2, 3, 4)
|
||||
- NEVER use float (2.1, 3.4)
|
||||
5. Calculate position as INTEGER array:
|
||||
- Format: [x, y] where x and y are integers
|
||||
- First node (trigger): [240, 300]
|
||||
- Subsequent nodes: add 220 to x for each step
|
||||
- Branches: adjust y by ±100
|
||||
6. Use EXACT parameter structure from {{parameter_structures}}:
|
||||
- For Set node (v3+): use assignments.assignments structure
|
||||
- For Gmail node (v2+): use "message" parameter (NOT "text")
|
||||
- For IF node (v2+): use conditions.conditions structure (NO "name" field in conditions)
|
||||
- For Slack channel: use __rl flag with mode and cachedResultName
|
||||
- Copy structure EXACTLY from research, don't modify
|
||||
7. Add webhookId (UUID) if node type is webhook
|
||||
8. Add credentials if needed
|
||||
9. Field order: parameters, id, name, type, typeVersion, position, webhookId, credentials
|
||||
10. Store node name in list for validation
|
||||
</substep>
|
||||
|
||||
<substep>For Each Connection (CRITICAL FORMAT):
|
||||
1. Identify source node name (must match node "name" field exactly)
|
||||
2. Identify target node name (must match node "name" field exactly)
|
||||
3. Create connection entry with CORRECT format:
|
||||
"Source Node Name": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Target Node Name",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
4. CRITICAL: The "main" wrapper object is REQUIRED
|
||||
5. NEVER use format: "Source": [[{...}]] (missing "main" wrapper)
|
||||
6. For IF nodes:
|
||||
- index 0 = true branch
|
||||
- index 1 = false branch
|
||||
7. Validate all referenced nodes exist in node names list
|
||||
</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>Resolve final save path:</action>
|
||||
<check if="{{save_location}} was provided by user">
|
||||
<action>Use {{save_location}} as-is</action>
|
||||
</check>
|
||||
<check if="{{save_location}} is empty or default">
|
||||
<action>Use {{workflows_folder}}/{{workflow_name}}.json</action>
|
||||
<action>Ensure {{workflows_folder}} directory exists</action>
|
||||
<action>Store resolved path in {{save_location}}</action>
|
||||
</check>
|
||||
<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,43 @@
|
|||
name: create-workflow
|
||||
description: "Create new n8n workflow from scratch based on requirements"
|
||||
author: "Saif"
|
||||
|
||||
# Critical variables from config
|
||||
config_source: "{project-root}/{bmad_folder}/autominator/config.yaml"
|
||||
output_folder: "{config_source}:output_folder"
|
||||
user_name: "{config_source}:user_name"
|
||||
communication_language: "{config_source}:communication_language"
|
||||
workflows_folder: "{config_source}:workflows_folder"
|
||||
requirements_folder: "{config_source}:requirements_folder"
|
||||
date: system-generated
|
||||
|
||||
# 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:
|
||||
requirements_file: "" # Will be discovered or elicited
|
||||
workflow_type: "" # Will be loaded from requirements or elicited
|
||||
trigger_type: "" # Will be loaded from requirements or elicited
|
||||
integrations: [] # Will be loaded from requirements or elicited
|
||||
complexity: "" # Will be elicited
|
||||
error_handling: "" # Will be elicited
|
||||
workflow_name: "" # Will be loaded from requirements or elicited
|
||||
problem_description: "" # Will be loaded from requirements
|
||||
data_requirements: "" # Will be loaded from requirements
|
||||
desired_outcome: "" # Will be loaded from requirements
|
||||
conditional_logic: "" # Will be loaded from requirements
|
||||
criticality: "" # Will be loaded from requirements
|
||||
|
||||
default_output_file: "{workflows_folder}/{workflow_name}.json"
|
||||
|
||||
standalone: true
|
||||
web_bundle: false
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
# Gather Requirements - Validation Checklist
|
||||
|
||||
## Requirements Completeness
|
||||
|
||||
- [ ] Problem statement is clear and specific
|
||||
- [ ] Trigger type is defined
|
||||
- [ ] Data requirements are documented
|
||||
- [ ] Desired outcome is clear
|
||||
- [ ] All integrations are listed
|
||||
- [ ] Conditional logic is documented (or marked as not needed)
|
||||
- [ ] Criticality level is set
|
||||
- [ ] Workflow name is descriptive
|
||||
|
||||
## Document Quality
|
||||
|
||||
- [ ] Requirements file is saved to correct location
|
||||
- [ ] All template fields are filled
|
||||
- [ ] No placeholder text remains
|
||||
- [ ] Change log is initialized
|
||||
|
||||
## Readiness
|
||||
|
||||
- [ ] Requirements are sufficient to create workflow
|
||||
- [ ] User has confirmed requirements are correct
|
||||
- [ ] File is ready for use by create-workflow
|
||||
|
|
@ -0,0 +1,190 @@
|
|||
# Gather Requirements - 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 gathers requirements for n8n workflow creation.</critical>
|
||||
|
||||
<workflow>
|
||||
|
||||
<step n="1" goal="Load Config and Initialize">
|
||||
<action>Resolve variables from config_source: requirements_folder, output_folder, user_name, communication_language</action>
|
||||
<action>Create {{requirements_folder}} directory if it does not exist</action>
|
||||
<action>Load template from {{template}}</action>
|
||||
</step>
|
||||
|
||||
<step n="2" goal="Gather Requirements" elicit="true">
|
||||
<critical>Ask questions ONE AT A TIME and WAIT for user response after each question</critical>
|
||||
|
||||
<ask>Question 1: What problem are you trying to solve with this automation?
|
||||
|
||||
Describe the current manual process, pain points, and desired outcome.</ask>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store response in {{problem_description}}</action>
|
||||
|
||||
<action>Perform web search to understand the use case:</action>
|
||||
<action>- "n8n workflow for [problem description] site:docs.n8n.io"</action>
|
||||
<action>- "n8n automation [problem description] best practices"</action>
|
||||
<action>Store findings in {{use_case_research}}</action>
|
||||
|
||||
<ask>Question 2: What triggers this process? When should the automation run?
|
||||
|
||||
Options:
|
||||
1. When data arrives - Webhook, form submission, API call
|
||||
2. On a schedule - Every hour, daily, weekly, custom cron
|
||||
3. When something changes - Database update, file change, service event
|
||||
4. Manually - On-demand execution
|
||||
5. Multiple triggers - Combination of above
|
||||
6. Not sure - Help me decide based on my problem
|
||||
|
||||
Enter your selection (1-6):</ask>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store response in {{trigger_type}}</action>
|
||||
|
||||
<check if="selection is 6">
|
||||
<action>Analyze {{problem_description}} and suggest appropriate trigger</action>
|
||||
<ask>Based on your problem, I recommend [trigger type]. Does this make sense? (yes/no)</ask>
|
||||
<action>WAIT for confirmation</action>
|
||||
<action>Store final trigger in {{trigger_type}}</action>
|
||||
</check>
|
||||
|
||||
<ask>Question 3: What data or information does this workflow need to work with?
|
||||
|
||||
Examples: Customer data, order details, form responses, API data, etc.</ask>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store response in {{data_requirements}}</action>
|
||||
|
||||
<ask>Question 4: What should happen with this data? What's the desired outcome?
|
||||
|
||||
Examples: Send to Slack, update database, create invoice, notify team, etc.</ask>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store response in {{desired_outcome}}</action>
|
||||
|
||||
<ask>Question 5: What services or systems are involved?
|
||||
|
||||
Examples: Slack, Google Sheets, PostgreSQL, HubSpot, custom API, etc.</ask>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store response in {{integrations}}</action>
|
||||
|
||||
<action>Research EXACT n8n node types for each integration:</action>
|
||||
<action>For each service in {{integrations}}:</action>
|
||||
<action>1. Search: "n8n [service] node documentation site:docs.n8n.io"</action>
|
||||
<action>2. Extract EXACT node type string (e.g., "n8n-nodes-base.webhook")</action>
|
||||
<action>3. Extract typeVersion (e.g., 2.1)</action>
|
||||
<action>4. Extract available parameters structure</action>
|
||||
<action>5. Extract example usage from docs</action>
|
||||
<action>6. Note if trigger node or action node</action>
|
||||
<action>Store all findings in {{node_research}}</action>
|
||||
|
||||
<ask>Question 6: Are there any conditions or decision points in this process?
|
||||
|
||||
Examples: If amount > $1000, notify manager; If status = 'urgent', send immediately
|
||||
|
||||
Options:
|
||||
1. No - Straight-through processing
|
||||
2. Yes - Describe the conditions
|
||||
|
||||
Enter your selection (1-2):</ask>
|
||||
<action>WAIT for user input</action>
|
||||
<check if="selection is 2">
|
||||
<ask>Describe the conditions and what should happen in each case:</ask>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store response in {{conditional_logic}}</action>
|
||||
</check>
|
||||
<check if="selection is 1">
|
||||
<action>Store "No conditional logic required" in {{conditional_logic}}</action>
|
||||
</check>
|
||||
|
||||
<ask>Question 7: How critical is this workflow? What happens if it fails?
|
||||
|
||||
Options:
|
||||
1. Low - Can retry manually if needed
|
||||
2. Medium - Should retry automatically, notify on failure
|
||||
3. High - Must succeed, need alerts and logging
|
||||
4. Critical - Business-critical, need comprehensive error handling
|
||||
|
||||
Enter your selection (1-4):</ask>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store selection in {{criticality}}</action>
|
||||
|
||||
<ask>Question 8: What should the workflow be named?</ask>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store response in {{workflow_name}}</action>
|
||||
<action>Generate {{workflow_slug}} from {{workflow_name}} (lowercase, hyphens, no spaces)</action>
|
||||
|
||||
<action>Display summary:
|
||||
- Problem: {{problem_description}}
|
||||
- Trigger: {{trigger_type}}
|
||||
- Data: {{data_requirements}}
|
||||
- Outcome: {{desired_outcome}}
|
||||
- Services: {{integrations}}
|
||||
- Conditions: {{conditional_logic}}
|
||||
- Criticality: {{criticality}}
|
||||
- Name: {{workflow_name}}
|
||||
</action>
|
||||
|
||||
<ask>Does this capture your requirements correctly?
|
||||
|
||||
Options:
|
||||
1. Yes - Save requirements
|
||||
2. No - Let me clarify or add details
|
||||
|
||||
Enter your selection (1-2):</ask>
|
||||
<action>WAIT for user input</action>
|
||||
<check if="selection is 2">
|
||||
<ask>What needs to be clarified or added?</ask>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Update relevant variables based on feedback</action>
|
||||
<action>Repeat summary and confirmation</action>
|
||||
</check>
|
||||
</step>
|
||||
|
||||
<step n="3" goal="Research Workflow Pattern">
|
||||
<action>Perform comprehensive web search for workflow pattern:</action>
|
||||
<action>- "n8n workflow pattern [trigger_type] to [desired_outcome] site:docs.n8n.io"</action>
|
||||
<action>- "n8n [integrations] workflow example site:docs.n8n.io"</action>
|
||||
<action>- "n8n best practices [use case] site:docs.n8n.io"</action>
|
||||
<action>Store findings in {{workflow_pattern_research}}</action>
|
||||
|
||||
<action>Research parameter structures for each node type:</action>
|
||||
<action>For each node type in {{node_research}}:</action>
|
||||
<action>1. Search: "n8n [node type] parameters documentation site:docs.n8n.io"</action>
|
||||
<action>2. Extract EXACT parameter structure from docs</action>
|
||||
<action>3. Extract required vs optional parameters</action>
|
||||
<action>4. Extract parameter data types</action>
|
||||
<action>5. Extract example values</action>
|
||||
<action>Store in {{parameter_structures}}</action>
|
||||
</step>
|
||||
|
||||
<step n="4" goal="Save Requirements Document">
|
||||
<action>Resolve output path: {{default_output_file}} using {{workflow_slug}}</action>
|
||||
<action>Fill template with all gathered variables AND research findings</action>
|
||||
<action>Include in document:</action>
|
||||
<action>- Problem description and requirements</action>
|
||||
<action>- Use case research findings</action>
|
||||
<action>- EXACT node types with typeVersions</action>
|
||||
<action>- EXACT parameter structures from docs</action>
|
||||
<action>- Workflow pattern recommendations</action>
|
||||
<action>- Best practices from research</action>
|
||||
<action>Save document to {{default_output_file}}</action>
|
||||
<action>Report saved file path to user</action>
|
||||
|
||||
<output>✅ Requirements Saved Successfully!
|
||||
|
||||
**File:** {{default_output_file}}
|
||||
|
||||
**Next Steps:**
|
||||
1. Review the requirements file
|
||||
2. Run `*create-workflow` to generate the n8n workflow
|
||||
(The create-workflow will automatically load this requirements file)
|
||||
|
||||
**Note:** You can edit the requirements file manually before creating the workflow.
|
||||
</output>
|
||||
</step>
|
||||
|
||||
<step n="5" 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,75 @@
|
|||
# Workflow Requirements: {{workflow_name}}
|
||||
|
||||
**Created:** {{date}}
|
||||
**Status:** Requirements Gathered
|
||||
**Criticality:** {{criticality}}
|
||||
|
||||
---
|
||||
|
||||
## Problem Statement
|
||||
|
||||
{{problem_description}}
|
||||
|
||||
---
|
||||
|
||||
## Workflow Overview
|
||||
|
||||
**Trigger:** {{trigger_type}}
|
||||
|
||||
**Desired Outcome:** {{desired_outcome}}
|
||||
|
||||
---
|
||||
|
||||
## Data Requirements
|
||||
|
||||
{{data_requirements}}
|
||||
|
||||
---
|
||||
|
||||
## Integrations
|
||||
|
||||
{{integrations}}
|
||||
|
||||
---
|
||||
|
||||
## Conditional Logic
|
||||
|
||||
{{conditional_logic}}
|
||||
|
||||
---
|
||||
|
||||
## Research Findings
|
||||
|
||||
### Use Case Research
|
||||
|
||||
{{use_case_research}}
|
||||
|
||||
### Node Types (From n8n Documentation)
|
||||
|
||||
{{node_research}}
|
||||
|
||||
### Parameter Structures (From n8n Documentation)
|
||||
|
||||
{{parameter_structures}}
|
||||
|
||||
### Workflow Pattern Recommendations
|
||||
|
||||
{{workflow_pattern_research}}
|
||||
|
||||
---
|
||||
|
||||
## Technical Notes
|
||||
|
||||
- Requirements gathered: {{date}}
|
||||
- Research completed from n8n documentation
|
||||
- All node types and parameters verified from docs.n8n.io
|
||||
- Ready for workflow creation
|
||||
- Use this file as input for `*create-workflow`
|
||||
|
||||
---
|
||||
|
||||
## Change Log
|
||||
|
||||
| Date | Change | Author |
|
||||
| -------- | ----------------------------- | ------------- |
|
||||
| {{date}} | Initial requirements gathered | {{user_name}} |
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
name: gather-requirements
|
||||
description: "Gather and document workflow requirements before creating n8n workflow"
|
||||
author: "Saif"
|
||||
|
||||
# Critical variables from config
|
||||
config_source: "{project-root}/{bmad_folder}/autominator/config.yaml"
|
||||
output_folder: "{config_source}:output_folder"
|
||||
user_name: "{config_source}:user_name"
|
||||
communication_language: "{config_source}:communication_language"
|
||||
requirements_folder: "{config_source}:requirements_folder"
|
||||
date: system-generated
|
||||
|
||||
# Workflow components
|
||||
installed_path: "{project-root}/{bmad_folder}/autominator/workflows/gather-requirements"
|
||||
template: "{installed_path}/template.md"
|
||||
instructions: "{installed_path}/instructions.md"
|
||||
validation: "{installed_path}/checklist.md"
|
||||
|
||||
# Variables
|
||||
variables:
|
||||
workflow_name: "" # Will be elicited
|
||||
workflow_slug: "" # Generated from workflow_name
|
||||
problem_description: "" # Will be elicited
|
||||
trigger_type: "" # Will be elicited
|
||||
data_requirements: "" # Will be elicited
|
||||
desired_outcome: "" # Will be elicited
|
||||
integrations: "" # Will be elicited
|
||||
conditional_logic: "" # Will be elicited
|
||||
criticality: "" # Will be elicited
|
||||
|
||||
default_output_file: "{requirements_folder}/req-{workflow_slug}.md"
|
||||
|
||||
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,354 @@
|
|||
# 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 (Research n8n Documentation for Migration)</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">
|
||||
<critical>Understand the BUSINESS PURPOSE of the workflow being migrated, not just technical details</critical>
|
||||
|
||||
<action>Ask Question 1: "What does this workflow do? What problem does it solve?"</action>
|
||||
<action>Encourage business context: "Describe the business process, not just the technical steps"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{business_purpose}}</action>
|
||||
|
||||
<action>Ask Question 2: "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 3: "Why are you migrating to n8n?"</action>
|
||||
<action>Examples: "Cost savings", "More flexibility", "Self-hosting", "Better integrations"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{migration_reason}}</action>
|
||||
|
||||
<action>Ask Question 4: "How will you provide the workflow details?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Describe the process - Explain what happens step by step
|
||||
2. Provide export file - Upload/paste workflow export file
|
||||
3. Provide screenshots - Share workflow screenshots
|
||||
4. Combination - Multiple sources
|
||||
</action>
|
||||
<action>WAIT for user selection (1-4)</action>
|
||||
|
||||
<check if="selection is 1 or 4">
|
||||
<action>Ask: "Describe the workflow step by step:"</action>
|
||||
<action>- What triggers it?</action>
|
||||
<action>- What data does it process?</action>
|
||||
<action>- What actions does it take?</action>
|
||||
<action>- What's the final outcome?</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{workflow_description}}</action>
|
||||
</check>
|
||||
|
||||
<check if="selection is 2 or 4">
|
||||
<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 or 4">
|
||||
<action>Ask: "Please share the workflow screenshots and describe what each part does"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{workflow_screenshots}}</action>
|
||||
</check>
|
||||
|
||||
<action>Ask Question 5: "What services/integrations does this workflow connect to?"</action>
|
||||
<action>Ask: "List all services (e.g., Slack, Google Sheets, HubSpot, custom APIs, etc.)"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{integrations_used}}</action>
|
||||
|
||||
<action>Ask Question 6: "Are there any pain points or issues with the current workflow?"</action>
|
||||
<action>Examples: "Slow execution", "Unreliable", "Missing features", "Hard to maintain"</action>
|
||||
<action>Present numbered options:
|
||||
1. No - Works fine, just migrating platform
|
||||
2. Yes - Describe the issues
|
||||
</action>
|
||||
<action>WAIT for user selection (1-2)</action>
|
||||
<check if="selection is 2">
|
||||
<action>Ask: "What issues should we fix during migration?"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{issues_to_fix}}</action>
|
||||
</check>
|
||||
|
||||
<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="Research n8n Documentation for Migration">
|
||||
<critical>Search for n8n documentation relevant to migration requirements</critical>
|
||||
|
||||
<action>Inform user: "Researching n8n documentation for migration from {{source_platform}}..."</action>
|
||||
|
||||
<action>Perform web search for:</action>
|
||||
<action>1. n8n equivalents for {{source_platform}} features</action>
|
||||
<action>2. Integration nodes: {{integrations_used}}</action>
|
||||
<action>3. Migration best practices</action>
|
||||
<action>4. Platform-specific considerations</action>
|
||||
|
||||
<action>Search queries to use:</action>
|
||||
<action>- "n8n migrate from [source_platform]"</action>
|
||||
<action>- "n8n [integration] node documentation"</action>
|
||||
<action>- "n8n vs [source_platform] comparison"</action>
|
||||
<action>- "n8n workflow migration guide"</action>
|
||||
|
||||
<action>Focus on official n8n documentation at docs.n8n.io</action>
|
||||
<action>Store relevant migration patterns and node configurations</action>
|
||||
</step>
|
||||
|
||||
<step n="3" goal="Verify Migration Approach">
|
||||
<action>Summarize migration strategy based on documentation:</action>
|
||||
<action>- n8n equivalents for {{source_platform}} features</action>
|
||||
<action>- Required node types and configurations</action>
|
||||
<action>- Data transformation needs</action>
|
||||
<action>- Any migration challenges or limitations</action>
|
||||
|
||||
<action>Inform user: "Based on n8n documentation, I've identified the migration path from {{source_platform}}."</action>
|
||||
</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,31 @@
|
|||
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
|
||||
|
||||
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,336 @@
|
|||
# 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">
|
||||
<critical>Understand WHY the user wants to modify the workflow, not just WHAT to change</critical>
|
||||
|
||||
<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 problem are you trying to solve by modifying this workflow?"</action>
|
||||
<action>Examples: "It's not handling errors properly", "Need to add Slack notifications", "Missing data validation"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{problem_to_solve}}</action>
|
||||
|
||||
<action>Ask Question 3: "What's currently not working or missing?"</action>
|
||||
<action>Encourage specific details about the issue or gap</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{current_issue}}</action>
|
||||
|
||||
<action>Ask Question 4: "What should the workflow do after these changes?"</action>
|
||||
<action>Focus on the desired behavior and outcome</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{desired_behavior}}</action>
|
||||
|
||||
<action>Ask Question 5: "Are there any specific nodes, integrations, or logic you want to change?"</action>
|
||||
<action>Examples: "Add a Slack node after approval", "Change the IF condition to check status", "Remove the delay node"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{specific_changes}}</action>
|
||||
|
||||
<action>Summarize understanding:</action>
|
||||
<action>- Problem: {{problem_to_solve}}</action>
|
||||
<action>- Current Issue: {{current_issue}}</action>
|
||||
<action>- Desired Behavior: {{desired_behavior}}</action>
|
||||
<action>- Specific Changes: {{specific_changes}}</action>
|
||||
|
||||
<action>Ask: "Does this capture what you need?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Yes - Proceed with modifications
|
||||
2. No - Let me clarify
|
||||
</action>
|
||||
<action>WAIT for user selection (1-2)</action>
|
||||
<check if="selection is 2">
|
||||
<action>Ask: "What needs clarification?"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Update relevant variables</action>
|
||||
<action>Repeat summary and confirmation</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="Research n8n Documentation for Modifications">
|
||||
<critical>Search for n8n documentation relevant to the modifications needed</critical>
|
||||
|
||||
<action>Inform user: "Researching n8n documentation for your modifications..."</action>
|
||||
|
||||
<action>Perform web search based on modification needs:</action>
|
||||
<action>- Problem to solve: {{problem_to_solve}}</action>
|
||||
<action>- Specific changes: {{specific_changes}}</action>
|
||||
<action>- Desired behavior: {{desired_behavior}}</action>
|
||||
|
||||
<action>Search queries to use:</action>
|
||||
<action>- "n8n [specific feature] documentation"</action>
|
||||
<action>- "n8n [node type] configuration"</action>
|
||||
<action>- "n8n workflow modification best practices"</action>
|
||||
<action>- "n8n [integration] setup"</action>
|
||||
|
||||
<action>Focus on official n8n documentation at docs.n8n.io</action>
|
||||
<action>Store relevant node configurations and modification patterns</action>
|
||||
</step>
|
||||
|
||||
<step n="5" goal="Verify Modification Approach">
|
||||
<action>Summarize modification strategy based on documentation:</action>
|
||||
<action>- How to implement {{desired_behavior}}</action>
|
||||
<action>- Required node changes or additions</action>
|
||||
<action>- Configuration updates needed</action>
|
||||
<action>- Best practices for these modifications</action>
|
||||
|
||||
<action>Inform user: "Based on n8n documentation, I've identified how to implement your changes."</action>
|
||||
</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,29 @@
|
|||
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
|
||||
|
||||
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,475 @@
|
|||
# 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">
|
||||
<critical>Understand the REAL PROBLEMS the user is experiencing, not just generic optimization goals</critical>
|
||||
|
||||
<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 problems are you experiencing with this workflow?"</action>
|
||||
<action>Examples: "Takes too long to run", "Fails frequently", "Hard to understand", "Doesn't handle errors well"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{problems_experienced}}</action>
|
||||
|
||||
<action>Ask Question 3: "What's the business impact of these problems?"</action>
|
||||
<action>Examples: "Delays customer responses", "Wastes team time", "Causes data issues", "Costs money"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{business_impact}}</action>
|
||||
|
||||
<action>Ask Question 4: "What would 'better' look like for this workflow?"</action>
|
||||
<action>Focus on desired outcomes: "Faster execution", "More reliable", "Easier to maintain", "Better error recovery"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Store in {{desired_improvements}}</action>
|
||||
|
||||
<action>Ask Question 5: "Are there specific areas you want me to focus on?"</action>
|
||||
<action>Present numbered options (can select multiple):
|
||||
1. Performance - Speed and efficiency
|
||||
2. Reliability - Error handling and retries
|
||||
3. Maintainability - Code quality and structure
|
||||
4. Security - Credential and data handling
|
||||
5. All - Comprehensive review
|
||||
6. Let you decide - Analyze and recommend
|
||||
</action>
|
||||
<action>WAIT for user selection (1-6 or multiple)</action>
|
||||
<action>Store selections in {{optimization_focus}}</action>
|
||||
|
||||
<action>Summarize understanding:</action>
|
||||
<action>- Problems: {{problems_experienced}}</action>
|
||||
<action>- Business Impact: {{business_impact}}</action>
|
||||
<action>- Desired Improvements: {{desired_improvements}}</action>
|
||||
<action>- Focus Areas: {{optimization_focus}}</action>
|
||||
|
||||
<action>Ask: "Does this capture your optimization needs?"</action>
|
||||
<action>Present numbered options:
|
||||
1. Yes - Proceed with analysis
|
||||
2. No - Let me clarify
|
||||
</action>
|
||||
<action>WAIT for user selection (1-2)</action>
|
||||
<check if="selection is 2">
|
||||
<action>Ask: "What needs clarification?"</action>
|
||||
<action>WAIT for user input</action>
|
||||
<action>Update relevant variables</action>
|
||||
<action>Repeat summary and confirmation</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="Research n8n Best Practices and Optimization">
|
||||
<critical>Search for n8n documentation on optimization and best practices</critical>
|
||||
|
||||
<action>Inform user: "Researching n8n best practices and optimization techniques..."</action>
|
||||
|
||||
<action>Perform web search for:</action>
|
||||
<action>1. n8n performance optimization</action>
|
||||
<action>2. n8n error handling best practices</action>
|
||||
<action>3. n8n workflow structure patterns</action>
|
||||
<action>4. n8n security best practices</action>
|
||||
<action>5. Solutions for: {{problems_experienced}}</action>
|
||||
|
||||
<action>Search queries to use:</action>
|
||||
<action>- "n8n workflow optimization best practices"</action>
|
||||
<action>- "n8n performance tuning"</action>
|
||||
<action>- "n8n error handling patterns"</action>
|
||||
<action>- "n8n workflow security"</action>
|
||||
<action>- "n8n [specific problem] solution"</action>
|
||||
|
||||
<action>Focus on official n8n documentation at docs.n8n.io</action>
|
||||
<action>Store relevant optimization techniques and best practices</action>
|
||||
</step>
|
||||
|
||||
<step n="4" goal="Verify Optimization Strategy">
|
||||
<action>Summarize optimization approach based on documentation:</action>
|
||||
<action>- Solutions for {{problems_experienced}}</action>
|
||||
<action>- Best practices to apply</action>
|
||||
<action>- Performance improvements available</action>
|
||||
<action>- Expected impact on {{business_impact}}</action>
|
||||
|
||||
<action>Inform user: "Based on n8n best practices, I've identified optimization opportunities."</action>
|
||||
</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,28 @@
|
|||
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
|
||||
|
||||
default_output_file: "" # Will use existing file location
|
||||
|
||||
standalone: true
|
||||
web_bundle: false
|
||||
Loading…
Reference in New Issue