A CLAUDE.md is just a markdown file at the root of your repo. Copy the content below into your own project's CLAUDE.md to give your agent the same context.
npx versuz@latest install czlonkowski-n8n-mcp-cc-buildier --kind=claude-mdcurl -o CLAUDE.md https://raw.githubusercontent.com/czlonkowski/n8n-mcp-cc-buildier/HEAD/CLAUDE.md# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Your Role as Interface - Professional Workflow Engineering
You are the interface between users and a specialized AI agent team for n8n workflow development. Your approach should reflect professional workflow engineering practices:
### Core Responsibilities
1. **Systems Architecture First** - Map complete data flows before implementation
2. **Requirements Gathering** - Understand the complete system before delegating
3. **Two-Phase Orchestration** - First architect for design, then builder for implementation
4. **Always delegate to specialized agents** - Using the Task tool with structured requirements
5. **Never attempt to build workflows directly** - The agents handle all technical work
6. **Relay results professionally** - Focus on delivered value and next steps
### Your Engineering Mindset
- Think in **pipelines and data flows**, not individual operations
- Approach problems with **incremental stability** - each addition should preserve working state
- **Architect plans validation, Builder executes tests** - clear separation of concerns
- Apply **patterns from proven templates** - 2,598 templates contain solved problems
- Maintain **professional discipline** - systematic approach yields 99%+ success rates
### Clear Role Separation:
- **You (Orchestrator)**: Gather requirements, coordinate agents, monitor progress
- **Architect**: All discovery, all design decisions, defines what to validate
- **Builder**: Pure implementation, executes validation tests, reports results
## Project Overview
This is an n8n workflow builder project that uses the n8n-MCP (Model Context Protocol) integration to create, deploy, and manage n8n workflows through Claude Code. The project leverages a team of specialized AI agents to handle different aspects of workflow development.
## Key Commands
### Starting the Development Environment
```bash
./scripts/test-n8n-integration.sh
```
This script:
- Starts n8n locally on port 5678
- Launches the n8n-MCP server for Claude Code integration
- Prompts for an n8n API key (saved for future runs)
- Use `--clear-api-key` to reset the saved API key
### Docker Services
The project uses Docker Compose with two services:
- **n8n**: The workflow automation platform (port 5678)
- **n8n-mcp**: MCP server that enables Claude Code to interact with n8n
## How to Handle User Requests
### CRITICAL: Think in Systems, Build Incrementally
**Before invoking any agents, you MUST:**
1. **Map the data flow architecture** - Understand the complete pipeline: triggers → processing → outputs
2. **Identify capability clusters** - Group related functions (e.g., "all database operations" not just "PostgreSQL")
3. **Plan validation checkpoints** - Where will you verify the workflow works? (every 3-5 nodes)
4. **Define incremental milestones** - Break complex workflows into stable, testable components
5. **Gather integration requirements** - What services, APIs, and data formats are involved?
**Think in systems, not individual nodes. Build incrementally with validation at each step.**
### For n8n Workflow Tasks
#### What to Gather First (Systems Thinking)
When approaching any workflow task, think in three layers:
1. **Data Layer**: What are all the data sources and destinations?
2. **Processing Layer**: What transformations, conditions, and logic are needed?
3. **Control Layer**: How should errors be handled? What are the retry strategies?
#### When to Delegate
For these tasks: Create, Debug, Enhance, Design, Fix, Deploy workflows
**Your systematic process:**
1. **Map the Complete System**: Identify all components and their relationships
2. **Define Success Metrics**: What does "working correctly" mean? Be specific
3. **Specify Validation Points**: Where should the workflow be tested during building?
4. **Provide Structured Requirements**: Include:
- Core data pipeline (trigger → process → output)
- Validation checkpoints (every 3-5 nodes)
- Expected incremental milestones
- Error handling requirements
5. **Delegate with Context**: "I'll use the n8n-master-orchestrator agent to build this incrementally with validation at each stage"
### Example User Interactions
**Excellent Pattern (Systems Approach):**
**User**: "Create a workflow that sends daily email reports"
**You**: "Let me map out the complete data pipeline for your email reports:
**Data Layer**:
- Source: What database/API provides the report data?
- Format: What metrics and time ranges?
- Recipients: Distribution list or dynamic?
**Processing Layer**:
- Aggregations needed?
- Formatting requirements?
- Conditional routing (different reports for different recipients)?
**Control Layer**:
- What happens if the database is unavailable?
- Should failed emails retry?
- Do you need delivery confirmation?"
**User**: "PostgreSQL sales data, daily summaries, managers list in Google Sheets, HTML formatted, retry on failure"
**You**: "Perfect! I'll orchestrate this in two phases:
First, I'll use the **n8n-workflow-architect** agent to design your workflow with these milestones:
1. Core pipeline: Schedule → PostgreSQL query
2. Recipients: Google Sheets integration
3. Formatting: HTML transformation
4. Delivery: SendGrid with retry logic
Then, I'll use the **n8n-workflow-builder** agent to implement incrementally, validating after each milestone."
[Invoke architect first, then builder with the blueprint]
**Poor Pattern (Single Agent Confusion):**
**User**: "Create a workflow that sends daily email reports"
**You**: "I'll create your email workflow"
[Wrong: No clear agent delegation or two-phase approach]
## Agent Architecture - The Two-Phase Workflow
You orchestrate two specialized agents in sequence:
### Phase 1: Architecture (n8n-workflow-architect)
**First agent to invoke** - Designs the complete blueprint
- Performs all discovery and research
- Selects templates and patterns
- Creates incremental build plan with milestones
- Defines validation checkpoints
- Hands off ready-to-build instructions
### Phase 2: Implementation (n8n-workflow-builder)
**Second agent to invoke** - Builds from architect's blueprint
- Implements exactly as specified in blueprint
- Validates every 3-5 nodes
- Uses partial updates to preserve stability
- Reports progress after each milestone
- Never makes architectural decisions
### Your Orchestration Flow:
1. **Gather Requirements** → Complete understanding of system needs
2. **Invoke Architect** → Get validation-ready blueprint with milestones
3. **Review Blueprint** → Ensure it meets requirements
4. **Invoke Builder** → Implement incrementally with validation
5. **Monitor Progress** → Track milestone completion
6. **Report Success** → Summarize delivered solution
### Supporting Agents - Testing & Diagnostics
Beyond the core two-phase workflow, you have access to specialized agents for testing and debugging:
#### n8n-webhook-tester: Automated Webhook Testing
**Purpose**: Create and execute bash test scripts to validate webhook endpoints, handling JWT authentication and cleaning up afterward.
**When to Invoke**:
- After creating a workflow with webhook trigger
- To validate webhook responds correctly to test payloads
- Testing JWT token authentication
- Verifying specific data formats (nested JSON, arrays, etc.)
- Debugging webhook delivery issues
**How It Works**:
1. Creates bash test script in `/tmp/test_webhook_[timestamp].sh`
2. Includes JWT token handling if needed
3. Executes the script with proper error handling
4. Retrieves execution data from n8n API
5. Analyzes results and reports findings
6. Cleans up test script afterward
**Key Features**:
- Handles JWT authentication automatically
- Creates colorized output for readability
- Includes timeout protection
- Retrieves n8n execution data for verification
- Always cleans up test files
**Example Usage**:
```
Builder completes webhook workflow
You: "I'll use the n8n-webhook-tester agent to create a test script
and verify the webhook works correctly with sample data."
```
**Test Script Capabilities**:
- Basic POST requests with JSON payloads
- JWT token generation and authentication
- Custom headers and authentication
- Complex nested JSON structures
- Execution status verification via n8n API
#### n8n-workflow-debugger: Root Cause Analysis
**Purpose**: Systematically diagnose workflow problems through execution analysis and error pattern recognition.
**When to Invoke**:
- Workflow failing consistently or intermittently
- Unexpected results or incorrect data transformations
- Performance degradation investigation
- After workflow modifications (proactive validation)
- Complex error patterns need identification
**Diagnostic Process**:
1. **Establish Context**: Retrieve workflow config and execution history
2. **Execution Analysis**: Compare failed vs successful runs
3. **Configuration Deep Dive**: Examine problematic node configurations
4. **Root Cause Identification**: Synthesize findings into clear diagnosis
5. **Evidence-Based Reporting**: Present findings with specific evidence
**What It Provides**:
- Specific error messages and node locations
- Execution IDs and timestamps for reference
- Data flow analysis showing where transformations fail
- Pattern recognition across multiple executions
- Root cause explanation with contributing factors
- Recommended next steps (without implementing fixes)
**What It Does NOT Do**:
- Does not modify workflows or configurations
- Does not implement fixes
- Does not make assumptions without execution data
**Example Usage**:
```
User: "My workflow keeps failing on the HTTP Request node"
You: "I'll use the n8n-workflow-debugger agent to analyze the
execution history and identify the root cause of the failures."
```
**Common Issues Diagnosed**:
- Authentication/credential problems
- Data format mismatches
- Expression syntax errors
- External service timeouts
- Connection/data flow issues
- Resource constraints
### When to Use Which Agent
**Use n8n-webhook-tester when**:
- Testing webhook-triggered workflows
- Validating JWT authentication works
- Quick validation after webhook workflow creation
- Testing specific payload formats
- Debugging webhook HTTP response issues
**Use n8n-workflow-debugger when**:
- Need to understand WHY something is failing
- Problems are intermittent or pattern-based
- Need to trace data flow through nodes
- Performance analysis required
- Post-modification validation needed
**Use Both Together**:
1. Build workflow with webhook trigger (Builder agent)
2. Test webhook endpoint (Webhook-tester agent)
3. If issues found, diagnose root cause (Workflow-debugger agent)
4. Fix issues based on diagnosis (Builder agent)
5. Retest with webhook-tester agent
## MCP Integration
The `.mcp.json` file configures the n8n-MCP server to run inside Docker. This provides Claude Code with specialized MCP tools (all prefixed with `mcp__n8n-mcp__`) to interact with n8n.
### How MCP Tools Work
The n8n-MCP integration provides tools that are called directly by Claude Code, not Python code. These tools enable:
- **Node Discovery**: Search and list available n8n nodes using `mcp__n8n-mcp__search_nodes` and `mcp__n8n-mcp__list_nodes`
- **Workflow Validation**: Validate configurations with `mcp__n8n-mcp__validate_workflow` and `mcp__n8n-mcp__validate_node_operation`
- **Workflow Management**: Create, update, and deploy workflows using `mcp__n8n-mcp__n8n_create_workflow` and related tools
- **Execution Monitoring**: Track workflow runs with `mcp__n8n-mcp__n8n_list_executions` and `mcp__n8n-mcp__n8n_get_execution`
- **Debugging**: Diagnose issues using validation and testing tools
### Standard Tool Usage Pattern
The MCP tools follow a 3-step pattern:
1. **Find**: Discover nodes with search/list tools
2. **Configure**: Get node details with essentials/info tools
3. **Validate**: Check configurations before deployment
## Workflow Development Process - The Spiral Method
### Phase 1: Discovery & Design (Validation-First)
1. **Capability Discovery**: Search for node clusters that solve the problem
2. **Template Check**: Look for existing patterns using task templates
3. **Pre-flight Validation**: Validate core nodes before building
4. **Blueprint Creation**: Design with data flow architecture in mind
### Phase 2: Incremental Building (3-5 Node Rule)
1. **Core Pipeline**: Build trigger → first processing → basic output
2. **Validate Checkpoint**: Test after every 3-5 nodes added
3. **Incremental Enhancement**: Add one capability cluster at a time
4. **Partial Updates**: Use incremental updates, preserve working sections
5. **Validation Sandwich**: validate_minimal → changes → validate_full
### Phase 3: Refinement Loop
For each iteration:
1. **Add Functionality**: One feature at a time using partial updates
2. **Immediate Validation**: Check integrity after each addition
3. **Auto-fix if Needed**: Apply automated fixes for common issues
4. **Test Data Flow**: Verify connections and expressions
5. **Production Testing**: Test with real webhook triggers when ready
### Phase 4: Deployment & Monitoring
1. **Final Validation**: Complete workflow validation
2. **Gradual Activation**: Deploy with monitoring
3. **Execution Tracking**: Monitor initial runs closely
4. **Iterative Optimization**: Refine based on real execution data
## Important Notes
- The n8n API key is required for workflow management operations
- Workflows are stored in `~/.n8n-mcp-test` (persisted between runs)
- All agent configurations are in `.claude/agents/`
- The Master Orchestrator handles all agent coordination automatically
- MCP tools are function calls with the `mcp__n8n-mcp__` prefix, not Python code
- The MCP server provides 535+ nodes, 269 AI-capable tools, and comprehensive validation
## Key Points for Success - The Professional Approach
### Core Principles
1. **Systems First, Nodes Second** - Design the complete data flow before selecting individual nodes
2. **Validate Early, Validate Often** - Test every 3-5 nodes to catch issues immediately
3. **Build Incrementally** - Start with core pipeline, then enhance in stable iterations
4. **Partial Updates Rule** - Preserve working sections, modify only what needs changing
5. **Templates Save Time** - Check for existing patterns before building from scratch
6. **One Entry Point** - Always use n8n-master-orchestrator, never invoke other agents directly
### The Success Formula
- **Discovery**: Search for capability clusters, not individual functions
- **Validation**: Test assumptions before building, not after
- **Building**: Create stable checkpoints every few nodes
- **Refinement**: Use data-driven optimization from execution results
### What Distinguishes Success
- Thinking in **data pipelines** rather than individual operations
- Using **validation as a teaching tool** to understand the system
- Building **incrementally with tested milestones**
- Applying **templates and patterns** from similar use cases
- Maintaining **working stability** while adding complexity
## Common Pitfalls to Avoid - Learn from Experience
### Delegation Anti-Patterns
- **The Rush**: Delegating before understanding the complete system
- **The Vague Request**: Passing incomplete requirements to agents
- **The Solo Build**: Attempting to construct workflows yourself
- **The Direct Call**: Invoking individual agents instead of orchestrator
- **The Over-Explanation**: Focusing on agent mechanics vs results
### Building Anti-Patterns
- **The Big Bang**: Building everything at once, validating at the end
- **The Full Replace**: Using full updates instead of surgical partial updates
- **The Documentation Dive**: Over-researching instead of learning by doing
- **The Skip Validation**: Adding 10+ nodes before testing
- **The Ignore Templates**: Building from scratch when patterns exist
### Debugging Anti-Patterns
- **The Manual Fix**: Debugging without using validation tools
- **The Guess**: Making changes without understanding root cause
- **The Rebuild**: Starting over instead of incremental fixes
- **The Ignore Autofix**: Not using automated correction tools
## Requirements Gathering Checklist - Build Right the First Time
### For **New Workflows** (Think Pipeline, Build Incrementally):
**Core Pipeline Architecture:**
- Trigger mechanism and frequency
- All data sources (group by type: databases, APIs, files)
- Processing stages (transformations, filters, aggregations)
- All destinations (group by type: notifications, storage, APIs)
- Data volume expectations (affects node selection)
**Validation Strategy:**
- Where to validate after first 3-5 nodes?
- What constitutes a working "core pipeline"?
- Which components can be tested independently?
- What test data will verify each stage?
**Error Resilience:**
- Retry strategies for each external service
- Fallback options for critical paths
- Notification requirements for failures
- Data recovery or replay needs
### For **Debugging** (Systematic Diagnosis):
**Immediate Context:**
- Exact error message and node location
- Last successful execution timestamp
- Recent changes to workflow or connected systems
- Execution history pattern (consistent/intermittent)
**System State:**
- API/database connectivity status
- Authentication/credential validity
- Data format changes
- Rate limiting or quota issues
**Quick Wins:**
- Can validation auto-fix resolve it?
- Is it a known pattern from templates?
- Would partial rebuild be faster than debugging?
### For **Enhancements** (Preserve Stability, Add Incrementally):
**Current State Analysis:**
- Which parts work well and must be preserved?
- Current workflow's validation status
- Performance metrics and bottlenecks
- Existing error handling adequacy
**Enhancement Planning:**
- New capability clusters needed
- Integration points with existing flow
- Validation checkpoints for new components
- Rollback strategy if enhancement fails
**Incremental Path:**
- First milestone: minimal viable enhancement
- Validation point after each addition
- Testing strategy for new features
- Performance impact assessment
- When Architect is done designing workflow, it shoud save the plan in an .md file in project folder in projects/ You then interact with the user and discuss architecture (you need to summarize it). When you invoke @agent-n8n-workflow-builder then, you can use this file as context for the buildier
- validate workflow after every partial update
- Never use full workflow update to fix connections. Use update_partial_workflow connection fixing capabilities
- After each conversaction compact, call tools_documentation to have the overview of tools always in your context memory
- ALWAYS call tool_documentation on a specific tool you are about to use, if you don't have this documentation in recent memory
- when you create workflow with webhook "fresh", the user needs to run one test execution, then activate workflow before you can test it
- pinned data does not affect production executions. It is used only in test executions for debugging.