feat(automacao): adiciona plugin automacao (agents, skills, knowledge e metadados do projeto)

This commit is contained in:
2026-10-28 16:08:22 +00:00
parent 5600fe7ac8
commit de490943e5
33 changed files with 1592 additions and 0 deletions
+144
View File
@@ -0,0 +1,144 @@
---
name: n8n
description: Meta-skill n8n para criação e gestão de workflows na instância automator.descomplicar.pt. Cobre health check, webhooks, schedule (cron), sync de dados, notify (Slack/email/SMS) e chatbots/AI agents (LangChain/RAG). Triggers — n8n, workflow, automação, webhook, schedule, cron, sync, notify, alerta, slack, chatbot, ai agent, langchain, rag, automator, health check n8n.
layer: wiki
---
# /n8n - Meta-skill n8n
Skill unificada para a instância n8n Descomplicar (`https://automator.descomplicar.pt`, MCP `mcp__n8n__*`). Substitui as antigas n8n-chatbot, n8n-health, n8n-notify, n8n-schedule, n8n-sync, n8n-webhook.
## Contexto NotebookLM (sempre antes de executar)
| Notebook | ID |
|----------|-----|
| n8n Deep Research | `f2c809b8-1cb5-4dd0-aa7e-be2cfb6704d1` |
```
mcp__notebooklm__notebook_query({ notebook_id: "f2c809b8-1cb5-4dd0-aa7e-be2cfb6704d1", query: "<adaptar ao pedido>" })
```
## Workflow obrigatório (qualquer criação)
```
1. mcp__n8n__n8n_health_check()
2. mcp__n8n__search_templates({ task: "<webhook|scheduling|data_sync|notification|ai_automation>" })
3. Se template adequado -> mcp__n8n__n8n_deploy_template()
4. Caso contrário, criar do zero seguindo a secção apropriada abaixo
```
---
## 1. Health (diagnóstico)
```
/n8n health # status rápido
/n8n health verbose # diagnóstico completo
```
```js
mcp__n8n__n8n_health_check({ mode: "status" })
mcp__n8n__n8n_health_check({ mode: "diagnostic", verbose: true })
```
Output esperado: status (OK/ERRO), URL, versão MCP, response time, workflows activos.
Erros comuns: Connection refused (n8n offline), 401 (API key inválida — regenerar), timeout (rede). Diagnóstico manual:
```bash
curl -I https://automator.descomplicar.pt
curl -H "X-N8N-API-KEY: $KEY" https://automator.descomplicar.pt/api/v1/workflows
tail ~/.claude/logs/mcp-n8n.log
```
---
## 2. Webhook
Receber dados de sistemas externos.
```
/n8n webhook create <descrição>
/n8n webhook list
/n8n webhook test <workflow_id>
```
```js
mcp__n8n__get_node({ nodeType: "nodes-base.webhook", detail: "standard", includeExamples: true })
mcp__n8n__validate_node({ nodeType: "nodes-base.webhook", config: { httpMethod: "POST", path: "meu-webhook", responseMode: "onReceived" }, mode: "minimal" })
mcp__n8n__n8n_create_workflow({ name: "Webhook - X", nodes: [...], connections: {...}, active: true })
```
Parâmetros: `httpMethod` (GET/POST/PUT/DELETE, default POST), `path` (obrigatório), `authentication` (none/basicAuth/headerAuth), `responseMode` (onReceived/lastNode).
URLs: produção `https://automator.descomplicar.pt/webhook/<path>` | teste `https://automator.descomplicar.pt/webhook-test/<path>`.
Nodes processamento: `nodes-base.set`, `nodes-base.if`, `nodes-base.code`, `nodes-base.httpRequest`.
Teste:
```js
mcp__n8n__n8n_test_workflow({ workflowId: "wf-xxx", inputData: { body: {test:"data"}, headers: {"Content-Type":"application/json"} } })
```
```bash
curl -X POST https://automator.descomplicar.pt/webhook/meu-webhook -H "Content-Type: application/json" -d '{"test":"data"}'
```
Troubleshooting: 404 (workflow não activo), 401 (auth), dados não chegam (responseMode).
---
## 3. Schedule (cron)
Workflows com execução agendada.
```
/n8n schedule create <descrição>
/n8n schedule list
/n8n schedule disable <id>
```
Cron comuns: `0 9 * * *` (diário 9h), `0 9 * * 1-5` (Seg-Sex 9h), `0 */2 * * *` (cada 2h), `*/15 * * * *` (15min), `0 0 1 * *` (dia 1), `0 3 * * 0` (domingos 3h).
```js
mcp__n8n__validate_node({
nodeType: "nodes-base.scheduleTrigger",
config: { rule: { interval: [{ field: "cronExpression", expression: "0 9 * * 1-5" }] }, options: { timezone: "Europe/Lisbon" } },
mode: "minimal"
})
```
Gestão:
```js
mcp__n8n__n8n_update_partial_workflow({ id: "wf-xxx", operations: [{ type: "deactivateWorkflow" }] })
mcp__n8n__n8n_update_partial_workflow({ id: "wf-xxx", operations: [{ type: "activateWorkflow" }] })
mcp__n8n__n8n_executions({ workflowId: "wf-xxx", limit: 10, status: "all" })
```
Exemplos: relatório diário (Schedule -> Postgres -> Set -> Email), backup semanal (Schedule -> SSH -> IF -> Slack), limpeza logs.
Troubleshooting: não executa (workflow inactivo), hora errada (timezone), duplicado (múltiplos triggers).
---
## 4. Sync (sincronização de dados)
```
/n8n sync create <origem> <destino>
/n8n sync list
/n8n sync status <workflow_id>
```
Padrões: One-Way (origem -> transform -> destino), Two-Way (com resolução conflitos), Hub-and-Spoke.
Nodes:
- APIs: `nodes-base.httpRequest`, `nodes-base.webhook`
- BD: `nodes-base.postgres`, `nodes-base.mySql`, `nodes-base.mongoDb`
- Ficheiros: `nodes-base.googleSheets`, `nodes-base.spreadsheetFile`, `nodes-base.ftp`
Estratégias: Full Sync, Incremental (updated_at), Delta (hashes).
Upsert:
```js
{ nodeType: "nodes-base.postgres", config: { operation: "upsert", table: "clientes", columns: "email,nome,empresa", conflictColumns: "email" } }
```
Erros: retry (`{ options: { retry: { maxRetries: 3, retryInterval: 1000 } } }`), D