N8n cli cleanup

From 8Dvibes/n8n-cli · View interactive version

N8n cli cleanup is an AI agent skill from the GitHub repository 8Dvibes/n8n-cli. Find dead workflows, orphaned credentials, and duplicate webhooks for deletion. Outputs safe-to-delete recommendations. NOT tagging -- use /n8n-cli-tag-governance for that. Use for quarterly hygiene sweeps.

How to use this skill

Skill file

/n8n-cli-cleanup — n8n Hygiene & Junk Drawer Triage

Sweep an n8n instance for dead, orphaned, or low-value resources and produce a triage list. Never delete anything without explicit user confirmation.

Procedure

  1. Inventory:
  1. Find dead workflows — for each inactive workflow, check the most recent execution:
  1. Find orphaned credentials — credentials not referenced by any workflow:
  1. Find duplicate webhooks — same path or same node config across multiple workflows. Flag pairs as "potential collision".
  1. Find untagged workflows — workflows with empty tag arrays. Just count them and list the top 10 by node count.
  1. Find archived junk — workflows in archived state older than 60 days. These are ready for deletion.

Output format

## n8n Cleanup Report — [profile name] — [date]

### Summary
- Total workflows: N (X active, Y inactive, Z archived)
- Total credentials: N (M orphaned)
- Untagged workflows: N
- Estimated cleanup wins: N items

### Dead candidates (no executions in 30+ days)
| Name | ID | Last run | Recommendation |
|------|----|----|----|
| ... | ... | ... | Archive / Delete / Investigate |

### Born-dead workflows (zero executions ever)
[table]

### Orphaned credentials
| Name | Type | Created | Recommendation |
| ... | ... | ... | Delete (no workflows reference it) |

### Archived workflows ready for permanent deletion (60+ days)
[table]

### Untagged workflows
[count + sample]

### Recommended next actions
1. ...
2. ...

Safety rules

Tips

⚠️ n8n cloud execution retention

n8n cloud prunes execution history (typically 7-30 days depending on plan). When detecting "dead workflows" via exec list --workflow-id <id>, an empty result does NOT necessarily mean the workflow is dead — its executions may have been pruned. Cross-reference with the workflow's triggerCount, updatedAt, and tag/project context before recommending archival or deletion. Always frame findings as "investigate" not "delete" for instances on cloud.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.