← 返回 Skills 市场
droidhackzor

n8n Workflow Management

作者 droidhackzor · GitHub ↗ · v0.1.0 · MIT-0
cross-platform ✓ 安全检测通过
118
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install n8n-session-relay-management-requires-selfbuilt-relay-docker
功能描述
Manage n8n workflows and automations via API. Use when working with n8n workflows, executions, or automation tasks - listing workflows, activating/deactivati...
使用说明 (SKILL.md)

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:

{
  "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):

export N8N_API_KEY="your-api-key-here"
export N8N_BASE_URL="your-n8n-url-here"

Verify connection:

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

python3 scripts/n8n_api.py list-workflows --pretty
python3 scripts/n8n_api.py list-workflows --active true --pretty

Get Workflow Details

python3 scripts/n8n_api.py get-workflow --id \x3Cworkflow-id> --pretty

Create Workflows

# From JSON file
python3 scripts/n8n_api.py create --from-file workflow.json

Activate/Deactivate

python3 scripts/n8n_api.py activate --id \x3Cworkflow-id>
python3 scripts/n8n_api.py deactivate --id \x3Cworkflow-id>

Testing & Validation

Validate Workflow Structure

# Validate existing workflow
python3 scripts/n8n_tester.py validate --id \x3Cworkflow-id>

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

# Generate validation report
python3 scripts/n8n_tester.py report --id \x3Cworkflow-id>

Dry Run Testing

# Test with data
python3 scripts/n8n_tester.py dry-run --id \x3Cworkflow-id> --data '{"email": "[email protected]"}'

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

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

Test Suite

# Run multiple test cases
python3 scripts/n8n_tester.py test-suite --id \x3Cworkflow-id> --test-suite test-cases.json

Execution Monitoring

List Executions

# 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 \x3Cworkflow-id> --limit 20 --pretty

Get Execution Details

python3 scripts/n8n_api.py get-execution --id \x3Cexecution-id> --pretty

Manual Execution

# Trigger workflow
python3 scripts/n8n_api.py execute --id \x3Cworkflow-id>

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

Performance Optimization

Analyze Performance

# Full performance analysis
python3 scripts/n8n_optimizer.py analyze --id \x3Cworkflow-id> --pretty

# Analyze specific period
python3 scripts/n8n_optimizer.py analyze --id \x3Cworkflow-id> --days 30 --pretty

Get Optimization Suggestions

# Priority-ranked suggestions
python3 scripts/n8n_optimizer.py suggest --id \x3Cworkflow-id> --pretty

Generate Optimization Report

# Human-readable report with metrics, bottlenecks, and suggestions
python3 scripts/n8n_optimizer.py report --id \x3Cworkflow-id>

Get Workflow Statistics

# Execution statistics
python3 scripts/n8n_api.py stats --id \x3Cworkflow-id> --days 7 --pretty

Python API

Basic Usage

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

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

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

# Validate workflow structure
python3 scripts/n8n_tester.py validate --id \x3Cworkflow-id> --pretty

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

# If tests pass, activate
python3 scripts/n8n_api.py activate --id \x3Cworkflow-id>

2. Debug Failed Workflow

# Check recent executions
python3 scripts/n8n_api.py list-executions --id \x3Cworkflow-id> --limit 10 --pretty

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

# Validate workflow structure
python3 scripts/n8n_tester.py validate --id \x3Cworkflow-id>

# Generate test report
python3 scripts/n8n_tester.py report --id \x3Cworkflow-id>

# Check for optimization issues
python3 scripts/n8n_optimizer.py report --id \x3Cworkflow-id>

3. Optimize Workflow Performance

# Analyze current performance
python3 scripts/n8n_optimizer.py analyze --id \x3Cworkflow-id> --days 30 --pretty

# Get actionable suggestions
python3 scripts/n8n_optimizer.py suggest --id \x3Cworkflow-id> --pretty

# Generate comprehensive report
python3 scripts/n8n_optimizer.py report --id \x3Cworkflow-id>

# Review execution statistics
python3 scripts/n8n_api.py stats --id \x3Cworkflow-id> --days 30 --pretty

# Test optimizations with dry run
python3 scripts/n8n_tester.py dry-run --id \x3Cworkflow-id> --data-file test-data.json

4. Monitor Workflow Health

# Check active workflows
python3 scripts/n8n_api.py list-workflows --active true --pretty

# Review recent execution status
python3 scripts/n8n_api.py list-executions --limit 20 --pretty

# Get statistics for each critical workflow
python3 scripts/n8n_api.py stats --id \x3Cworkflow-id> --pretty

# Generate health reports
python3 scripts/n8n_optimizer.py report --id \x3Cworkflow-id>

Validation Checks

The testing module performs comprehensive validation:

Structure Validation

  • ✓ Required fields present (nodes, connections)
  • ✓ All nodes have names and types
  • ✓ Connection targets exist
  • ✓ No disconnected nodes (warning)

Configuration Validation

  • ✓ Nodes requiring credentials are configured
  • ✓ Required parameters are set
  • ✓ HTTP nodes have URLs
  • ✓ Webhook nodes have paths
  • ✓ Email nodes have content

Flow Validation

  • ✓ Workflow has trigger nodes
  • ✓ Proper execution flow
  • ✓ No circular dependencies
  • ✓ End nodes identified

Optimization Analysis

The optimizer analyzes multiple dimensions:

Execution Metrics

  • Total executions
  • Success/failure rates
  • Health status (excellent/good/fair/poor)
  • Error patterns

Performance Metrics

  • Node count and complexity
  • Connection patterns
  • Expensive operations (API calls, database queries)
  • Parallel execution opportunities

Bottleneck Detection

  • Sequential expensive operations
  • High failure rates
  • Missing error handling
  • Rate limit issues

Optimization Opportunities

  • Parallel Execution: Identify nodes that can run concurrently
  • Caching: Suggest caching for repeated API calls
  • Batch Processing: Recommend batching for large datasets
  • Error Handling: Add error recovery mechanisms
  • Complexity Reduction: Split complex workflows
  • Timeout Settings: Configure execution limits

Performance Scoring

Workflows receive a performance score (0-100) based on:

  • Success Rate: Higher is better (50% weight)
  • Complexity: Lower is better (30% weight)
  • Bottlenecks: Fewer is better (critical: -20, high: -10, medium: -5)
  • Optimizations: Implemented best practices (+5 each)

Score interpretation:

  • 90-100: Excellent - Well-optimized
  • 70-89: Good - Minor improvements possible
  • 50-69: Fair - Optimization recommended
  • 0-49: Poor - Significant issues

Best Practices

Development

  1. Plan Structure: Design workflow nodes and connections before building
  2. Validate First: Always validate before deployment
  3. Test Thoroughly: Use dry-run with multiple test cases
  4. Error Handling: Add error nodes for reliability
  5. Documentation: Comment complex logic in Code nodes

Testing

  1. Sample Data: Create realistic test data files
  2. Edge Cases: Test boundary conditions and errors
  3. Incremental: Test each node addition
  4. Regression: Retest after changes
  5. Production-like: Use staging environment that mirrors production

Deployment

  1. Inactive First: Deploy workflows in inactive state
  2. Gradual Rollout: Test with limited traffic initially
  3. Monitor Closely: Watch first executions carefully
  4. Quick Rollback: Be ready to deactivate if issues arise
  5. Document Changes: Keep changelog of modifications

Optimization

  1. Baseline Metrics: Capture performance before changes
  2. One Change at a Time: Isolate optimization impacts
  3. Measure Results: Compare before/after metrics
  4. Regular Reviews: Schedule monthly optimization reviews
  5. Cost Awareness: Monitor API usage and execution costs

Maintenance

  1. Health Checks: Weekly execution statistics review
  2. Error Analysis: Investigate failure patterns
  3. Performance Monitoring: Track execution times
  4. Credential Rotation: Update credentials regularly
  5. Cleanup: Archive or delete unused workflows

Troubleshooting

Authentication Error

Error: N8N_API_KEY not found in environment

Solution: Set environment variable:

export N8N_API_KEY="your-api-key"

Connection Error

Error: HTTP 401: Unauthorized

Solution:

  1. Verify API key is correct
  2. Check N8N_BASE_URL is set correctly
  3. Confirm API access is enabled in n8n

Validation Errors

Validation failed: Node missing 'name' field

Solution: Check workflow JSON structure, ensure all required fields present

Execution Timeout

Status: timeout - Execution did not complete

Solution:

  1. Check workflow for infinite loops
  2. Reduce dataset size for testing
  3. Optimize expensive operations
  4. Set execution timeout in workflow settings

Rate Limiting

Error: HTTP 429: Too Many Requests

Solution:

  1. Add Wait nodes between API calls
  2. Implement exponential backoff
  3. Use batch processing
  4. Check API rate limits

Missing Credentials

Warning: Node 'HTTP_Request' may require credentials

Solution:

  1. Configure credentials in n8n UI
  2. Assign credentials to node
  3. Test connection before activating

API Reference

For detailed n8n REST API documentation, see references/api.md or visit: https://docs.n8n.io/api/

References

  • references/api.md — n8n API reference
  • scripts/n8n_api.py — core API client
  • scripts/n8n_tester.py — validation and dry-run testing
  • scripts/n8n_optimizer.py — performance analysis and suggestions
安全使用建议
This skill appears to do what it says: it interacts with your n8n instance using N8N_API_KEY and N8N_BASE_URL and provides scripts for listing, validating, testing, executing, and optimizing workflows. Before installing or running it: - Verify you trust the source and inspect the included Python scripts (they are present and readable) before running them. They use the n8n API only and do not contain hidden external endpoints. - Understand that 'execute' and 'dry-run' will trigger workflows on your n8n instance; those workflows may call external APIs, send emails, or touch databases depending on their nodes. Review any workflow content you create or execute to avoid unintended side-effects or data leaks. - Avoid pasting long-lived credentials in shell rc files. If you store the N8N_API_KEY in OpenClaw settings.json, ensure that file is stored securely or use a secret manager and least-privilege API key. - Ensure your environment has Python 3 and the 'requests' package available; the skill provides no automated installer for dependencies. If you need a lower blast radius, consider running validation and dry-run operations against a staging n8n instance or use a limited-permission API key.
功能分析
Type: OpenClaw Skill Name: n8n-workflow-management Version: 0.1.0 The n8n-workflow-management skill bundle provides a legitimate set of tools for interacting with the n8n REST API to manage, test, and optimize automation workflows. The Python scripts (n8n_api.py, n8n_tester.py, and n8n_optimizer.py) implement standard API client logic, validation checks, and performance analysis without any evidence of malicious intent, data exfiltration, or unauthorized command execution. The SKILL.md file contains functional instructions designed to improve the quality of AI-generated workflows and does not contain prompt-injection attacks or directives to bypass security controls.
能力评估
Purpose & Capability
Name/description (n8n workflow management) matches the requested env vars (N8N_API_KEY, N8N_BASE_URL) and the included Python scripts that implement an n8n API client, tester, and optimizer. There are no unrelated credentials, binaries, or config paths requested.
Instruction Scope
SKILL.md limits actions to listing, creating, activating/deactivating, testing, and executing workflows via the n8n API. It also instructs running bundled Python scripts. Important behavior: 'dry-run' and 'execute' operations will actually trigger workflows on your n8n instance, which can cause external side-effects (HTTP requests, database operations, emails, etc.) depending on the workflow. That behavior is expected for this skill but is a runtime safety consideration.
Install Mechanism
There is no install spec (instruction-only), which minimizes supply-chain risk. However, the package includes Python scripts that assume a Python 3 runtime and the 'requests' library; the SKILL.md does not include explicit dependency installation instructions. The code will run locally if the agent or user executes the scripts.
Credentials
Only N8N_API_KEY and N8N_BASE_URL are required and they are appropriate for an n8n API client. The SKILL.md warns about secret storage. No unrelated SECRET/TOKEN env vars are requested.
Persistence & Privilege
always is false and model invocation is enabled (the platform default). The SKILL.md recommends adding credentials to the OpenClaw settings.json (persistence in a centralized config). That is normal but means secrets may be stored in the agent settings file if the user follows the example — the user should ensure that file is protected or use a secret manager.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install n8n-session-relay-management-requires-selfbuilt-relay-docker
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /n8n-session-relay-management-requires-selfbuilt-relay-docker 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
Publishing pass: trimmed package clutter and kept references/scripts lean.
元数据
Slug n8n-session-relay-management-requires-selfbuilt-relay-docker
版本 0.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

n8n Workflow Management 是什么?

Manage n8n workflows and automations via API. Use when working with n8n workflows, executions, or automation tasks - listing workflows, activating/deactivati... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 118 次。

如何安装 n8n Workflow Management?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install n8n-session-relay-management-requires-selfbuilt-relay-docker」即可一键安装,无需额外配置。

n8n Workflow Management 是免费的吗?

是的,n8n Workflow Management 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

n8n Workflow Management 支持哪些平台?

n8n Workflow Management 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 n8n Workflow Management?

由 droidhackzor(@droidhackzor)开发并维护,当前版本 v0.1.0。

💬 留言讨论