Usage Guides
Welcome to the n8n-as-code usage guides. This section provides detailed instructions for using the primary tools in the n8n-as-code ecosystem.
🎯 What You'll Find Here
This section is organized by the primary user-facing tools:
| Tool | Purpose | Best For |
|---|---|---|
| VS Code Extension | Integrated development environment | Visual editing, real-time sync, workflow validation |
| CLI | Command-line interface | Automation, scripting, CI/CD integration |
| Agent CLI | AI tools and node schemas | AI coding assistants, node search, schema retrieval |
| Claude Skill | Claude Agent Skill package | Using Claude AI to generate n8n workflows |
🎨 Choosing the Right Tool
For Visual Workflow Editing (Recommended)
Use the VS Code Extension if you:
- Prefer a visual interface with split-view editing
- Want real-time synchronization as you type
- Need workflow validation and schema checking
- Work primarily in VS Code for development
- Want to see n8n canvas preview while editing JSON
For Automation and Scripting
Use the CLI if you:
- Need to automate workflow management tasks
- Want to integrate with CI/CD pipelines
- Prefer working in the terminal
- Need to script bulk operations
- Want to run n8n-as-code in headless environments
🔄 Common Workflows
Basic Workflow Management with VS Code
graph LR
A[Install Extension] --> B[Configure Connection]
B --> C[Pull Workflows]
C --> D[Edit in Split View]
D --> E[Auto-sync to n8n]
E --> F[Version Control with Git]
Automation Pipeline with CLI
graph LR
A[Git Push] --> B[CI/CD Pipeline]
B --> C[Run Tests]
C --> D[Validate JSON]
D --> E[Push to n8n]
E --> F[Deploy to Production]
🛠️ Integration Examples
VS Code + Git Integration
- Edit workflows in VS Code with real-time sync
- Commit changes to Git for version control
- Review changes using Git diff
- Collaborate with team members via Git
- Deploy using CI/CD pipelines
CLI + Automation Scripts
#!/bin/bash
# Example automation script for CI/CD
# Pull workflows from source instance
n8n-as-code pull
# Validate JSON syntax (using jq or other tools)
find workflows/ -name "*.json" -exec jq . {} >/dev/null 2>&1 \;
# Push to target environment
export N8N_HOST="https://target.n8n.example.com"
export N8N_API_KEY="$TARGET_API_KEY"
n8n-as-code init
n8n-as-code push
📚 Quick Reference
Common Commands
| Command | Description | Tool |
|---|---|---|
n8n-as-code init | Initialize project configuration | CLI |
n8n-as-code pull | Download workflows from n8n | CLI |
n8n-as-code push | Upload workflows to n8n | CLI |
n8n-as-code watch | Real-time sync mode | CLI |
n8n-as-code init-ai | Generate AI context files | CLI |
npx @n8n-as-code/agent-cli search | Search for n8n nodes | Agent CLI |
npx @n8n-as-code/agent-cli get | Get node JSON schema | Agent CLI |
npx @n8n-as-code/agent-cli list | List all available nodes | Agent CLI |
| VS Code: Refresh button | Pull workflows | Extension |
| VS Code: Save file | Auto-push to n8n | Extension |
Configuration Files
| File | Purpose | Location |
|---|---|---|
n8n-as-code.json | Project settings | Project root |
| VS Code Settings | Connection config | VS Code settings |
🚀 Getting Started with Each Tool
1. VS Code Extension (Recommended)
- Install from VS Code Marketplace
- Configure connection in extension settings
- Open workflow tree view from Activity Bar
- Start editing with auto-sync enabled
2. CLI
- Install globally:
npm install -g @n8n-as-code/cli - Initialize:
n8n-as-code init - Sync workflows:
n8n-as-code pull - Use commands as needed for automation
3. Agent CLI (For AI Tools)
- Run with npx:
npx @n8n-as-code/agent-cli --help - Search for nodes:
npx @n8n-as-code/agent-cli search "query" - Get node schemas:
npx @n8n-as-code/agent-cli get nodeName - Use output for AI context or development
4. Claude Skill (For Claude AI)
- Build:
cd packages/claude-skill && npm run build - Install to Claude.ai, Claude Code, or use via API
- Claude automatically uses the skill for n8n questions
- See Claude Skill Guide for details
🔧 Advanced Features
Multi-Instance Management
Work with multiple n8n instances. Workflows are automatically organized by instance to avoid mixing files from different environments.
Real-time Sync
Changes made in VS Code are instantly reflected in n8n, and vice versa. No manual push/pull required when using watch mode.
Git Integration
Store workflows as JSON files in Git for version control, collaboration, and deployment pipelines.
AI Assistant Support
Generate context files that help AI coding assistants understand n8n workflow structure and provide accurate suggestions.
📖 Next Steps
Explore the specific guides for each tool:
- VS Code Extension Guide: Learn about visual editing, real-time sync, and advanced features
- CLI Guide: Master command-line usage, automation, and scripting
- Agent CLI Guide: Use AI tools for node search and schema retrieval
🔍 Internal Components
For information about internal components used by developers and AI assistants, see:
- Contribution Guide: Architecture, development setup, and internal packages
- API Reference: Developer documentation for all packages
🆘 Troubleshooting
Common issues and solutions:
- Connection issues: Check n8n URL and API key
- File permission errors: Check file and directory permissions
- Extension not working: Restart VS Code or reinstall extension
For more help, check the Troubleshooting guide or open an issue.
Ready to dive deeper? Choose a tool below to get started with detailed guides.