Initial backup 2026-02-17

This commit is contained in:
Krilly
2026-02-17 15:50:53 +00:00
commit 8902a93add
941 changed files with 131420 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
{
"version": 1,
"registry": "https://clawhub.ai",
"slug": "n8n-workflow-automation",
"installedVersion": "1.0.0",
"installedAt": 1770184118359
}

View File

@@ -0,0 +1,94 @@
---
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 wont 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.

View File

@@ -0,0 +1,32 @@
# n8n Workflow Runbook Template
## Purpose
- What the workflow does and why it exists.
## Triggers
- Cron / Webhook / Manual
- Schedule, timezone, and expected frequency.
## Inputs
- Source systems and credentials (reference env vars only).
## Outputs
- Where results go (email, Google Sheet/Drive, database), including file naming.
## Idempotency
- Dedup key:
- Safe re-run behavior:
## Error handling
- Retry policy:
- Failure notifications:
- Review queue link/location:
## Logging & audit
- Run ID:
- What is logged per run:
- Where logs are stored:
## Operational checks
- Expected counts/thresholds:
- “Stop the line” conditions:

View File

@@ -0,0 +1,37 @@
#!/bin/bash
# Connect to your self-hosted n8n
echo "🔄 n8n Workflow Automation"
echo "=========================="
echo ""
# Check if n8n is accessible locally
if curl -s http://localhost:5678/healthz > /dev/null 2>&1; then
echo "✅ Local n8n detected on localhost:5678"
export N8N_HOST="http://localhost:5678"
elif curl -s http://n8n:5678/healthz > /dev/null 2>&1; then
echo "✅ Docker n8n detected on n8n:5678"
export N8N_HOST="http://n8n:5678"
else
echo "⚠️ Couldn't auto-detect n8n. What's your n8n URL?"
echo " Examples: http://localhost:5678 or http://n8n.yourdomain.com"
read -p "n8n URL: " N8N_HOST
export N8N_HOST
fi
# Test connection
echo ""
echo "Testing connection to $N8N_HOST..."
if curl -s "$N8N_HOST/healthz" > /dev/null 2>&1; then
echo "✅ Connected to n8n!"
echo ""
echo "What workflow do you want to build?"
echo "Example ideas:"
echo " • 'When I star an email, create a Notion task'"
echo " • 'Daily morning briefing: check calendar + email + weather'"
echo " • 'When Home Assistant detects motion, send me a Telegram'"
echo " • 'Weekly report: aggregate data from multiple sources'"
else
echo "❌ Could not connect to n8n"
echo "Make sure your n8n instance is running and accessible"
fi