home / skills / openclaw / skills / n8n-workflow-automation

n8n-workflow-automation skill

/skills/kowl64/n8n-workflow-automation

This skill designs and outputs auditable n8n workflow JSON with triggers, idempotency, logging, retries, and HITL review.

npx playbooks add skill openclaw/skills --skill n8n-workflow-automation

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
3.9 KB
---
name: n8n-workflow-automation
description: Designs and outputs n8n workflow JSON with robust triggers, idempotency, error handling, logging, retries, and human-in-the-loop review queues. Use when you need an auditable automation that won’t silently fail.
---

# n8n workflow automation with retries, logging, and review queues

## PURPOSE
Designs and outputs n8n workflow JSON with robust triggers, idempotency, error handling, logging, retries, and human-in-the-loop review queues.

## WHEN TO USE
- TRIGGERS:
  - Build an n8n workflow that runs every Monday and emails the compliance summary.
  - Add error handling and retries to this workflow, plus a review queue for failures.
  - Create a webhook workflow that logs every run and writes a status row to a tracker.
  - Make this n8n flow idempotent so it does not duplicate records when it reruns.
  - Instrument this workflow with audit logs and a human approval step.
- DO NOT USE WHEN…
  - You need code-only automation without n8n (use a scripting/CI skill).
  - You need to bypass security controls or hide audit trails.
  - You need to purchase or recommend prohibited items/services.

## INPUTS
- REQUIRED:
  - Workflow intent: trigger type + schedule/timezone + success criteria.
  - Targets: where to write results (email/Drive/Sheet/DB) and required fields.
- OPTIONAL:
  - Existing n8n workflow JSON to modify.
  - Sample payloads / example records.
  - Definition of dedup keys (what makes a record unique).
- EXAMPLES:
  - Cron: Monday 08:00 Europe/London; send summary email + Drive upload
  - Webhook: receive JSON; route to folders

## OUTPUTS
- Default (read-only): a workflow design spec (nodes, data contracts, failure modes).
- If explicitly requested: `workflow.json` (n8n importable JSON) + `runbook.md` (from template).
Success = workflow is idempotent, logs every run, retries safely, and routes failures to a review queue.


## WORKFLOW
1. Clarify trigger:
   - Cron/webhook/manual; schedule/timezone; concurrency expectations.
2. Define data contract:
   - input schema, required fields, and validation rules.
3. Design idempotency:
   - choose dedup key(s) and storage (DB/Sheet) to prevent duplicates on retries.
4. Add observability:
   - generate `run_id`, log start/end, store status row and error details.
5. Implement error handling:
   - per-node error branches, retry with backoff, and final failure notification.
6. Add human-in-the-loop (HITL) review queue:
   - write failed items to a queue (Sheet/DB) and require approval to reprocess.
7. “No silent failure” gates:
   - if counts/thresholds fail, stop workflow and alert.
8. Output:
   - If asked for JSON: produce importable n8n workflow JSON + runbook.
9. STOP AND ASK THE USER if:
   - destination systems are unknown,
   - no dedup key exists,
   - credential strategy (env vars) is not specified,
   - the workflow needs privileged access not yet approved.


## OUTPUT FORMAT
If outputting **n8n workflow JSON**, conform to:

```json
{
  "name": "<workflow name>",
  "nodes": [ { "name": "Trigger", "type": "n8n-nodes-base.cron", "parameters": {}, "position": [0,0] } ],
  "connections": {},
  "settings": {},
  "active": false
}
```

Also output `runbook.md` using `assets/runbook-template.md`.


## SAFETY & EDGE CASES
- Read-only by default; only emit workflow JSON when explicitly requested.
- Do not include secrets in JSON; reference env vars/credential names only.
- Include audit logging + failure notifications; avoid workflows that can silently drop data.
- Prefer least privilege: call only required APIs and minimize scopes.


## EXAMPLES
- Input: “Cron every Monday, email compliance summary, retry failures.”  
  Output: Node map + `workflow.json` with Cron → Fetch → Aggregate → Email, plus error branches to review queue.

- Input: “Webhook that logs runs and writes status row.”  
  Output: Webhook → Validate → Process → Append status row; on error → log + notify + queue.

Overview

This skill designs and outputs n8n workflow JSON and a runbook focused on resilient, auditable automation. It emphasizes robust triggers, idempotency, structured logging, retries with backoff, and human-in-the-loop review queues so automations do not silently fail.

How this skill works

Given a workflow intent and targets, the skill clarifies trigger type and schedule, defines the input data contract, and chooses deduplication keys and storage. It then produces a node-level design with per-node error branches, retry policies, run_id-based observability, status rows, and a review queue for failed items. By default it returns a read-only design spec; it emits importable n8n JSON and a runbook only when explicitly requested and when credentials/destinations are specified.

When to use it

  • Schedule recurring jobs (cron) that must be auditable and retry safely (e.g., weekly compliance emails).
  • Build webhook-driven flows that log every run, write status rows, and avoid duplicate processing.
  • Add idempotency, error handling, and review queues to existing n8n workflows to prevent silent failures.
  • Create human-in-the-loop approval steps for any item requiring manual review before reprocessing.

Best practices

  • Always specify a deduplication key and backing store (DB or Sheet) to make flows idempotent.
  • Reference credentials via environment variable names or n8n credential references; never embed secrets.
  • Instrument each run with a generated run_id and write start/end status rows with error details.
  • Use per-node retry with exponential backoff and a final failure branch that enqueues items for human review.
  • Stop and alert when aggregate thresholds are breached instead of allowing silent degradation.

Example use cases

  • Cron every Monday 08:00 Europe/London: aggregate compliance metrics, upload CSV to Drive, email summary, retry on transient failures.
  • Webhook: receive inbound JSON, validate schema, deduplicate by external_id, write status row, and log run_id.
  • Transform pipeline: fetch records from DB, process, write outputs to target system, and push failures to a review sheet for approval.
  • Ad-hoc manual trigger for sensitive tasks that require human approval before final commit.

FAQ

Will you output workflow JSON by default?

No. The skill returns a read-only design unless you explicitly request n8n importable JSON and provide destination/credential details.

How are secrets handled in generated JSON?

Secrets are never embedded. Nodes reference credential names or env var placeholders; you must configure credentials in n8n.