agentleFS
anatolykoptevanatolykoptev/n8n-mcp-agent/skills/workflow-helpers/SKILL.md

workflow-helpers

Skill0 starsChanged 10 months agoMITView on GitHub

Advanced n8n workflow manipulation. Extract webhook URLs, duplicate workflows, add nodes, create with triggers. Use for workflow management automation.

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 7 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create a copy of a workflow, optionally stripping credentials:

    line 53
  2. Distinctive:

    Add a new node to an existing workflow:

    line 88
  3. Distinctive:

    Create a new workflow with a pre-configured trigger:

    line 116
  4. Very specific:

    Strip Credentials for Sharing: Always use stripCredentials: true when duplicating for export

    line 294
  5. Distinctive:

    Use Consistent Positioning: Keep nodes aligned (increment X by 200, Y by 200)

    line 295
  6. Distinctive:

    Name Nodes Clearly: Use descriptive names for each node

    line 296
  7. Distinctive:

    Test After Changes: Verify workflow after adding nodes

    line 297
  8. Distinctive:

    Document Webhooks: Keep track of exposed webhook URLs

    line 298

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Workflow Helpers Skill

This skill provides advanced workflow manipulation capabilities for n8n.

When to Use

  • Getting webhook URLs from workflows
  • Duplicating workflows (with credential stripping for sharing)
  • Adding nodes to existing workflows
  • Creating workflows with specific triggers
  • Getting workflow statistics

Core Methods

Get Webhook URL

Extract the webhook URL from a workflow:

const result = await workflowHelper.getWebhookUrl(workflowId)

Result:

interface WebhookUrlResult {
  success: boolean
  url?: string      // Full webhook URL
  path?: string     // Webhook path
  method?: string   // HTTP method (GET, POST, etc.)
  error?: string
}

Example:

const webhook = await workflowHelper.getWebhookUrl('123')

if (webhook.success) {
  console.log(`URL: ${webhook.url}`)
  // https://n8n.example.com/webhook/my-path
  console.log(`Method: ${webhook.method}`)
  // POST
}

Duplicate Workflow

Create a copy of a workflow, optionally stripping credentials:

const result = await workflowHelper.duplicate(
  sourceId,         // Source workflow ID
  newName,          // Name for the copy
  stripCredentials  // Remove credentials (default: true)
)

Result:

interface DuplicateResult {
  success: boolean
  workflowId?: string   // New workflow ID
  name?: string
  error?: string
}

Example:

// Create shareable copy (no credentials)
const copy = await workflowHelper.duplicate('123', 'My Workflow - Copy', true)

if (copy.success) {
  console.log(`Created workflow: ${copy.workflowId}`)
}

// Create working copy (keep credentials)
const workingCopy = await workflowHelper.duplicate('123', 'My Workflow - Dev', false)

Add Node to Workflow

Add a new node to an existing workflow:

const result = await workflowHelper.addNode(workflowId, {
  name: 'My Node',
  type: 'n8n-nodes-base.httpRequest',
  position: [450, 300],
  parameters: {
    url: 'https://api.example.com',
    method: 'GET'
  },
  credentials: {
    httpHeaderAuth: { id: 'cred-id', name: 'My Auth' }
  }
})

Result:

interface AddNodeResult {
  success: boolean
  nodeName?: string
  error?: string
}

Create Workflow with Trigger

Create a new workflow with a pre-configured trigger:

const result = await workflowHelper.createWithTrigger(
  name,           // Workflow name
  triggerType,    // 'manual' | 'webhook' | 'schedule'
  triggerConfig   // Optional trigger configuration
)

Trigger types:

Manual Trigger

await workflowHelper.createWithTrigger(
  'My Manual Workflow',
  'manual'
)

Webhook Trigger

await workflowHelper.createWithTrigger(
  'My Webhook Workflow',
  'webhook',
  {
    path: 'my-webhook',
    method: 'POST'
  }
)

Schedule Trigger

await workflowHelper.createWithTrigger(
  'My Scheduled Workflow',
  'schedule',
  {
    interval: 60  // Every 60 minutes
  }
)

Get Workflow Statistics

Get statistics about a workflow:

const stats = await workflowHelper.getStats(workflowId)

Returns:

{
  nodeCount: number       // Number of nodes
  isActive: boolean       // Workflow active status
  hasWebhook: boolean     // Contains webhook node
  hasCredentials: boolean // Contains credential-using nodes
  triggerType?: string    // Type of trigger node
}

Usage Examples

Get Webhook for Integration

// Get webhook URL to share with external service
const webhook = await workflowHelper.getWebhookUrl('my-workflow-id')

if (webhook.success) {
  console.log('Configure your service to POST to:')
  console.log(webhook.url)
} else {
  console.error('No webhook found in workflow')
}

Create Template Copy

// Duplicate a template workflow for a new project
const result = await workflowHelper.duplicate(
  'template-workflow-id',
  'Project XYZ - Slack Notifications',
  true  // Strip credentials - user will add their own
)

if (result.success) {
  console.log(`Created workflow: ${result.workflowId}`)
  console.log('Remember to configure credentials!')
}

Build Workflow Programmatically

// Create base workflow with webhook
const workflow = await workflowHelper.createWithTrigger(
  'Customer Feedback Processor',
  'webhook',
  { path: 'feedback', method: 'POST' }
)

if (workflow.success) {
  // Add processing node
  await workflowHelper.addNode(workflow.workflowId, {
    name: 'Process Feedback',
    type: 'n8n-nodes-base.function',
    position: [450, 300],
    parameters: {
      functionCode: `
        const feedback = items[0].json;
        return [{
          json: {
            sentiment: feedback.rating > 3 ? 'positive' : 'negative',
            ...feedback
          }
        }];
      `
    }
  })

  // Add notification node
  await workflowHelper.addNode(workflow.workflowId, {
    name: 'Send to Slack',
    type: 'n8n-nodes-base.slack',
    position: [650, 300],
    parameters: {
      channel: '#feedback',
      text: '={{ $json.sentiment }}: {{ $json.message }}'
    }
  })
}

Workflow Audit

// Audit all workflows for security
const workflows = await client.listWorkflows()

for (const wf of workflows.data) {
  const stats = await workflowHelper.getStats(String(wf.id))

  console.log(`\n${wf.name}:`)
  console.log(`  Nodes: ${stats.nodeCount}`)
  console.log(`  Active: ${stats.isActive}`)
  console.log(`  Has Webhook: ${stats.hasWebhook}`)
  console.log(`  Uses Credentials: ${stats.hasCredentials}`)

  if (stats.hasWebhook && stats.isActive) {
    const webhook = await workflowHelper.getWebhookUrl(String(wf.id))
    console.log(`  Webhook URL: ${webhook.url}`)
  }
}

Node Types Reference

Common node types for addNode:

PurposeNode Type
HTTP Requestn8n-nodes-base.httpRequest
Function (JS)n8n-nodes-base.function
Set Datan8n-nodes-base.set
IF Conditionn8n-nodes-base.if
Switchn8n-nodes-base.switch
Mergen8n-nodes-base.merge
Split In Batchesn8n-nodes-base.splitInBatches
Slackn8n-nodes-base.slack
Telegramn8n-nodes-base.telegram
PostgreSQLn8n-nodes-base.postgres
MySQLn8n-nodes-base.mySql

Best Practices

  1. Strip Credentials for Sharing: Always use stripCredentials: true when duplicating for export
  2. Use Consistent Positioning: Keep nodes aligned (increment X by 200, Y by 200)
  3. Name Nodes Clearly: Use descriptive names for each node
  4. Test After Changes: Verify workflow after adding nodes
  5. Document Webhooks: Keep track of exposed webhook URLs

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.