n8n-nodes-claude
v2.1.0
Published
n8n nodes for Anthropic Claude AI and PRD Agent - includes session management, PRD generation, and automatic Markdown documentation
Downloads
41
Maintainers
Readme
n8n-nodes-claude
This is an n8n community node package that provides two powerful nodes for integrating Anthropic's Claude AI into your n8n workflows:
- Claude Node: Execute Claude CLI commands with full agentic capabilities
- PRD Agent Node: Product Requirements Document management with specialized AI agents
n8n is a fair-code licensed workflow automation platform.
Anthropic Claude is a family of large language models developed by Anthropic.
Claude CLI is a command-line interface that provides agentic AI capabilities with file system access and tool usage.
Prerequisites
Claude CLI must be installed on the system running n8n:
npm install -g @anthropic-ai/claude-codeFor detailed installation instructions, see the Claude CLI Installation Guide.
Installation
Follow the installation guide in the n8n community nodes documentation.
Local Development
- Navigate to your n8n custom nodes directory:
cd ~/.n8n/nodes- Install dependencies:
cd n8n-nodes-claude
npm install- Build the node:
npm run build- Restart n8n to load the custom node
Nodes Overview
1. Claude Node
This node executes Claude CLI commands with full agentic capabilities including file system access, tool usage, and multi-turn reasoning.
2. PRD Agent Node
Specialized node for Product Requirements Document management with five operations:
- Draft PRD: Generate initial PRD from a goal
- Review Block: Edit, confirm, or rollback PRD blocks
- Compile Spec: Generate technical specifications
- QA Guide: Refine PRD based on Q&A answers
- Generate Diagrams: Create ER and state machine diagrams
See PRD Node Documentation for detailed information and examples.
Usage
Claude Node
This node executes Claude CLI commands with full agentic capabilities including file system access, tool usage, and multi-turn reasoning.
Parameters:
- Prompt (required): The command/query to send to Claude CLI
- CLI Options:
- Output Format: Choose JSON, Text, or Stream JSON (default: json)
- Max Turns: Maximum number of agentic iterations (default: 5)
- Verbose: Enable detailed turn-by-turn logging
- Model Alias: Choose sonnet, opus, or haiku (default: sonnet)
- Additional Directories: Comma-separated paths to make accessible
- Permission Mode: How to handle permissions (ask/allow/deny, default: allow)
- Input Text: Optional text to pipe as input to the CLI
Example - Simple Query
Prompt: "What is 2+2?"
CLI Options:
Output Format: json
Model Alias: sonnetExample - Code Analysis
Prompt: "Review this code and suggest improvements"
CLI Options:
Output Format: json
Max Turns: 10
Additional Directories: /path/to/project
Permission Mode: allow
Input Text: "{{ $json.code }}"Example - File Processing
Prompt: "Analyze this log file for errors"
CLI Options:
Output Format: json
Verbose: true
Input Text: "{{ $json.logContent }}"Example - Multi-file Refactoring
Prompt: "Refactor all components to use TypeScript strict mode"
CLI Options:
Output Format: json
Max Turns: 20
Additional Directories: /path/to/src/components
Permission Mode: allowOutput Format
- JSON Output: Returns structured JSON with the CLI response
- Text Output: Returns plain text in
{ text: "...", raw: "..." }format
Example JSON output:
{
"text": "Response from Claude...",
"raw": "Full CLI output..."
}Example Workflows
1. Automated Code Review
GitHub Trigger → Claude CLI → Comment on PRAutomatically review code changes with full project context and file system access.
2. Multi-file Refactoring
Schedule Trigger → Claude CLI → Git Commit → Send NotificationRefactor code across multiple files with agentic capabilities.
3. Log Analysis & Alerting
Read Log Files → Claude CLI → Parse Errors → Send Slack AlertAnalyze logs and extract actionable insights with detailed reasoning.
4. Documentation Generation
Cron Trigger → Claude CLI → Save to Repository → Create PRGenerate or update documentation based on codebase changes.
5. Test Generation
Webhook → Claude CLI → Write Tests → Run Tests → Report ResultsAutomatically generate comprehensive tests for new code.
6. Security Audit
Schedule → Claude CLI → Generate Report → Send EmailPerform security audits with file access and multi-step analysis.
Best Practices
- Permission Mode: Use
allowfor automated workflows to avoid interactive prompts - Max Turns: Increase for complex multi-step tasks (e.g., 10-20 for code refactoring)
- Additional Directories: Grant access to specific project directories for file operations
- Verbose Mode: Enable for debugging to see detailed execution logs
- JSON Output: Use JSON format for easier parsing in n8n workflows
- Security: Be cautious with permission mode
allow- only use in trusted environments - Error Handling: Enable "Continue On Fail" in node settings for robust workflows
- Input Text: Use to pipe content from previous nodes for analysis or processing
Resources
Compatibility
- Requires n8n version 0.210.0 or later
- Requires Claude CLI installed on the host system
- Compatible with all n8n deployment types (self-hosted, cloud, desktop)
- Works with Claude CLI version 1.0.0 and above
License
Support
For issues, questions, or feature requests, please create an issue in the repository.
Made with ❤️ for the n8n community
