Overview
This node integrates with the Claude Code AI SDK to perform AI-powered coding tasks through conversational interactions. It allows users to send prompts or instructions to Claude Code, which can generate code snippets, analyze projects, or assist with programming-related queries. The node supports starting new conversations or continuing previous ones, enabling iterative development and refinement.
Common scenarios include:
- Generating code functions or scripts based on natural language prompts.
- Automating code review or refactoring suggestions.
- Running AI-assisted project analysis within a specified directory.
- Using built-in tools like file editing, web search, or command execution to enhance coding workflows.
Practical example:
You could prompt Claude Code to "Create a Python function to parse CSV files" and receive a ready-to-use function. Alternatively, you might continue a conversation to refine that function or ask for additional features.
Properties
| Name | Meaning |
|---|---|
| Prompt | The instruction or question sent to Claude Code. Supports expressions to dynamically use data from previous nodes. Example: "Create a Python function to parse CSV files" |
| Model | Selects the Claude model variant: - Sonnet: Fast and efficient for most tasks - Opus: More capable for complex tasks |
| Max Turns | Maximum number of back-and-forth exchanges allowed in the conversation before stopping. |
| Timeout | Maximum time (in seconds) to wait for Claude Code to complete the task before aborting. |
| Project Path | Directory path where Claude Code should run, allowing it to access files and execute commands relative to this location. If empty, uses the current working directory. |
| Output Format | Determines the structure of the output data: - Structured: Object containing messages, summary, result, and metrics - Messages: Raw array of all exchanged messages - Text: Only final result text |
| Allowed Tools | Built-in tools Claude Code is permitted to use during execution. Options include: Bash, Edit, Exit Plan Mode, Glob, Grep, LS, MultiEdit, Notebook Edit/Read, Read, Task, Todo Write, Web Fetch/Search, Write |
| Additional Options | Collection of optional settings: - System Prompt: Extra context or instructions for Claude Code - Require Permissions: Whether tool usage requires explicit permission - Debug Mode: Enable debug logging |
Output
The node outputs JSON data structured according to the selected Output Format:
Structured:
An object containing:messages: Array of all messages exchanged during the conversation.summary: Counts of user messages, assistant messages, tool uses, presence of results, and available tools.result: The final result text or error message.metrics: Performance data such as duration in milliseconds, number of turns, cost, and usage statistics.success: Boolean indicating if the operation succeeded.
Messages:
Raw array of all messages exchanged, including user inputs, assistant responses, and tool usage events.Text:
Only the final result text string, along with metadata fields like success status, duration, and cost.
If the node were to output binary data (not indicated here), it would typically represent files or other non-textual content generated or manipulated by Claude Code.
Dependencies
- Requires an API key credential for authenticating with the Claude Code service.
- Uses the official Claude Code SDK (
@anthropic-ai/claude-code) for communication. - Node configuration may require setting appropriate timeout values and specifying the working directory for project-related operations.
- Optional debug mode logs detailed execution information to the console.
Troubleshooting
- Empty Prompt Error: The node throws an error if the prompt is missing or empty. Ensure the prompt property is set and not just whitespace.
- Timeout Errors: If the operation times out (default 300 seconds), consider increasing the timeout value in the node settings.
- Permission Issues: If tool usage is restricted by permissions, enable or disable the "Require Permissions" option accordingly.
- Invalid Project Path: Specifying a non-existent or inaccessible project path may cause failures; verify the path correctness and permissions.
- API or Network Failures: General execution errors may occur due to network issues or invalid API credentials. Check connectivity and credential validity.
- Debugging: Enable debug mode to get detailed logs that help identify issues during execution.
Links and References
- Claude Code SDK Documentation (official SDK reference)
- n8n Documentation (for general node usage and workflow building)
- Anthropic AI Website (company behind Claude models)