OpenClaw Skillv2.0.0

n8n

thomasansemsby thomasansems
Deploy on EasyClawdfrom $14.9/mo

Manage n8n workflows and automations via API. Use when working with n8n workflows, executions, or automation tasks - listing workflows, activating/deactivating, checking execution status, manually triggering workflows, or debugging automation issues.

How to use this skill

OpenClaw skills run inside an OpenClaw container. EasyClawd deploys and manages yours — no server setup needed.

  1. Sign up on EasyClawd (2 minutes)
  2. Connect your Telegram bot
  3. Install n8n from the skills panel
Get started — from $14.9/mo
37stars
11,211downloads
106installs
0comments
4versions

Latest Changelog

# Changelog - n8n Enhanced Workflow Management Skill

## Version 2.0.0 - 10 Feb  2026

### šŸŽ‰ Major Enhancement Release

Complete redesign of the n8n skill with comprehensive workflow lifecycle management capabilities.

### ✨ New Features

#### Testing & Validation
- **Structure Validation:** `n8n_tester.py` validates workflow integrity
  - Node and connection validation
  - Credential checking
  - Configuration verification
  - Flow analysis
- **Dry-Run Testing:** Test workflows with sample data before activation
- **Test Suites:** Run multiple test cases against workflows
- **Validation Reports:** Human-readable test reports with errors and warnings

#### Execution Monitoring
- **Enhanced Execution Tracking:** Real-time execution monitoring
- **Detailed Statistics:** Success/failure rates, execution patterns
- **Error Analysis:** Identify and categorize failure patterns
- **Retry Logic:** Built-in retry support for failed executions

#### Performance Optimization
- **Performance Analysis:** `n8n_optimizer.py` provides comprehensive metrics
  - Execution metrics (success rate, failure patterns)
  - Node analysis (complexity, expensive operations)
  - Connection analysis (parallel paths, bottlenecks)
  - Performance scoring (0-100)
- **Bottleneck Detection:** Identify workflow performance issues
  - Sequential expensive operations
  - High failure rates
  - Missing error handling
- **Optimization Suggestions:** Actionable recommendations
  - Parallel execution opportunities
  - Caching strategies
  - Batch processing
  - Error handling improvements
  - Complexity reduction
- **Optimization Reports:** Human-readable performance reports

### šŸ“ API Extensions

#### n8n_api.py Enhancements
- `validate_workflow()` - Validate workflow structure
- `dry_run_workflow()` - Test workflow with mock data
- `get_workflow_statistics()` - Get execution statistics
- `analyze_workflow_performance()` - Performance analysis
- CLI support for `create`, `validate`, and `stats` commands

#### New Modules
- **n8n_tester.py** - Testing and validation
  - Structure validation
  - Dry-run execution
  - Test suite runner
  - Report generation
- **n8n_optimizer.py** - Performance optimization
  - Performance analysis
  - Bottleneck detection
  - Optimization suggestions
  - Report generation

### šŸ“š Documentation

#### New Documentation
- **README.md** - Quick start guide with examples
- **SKILL.md** - Comprehensive documentation (16KB)
  - All CLI commands
  - Python API examples
  - Common workflows
  - Best practices
  - Troubleshooting guide
- **templates/README.md** - Template documentation
  - Template descriptions
  - Configuration guides
  - Test data examples
- **CHANGELOG.md** - This file

#### Updated Documentation
- Enhanced quick reference
- Added validation examples
- Performance optimization guides
- Template usage examples

### šŸ—‚ļø File Structure

```
~/clawd/skills/n8n/
ā”œā”€ā”€ README.md                   # Quick start guide
ā”œā”€ā”€ SKILL.md                    # Comprehensive documentation
ā”œā”€ā”€ CHANGELOG.md                # This file
ā”œā”€ā”€ scripts/
│   ā”œā”€ā”€ n8n_api.py             # Core API client (extended)
│   ā”œā”€ā”€ n8n_tester.py          # NEW: Testing & validation
│   └── n8n_optimizer.py       # NEW: Performance optimization
└── references/
    └── api.md
```

### šŸ”§ Technical Improvements

- **Modular Design:** Separated concerns into specialized modules
- **Error Handling:** Comprehensive error checking and reporting
- **Import Flexibility:** Support for both direct and module imports
- **Validation Logic:** Standalone validation without API dependency
- **Performance Metrics:** Multi-dimensional workflow analysis
- **Extensible Templates:** Easy to add new workflow templates

### šŸ“Š Metrics & Analysis

New performance metrics tracked:
- Execution success/failure rates
- Node complexity scores (0-100)
- Performance scores (0-100)
- Health status (excellent/good/fair/poor)
- Bottleneck severity levels
- Optimization priorities (high/medium/low)

### šŸŽÆ Use Cases

The enhanced skill now supports:
1. **Rapid Prototyping:** Deploy templates and test within minutes
2. **Quality Assurance:** Validate and test before production deployment
3. **Performance Tuning:** Identify and resolve bottlenecks
4. **Continuous Monitoring:** Track workflow health over time
5. **Best Practices:** Built-in optimization recommendations

### šŸ”„ Migration from v1.0

No breaking changes. All v1.0 functionality preserved and enhanced:
- `list-workflows` - Still works
- `get-workflow` - Still works
- `activate` / `deactivate` - Still works
- `list-executions` / `get-execution` - Still works
- `execute` - Still works

New commands added:
- `create` - Create workflows from templates or files
- `validate` - Validate workflow structure
- `stats` - Get execution statistics

### šŸ› Bug Fixes

- Fixed import issues in testing module
- Added standalone validation for file-based workflows
- Improved error messages for missing credentials
- Enhanced connection validation logic

### ⚔ Performance

- Validation runs without API calls for file-based workflows
- Efficient execution monitoring with configurable polling
- Optimized statistics calculation for large execution histories

### šŸ” Security

- No credentials stored in templates (placeholders only)
- Environment variable-based authentication
- Validation runs safely without modifying workflows

### šŸ“¦ Dependencies

No new dependencies
- `requests` (existing)
- `json`, `sys`, `argparse`, `pathlib`, `typing` (standard library)

### šŸš€ Future Roadmap

Planned for future releases:
- Additional workflow templates (10+ total)
- Workflow versioning and rollback
- A/B testing framework
- Cost tracking and optimization
- Workflow dependencies and orchestration
- Visual workflow builder web UI
- AI-powered workflow optimization
- Integration testing framework

### šŸ‘„ Contributors

- Enhanced n8n skill for Clawdbot/Thomas
- Based on requirements for SaaS automation workflows

### šŸ“„ License

Part of the Clawdbot skills library.

---

## Version 1.0.0 - January 2026

### Initial Release

Basic n8n API integration:
- List workflows
- Get workflow details
- Activate/deactivate workflows
- List and get executions
- Manual workflow execution
- Python API client
- Basic CLI interface

Tags

latest: 2.0.0

Skill Documentation

---
name: n8n
description: Manage n8n workflows and automations via API. Use when working with n8n workflows, executions, or automation tasks - listing workflows, activating/deactivating, checking execution status, manually triggering workflows, or debugging automation issues.
metadata: {"openclaw":{"emoji":"\u2699\ufe0f","requires":{"env":["N8N_API_KEY","N8N_BASE_URL"]},"primaryEnv":"N8N_API_KEY"}}
---

# n8n Workflow Management

Comprehensive workflow automation management for n8n platform with creation, testing, execution monitoring, and performance optimization capabilities.

## āš ļø CRITICAL: Workflow Creation Rules

**When creating n8n workflows, ALWAYS:**

1. āœ… **Generate COMPLETE workflows** with all functional nodes
2. āœ… **Include actual HTTP Request nodes** for API calls (ImageFX, Gemini, Veo, Suno, etc.)
3. āœ… **Add Code nodes** for data transformation and logic
4. āœ… **Create proper connections** between all nodes
5. āœ… **Use real node types** (n8n-nodes-base.httpRequest, n8n-nodes-base.code, n8n-nodes-base.set)

**NEVER:**
- āŒ Create "Setup Instructions" placeholder nodes
- āŒ Generate workflows with only TODO comments
- āŒ Make incomplete workflows requiring manual node addition
- āŒ Use text-only nodes as substitutes for real functionality

**Example GOOD workflow:**
```
Manual Trigger → Set Config → HTTP Request (API call) → Code (parse) → Response
```

**Example BAD workflow:**
```
Manual Trigger → Code ("Add HTTP nodes here, configure APIs...")
```

Always build the complete, functional workflow with all necessary nodes configured and connected.

## Setup

**Required environment variables:**
- `N8N_API_KEY` — Your n8n API key (Settings → API in the n8n UI)
- `N8N_BASE_URL` — Your n8n instance URL

**Configure credentials via OpenClaw settings:**

Add to `~/.config/openclaw/settings.json`:
```json
{
  "skills": {
    "n8n": {
      "env": {
        "N8N_API_KEY": "your-api-key-here",
        "N8N_BASE_URL": "your-n8n-url-here"
      }
    }
  }
}
```

Or set per-session (do **not** persist secrets in shell rc files):
```bash
export N8N_API_KEY="your-api-key-here"
export N8N_BASE_URL="your-n8n-url-here"
```

**Verify connection:**
```bash
python3 scripts/n8n_api.py list-workflows --pretty
```

> **Security note:** Never store API keys in plaintext shell config files (`~/.bashrc`, `~/.zshrc`). Use the OpenClaw settings file or a secure secret manager.

## Quick Reference

### Workflow Management

#### List Workflows
```bash
python3 scripts/n8n_api.py list-workflows --pretty
python3 scripts/n8n_api.py list-workflows --active true --pretty
```

#### Get Workflow Details
```bash
python3 scripts/n8n_api.py get-workflow --id <workflow-id> --pretty
```

#### Create Workflows
```bash
# From JSON file
python3 scripts/n8n_api.py create --from-file workflow.json
```

#### Activate/Deactivate
```bash
python3 scripts/n8n_api.py activate --id <workflow-id>
python3 scripts/n8n_api.py deactivate --id <workflow-id>
```

### Testing & Validation

#### Validate Workflow Structure
```bash
# Validate existing workflow
python3 scripts/n8n_tester.py validate --id <workflow-id>

# Validate from file
python3 scripts/n8n_tester.py validate --file workflow.json --pretty

# Generate validation report
python3 scripts/n8n_tester.py report --id <workflow-id>
```

#### Dry Run Testing
```bash
# Test with data
python3 scripts/n8n_tester.py dry-run --id <workflow-id> --data '{"email": "[email protected]"}'

# Test with data file
python3 scripts/n8n_tester.py dry-run --id <workflow-id> --data-file test-data.json

# Full test report (validation + dry run)
python3 scripts/n8n_tester.py dry-run --id <workflow-id> --data-file test.json --report
```

#### Test Suite
```bash
# Run multiple test cases
python3 scripts/n8n_tester.py test-suite --id <workflow-id> --test-suite test-cases.json
```

### Execution Monitoring

#### List Executions
```bash
# Recent executions (all workflows)
python3 scripts/n8n_api.py list-executions --limit 10 --pretty

# Specific workflow executions
python3 scripts/n8n_api.py list-executions --id <workflow-id> --limit 20 --pretty
```

#### Get Execution Details
```bash
python3 scripts/n8n_api.py get-execution --id <execution-id> --pretty
```

#### Manual Execution
```bash
# Trigger workflow
python3 scripts/n8n_api.py execute --id <workflow-id>

# Execute with data
python3 scripts/n8n_api.py execute --id <workflow-id> --data '{"key": "value"}'
```

### Performance Optimization

#### Analyze Performance
```bash
# Full performance analysis
python3 scripts/n8n_optimizer.py analyze --id <workflow-id> --pretty

# Analyze specific period
python3 scripts/n8n_optimizer.py analyze --id <workflow-id> --days 30 --pretty
```

#### Get Optimization Suggestions
```bash
# Priority-ranked suggestions
python3 scripts/n8n_optimizer.py suggest --id <workflow-id> --pretty
```

#### Generate Optimization Report
```bash
# Human-readable report with metrics, bottlenecks, and suggestions
python3 scripts/n8n_optimizer.py report --id <workflow-id>
```

#### Get Workflow Statistics
```bash
# Execution statistics
python3 scripts/n8n_api.py stats --id <workflow-id> --days 7 --pretty
```

## Python API

### Basic Usage

```python
from scripts.n8n_api import N8nClient

client = N8nClient()

# List workflows
workflows = client.list_workflows(active=True)

# Get workflow
workflow = client.get_workflow('workflow-id')

# Create workflow
new_workflow = client.create_workflow({
    'name': 'My Workflow',
    'nodes': [...],
    'connections': {...}
})

# Activate/deactivate
client.activate_workflow('workflow-id')
client.deactivate_workflow('workflow-id')

# Executions
executions = client.list_executions(workflow_id='workflow-id', limit=10)
execution = client.get_execution('execution-id')

# Execute workflow
result = client.execute_workflow('workflow-id', data={'key': 'value'})
```

### Validation & Testing

```python
from scripts.n8n_api import N8nClient
from scripts.n8n_tester import WorkflowTester

client = N8nClient()
tester = WorkflowTester(client)

# Validate workflow
validation = tester.validate_workflow(workflow_id='123')
print(f"Valid: {validation['valid']}")
print(f"Errors: {validation['errors']}")
print(f"Warnings: {validation['warnings']}")

# Dry run
result = tester.dry_run(
    workflow_id='123',
    test_data={'email': '[email protected]'}
)
print(f"Status: {result['status']}")

# Test suite
test_cases = [
    {'name': 'Test 1', 'input': {...}, 'expected': {...}},
    {'name': 'Test 2', 'input': {...}, 'expected': {...}}
]
results = tester.test_suite('123', test_cases)
print(f"Passed: {results['passed']}/{results['total_tests']}")

# Generate report
report = tester.generate_test_report(validation, result)
print(report)
```

### Performance Optimization

```python
from scripts.n8n_optimizer import WorkflowOptimizer

optimizer = WorkflowOptimizer()

# Analyze performance
analysis = optimizer.analyze_performance('workflow-id', days=7)
print(f"Performance Score: {analysis['performance_score']}/100")
print(f"Health: {analysis['execution_metrics']['health']}")

# Get suggestions
suggestions = optimizer.suggest_optimizations('workflow-id')
print(f"Priority Actions: {len(suggestions['priority_actions'])}")
print(f"Quick Wins: {len(suggestions['quick_wins'])}")

# Generate report
report = optimizer.generate_optimization_report(analysis)
print(report)
```

## Common Workflows

### 1. Validate and Test Workflow

```bash
# Validate workflow structure
python3 scripts/n8n_tester.py validate --id <workflow-id> --pretty

# Test with sample data
python3 scripts/n8n_tester.py dry-run --id <workflow-id> \
  --data '{"email": "[email protected]", "name": "Test User"}'

# If tests pass, activate
python3 scripts/n8n_api.py activate --id <workflow-id>
```

### 2. Debug Failed Workflow

```bash
# Check recent executions
python3 scripts/n8n_api.py list-executions --id <workflow-id> --limit 10 --pretty

# Get specific execution details
python3 scripts/n8n_api.py get-execution --id <execution-id> --pretty

#
Read full documentation on ClawHub
Security scan, version history, and community comments: view on ClawHub