📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

How to Use Claude to INSTANTLY Build & Replicate Any n8n Agents

Mark Kashef19:29

Transcription

A lot of creators are going to absolutely hate me for this. I just figured out how to use Claude 3.7 to generate pretty much any kind of automation in n8n just using prompts. And even better, I can replicate existing ones just by taking a screenshot. Whether it's a YouTube video or a Google image, if you have a screenshot of what the workflow looks like and you have a transcript to go along with it, you can replicate pretty much anything. If you're still paying for templates, you might want to check this out before you spend yet another dime. Because with the right setup, Claude can pretty much reverse engineer all kinds of workflows. And again, it's not 100% perfect, but it can really get you 80% of the way just through one or two prompts.

If I've piqued your interest, stick with me and I'll show you exactly how it works and how you can set it up in your own Claude project. Let's dive right in.

All right. So, if you've watched one of my prior videos, you'll remember that I used a combination of ChatGPT with the new deep research function in ChatGPT to be able to research a bunch of n8n documentation and then come up with a JSON. Then all we had to do is copy that JSON, paste it in, and most of the time you'd have something. Now, whether or not it was broken or not, or you had sections that you had to fix, that was another story. But the one thing that was overall not as fun to work with that workflow is if you needed to iterate over and over again using deep research, it would take a lot of time and that time might not necessarily translate to a better result. So I asked myself the question, could we do this without deep research? Could we create some form of cheat sheet or cheat sheets as well as provide example workflows that an LLM could understand, especially if it has the power of a reasoning model like 3.7?

So before I even break anything down, let me prove to you that it can work. So if we go into here into Claude, you'll see I have a Claude project called n8n templates. And in here I have a prompt. I have my two cheat sheets. One's called n8n cheat sheet guide and one is called n8n tips and tricks. Then the rest of them are literally example workflows from the free marketplace in n8n.

And if I go to write a prompt, I'm just going to do this on lazy mode. I'm going to use something called Whisper Flow where all I have to do is just click on a little key and speak. I want you to create an edit n8n workflow for me that will go from a WhatsApp chatbot and then go and create a series of documents in Google Doc and then send me a notification back in WhatsApp that it's been completed and then throw some other stuff in the middle that you think is useful. So, I'm purposely giving a very vague and honestly poor prompt just to show you how this works. So once I click on send, what it's going to do is it's instructed to reference its knowledge base, go through its own knowledge of n8n, and then come up with a JSON output, which is something I'll be able to copy, paste, and you'll see how that'll work shortly.

All right, so we got this output eventually. Initially, what it did is actually ask me some clarifying questions because in the prompt, I said, if you're unsure about the direction of the workflow and I'm being too vague, try and push me back. So it asks me here, do you want me to create the workflow? So it receives messages from WhatsApp, uses an AI agent to interpret the request and then before providing the JSON, it wants to clarify a few things like for the Google doc, would I prefer to create a single document, a series of documents, etc. In this case, unfortunately, it dealt with the lazy and grumpy version of me. And I just said, take your best guess. And we got this very long output of JSON. And if I copy this and you scroll to the bottom, you'll see here it's denoting all the different modules you'd see in n8n step by step. And all we do is go into edit n8n. We lazily click command-V. And then you'll notice that we get something here. Now we have an actual agent flow. And what's cool about this version is Claude is actually really good at creating the sticky notes that try to explain what's happening in the automation. All you have to do is really just move things around and reposition parts of the workflow. Let's move this here. And I'll just get this out of the way just so you can see. And then you just have to manipulate the order of everything. And you can see that you are pretty far along the way with a pretty horrific set of instructions from myself.

So if we just clear this out, you'll see here obviously there's some areas here where it's not connected to each other. You have to resolve. Let's say the memory is good, but we have tools ready to go. It randomly decided to use a datetime tool, calculator tool. It used Google Docs as a tool. We might want to fix this portion. And then it created some document creator tool and tried to explain what's actually happening in the stickies itself. So, similar to a template that you would pay for, it comes with an explanation, the actual workflow that you can get started with and start using or at least start tweaking. And this is all out of the box with very minimal instruction.

Now, obviously, it's not just Claude's knowledge or my cheat sheet guides. If you go back to Claude projects, what I did to increase the chances of actually getting good responses, if you go back here to the template, is you'll notice that I drag and dropped a series of existing workflows. So, in a previous video, I showed you that I had my team take 300 AI workflows from the n8n workplace and then put it into a Google Drive. and I just took a subset of them that had tools that seem to come up over and over again. You can mix and match whatever you want. And you'll even see in Claude here when it comes to the knowledge, there's almost 50% left. So you could probably even give more examples. So when you combine existing workflows showing how the connectivity works with cheat sheet guides and a solid prompt that I'll go through shortly, it gives you a pretty strong scenario.

Now, what about my second promise, which is that you can replicate existing workflows? I'm going to prove that to you, too. I'm going to go on a random YouTube video, screenshot the workflow, import it here, and show you exactly how that could work.

All right, so I'm on YouTube, and I entered n8n workflow here, and then we're just going to scroll down and then pick a random video. Let's take this one. And I'm just going to pause and kind of go through wherever we see a snapshot of a workflow. So, let's go to something like this. Okay. And then this is a pretty easy one. If I just screenshot this, I can copy this to my clipboard. Go to Claude, paste it, and then we'll lazily just make another command. I want you to output a JSON file that is just like this workflow verbatim end to end. And then we'll send something like that. And I'll show you the result. And it took around a minute and we got something like this. Again, pretty beefy. And I'll notice here that it does have sticky notes as well because in my prompt I'm always asking it to try to overexplain what's happening. But you'll see we went from this image here to copy pasting that JSON going into here and we now get an slightly improved version of that workflow that has that chat module the AI agent step the access to all the different tools along with an explanation of what's happening. And again, all you have to do is just take this sticky, put it where it makes sense to given your workflow and then make it look pretty. And then tada, you now have a workflow.

And while admittedly that one was pretty easy, if we go back to YouTube, back to a random video here. Let's go to This looks a bit meteor. So, if we go to this one. All right. So, what I'll do here is a couple things that are a bit different. I'm going to take a screenshot of this first portion. Okay. And then I'm going to paste it here. And then I'm going to take the actual transcript of the video. So let's go to here and wait for this video to load. Okay. And there's another way you could pull this. It's called YouTube transcript .com or something that you can easily take those or you could build an actual n8n or make automation to take it. But I'm just going to be super lazy and I'm going to paste this here. And what this is going to do is not only give Claude the screenshot of the actual workflow, but it'll give it all the context as to what's happening, so it can actually fill in the blanks, do the prompt engineering if needed. And if we go back here, if I wanted to go overkill, I could go to a part of the video where there's like a zoomed in parts, right? And kind of stitch it together. But overall, like let's say we could take this part here, the very beginning, it would know exactly how we're starting. And if we just say I want to fully recreate this workflow end to end and I gave you the entire transcript of the associated video so you know exactly what we're going for and what you should be configuring end to end. We do something like that our little friend here. We'll just send it over and we'll see what we get.

All right. So, this one was so long that it created five different sets of partial JSON files that I had to put together and try to patch together and not destroy the actual syntax, which was taking a bit too long. So, take my word for it. This one's a bit too long. It can handle it, but you do have to manipulate the JSON at the very end. So, what I did is I chose another YouTube video that has a leaner automation. This one's pretty straightforward. I screenshotted this one. And if we go to the very bottom after the battlefield of the prior prompt, we get something like this. And if we copy this directly into n8n and paste, you see we get something very similar, if not exact, identical to what we see on screen here. So hopefully this proves the point that this is capable of creating and replicating. So let's go through how it works step by step.

All right. Guys, if you're not familiar with what Claude projects is, if you go to Claude out of the box, you'll be able to go to the lefthand side and go to this project section. It's basically its version of ChatGPT projects. And how you create one's pretty straightforward. You go to create project. You name the project something. So, I'll call it test. You can create. Then all you get is the ability to add instructions. So, a set of prompts for how the project should interact with every single session. and you can upload knowledge files and that's pretty much it outside of being able to configure which LLM version you want to use for that particular chat as well as the style of speaking that you want to have which in our case is completely irrelevant since we're just outputting JSON files.

So, if we go back to Claude and we go to our project here, this n8n templates project, we have this prompt right here. And it is a very beefy prompt, but I'll give you the long and short of it. And don't worry about the prompt or the knowledge files or any of the cheat sheet guides because I'll be making them available to you in the description below. So, just sit back and watch. Here we basically say, I want you to create a fully functional n8n workflow JSON. No images, no screenshots, only valid JSON. Then follow these instructions. I basically tell it, hey, refer to all the files you have. In particular, the n8n tips and tricks, the n8n cheat sheet guide, and one in particular, the n8n workflow here called AI agent chatbot, and the AI agent chatbot and long-term memory example. And the reason why I'm telling it to look at this example is because this model's trained as of 2023 or early 2024, it doesn't have any knowledge of the AI agent module. So I just give it one directed example. So it knows the exact structure. So if you have an example or a command with an AI agent in there, it knows how to actually reference to replicate it.

Now, if we go to the rest of it here, I just also say refer to any other sample workflow I've provided you. So if you want to switch it to your end and you're using different tools like Asana or Jira or insert tool here like Zoom, then you want to throw examples there that are relevant to you because that will increase the likelihood that it has reference material that it can use to emulate and create something new or an updated version of something old. To continue on, we have a workflow description here. And I say that in most cases, you'll have a chat trigger node that controls some of the workflows. We have some critical configuration requirements. Now, one thing that changed recently in n8n is instead of completion, if you want to use OpenAI, it's now called complete. So, otherwise, it wouldn't be broken, but you'd have to go and actually just switch the drop down to complete. So, things like that I've put out of the box. Also, if you're being vague and saying, you know what, use an LLM to do XYZ, I'm just telling it, use this ChatGPT 4.0 latest as your default if the person's not specifying. So by default it'll go towards OpenAI ChatGPT 4 and then if you want to change that completely up to you and beyond that I'm just saying don't put any placeholders or any partial JSON and this is one key thing here which is ask if details are missing. So if you remember with my first example it pushed back to clarify what I wanted from this WhatsApp chatbot. So in this case it tries to push you back to clarify any requirements again to increase the chance you get exactly what you're looking for. And the last thing here is I say what the output format should be that it should be in a JSON code block with no backticks or random pieces of information. And then I tell it its goal again which is to provide a single self-contained JSON file that can be pasted directly into edit n8n and ideally just replicate whatever you see. So that's the actual core prompt.

In terms of the cheat sheet guides, if we go here, you'll see I have the cheat sheet guide and the n8n tips and tricks. This first one was pretty easy to make and the second one was definitely not as easy, but you can just take my hard work and avoid all the scars with the cheat sheet guide. It's basically a series of information that I asked ChatGPT deep research as well as Perplexity deep research and then I combined both reports on how you would create a guide for using edit n8n structurally step by step from how you'd use the logic how you'd structure the nodes creating some actual code examples you can see here you can literally see that this is from a code block and basically this entire document is a combination of all the different research that I've and put into one doc and then created this thing end to end. And this is a good trick that you can steal from me for all kinds of applications where you just make the LLMs do the deep research to put together the cheat sheet guide and then you use this cheat sheet guide to actually put it in the knowledge base and have it as core reference material. And it's a really good crutch in case you're dealing with something that's more nuanced, something that changes or you need a lot more firepower and context to provide the LLM than you initially expected. So that's this one.

If we go to the n8n tips and tricks, this is a text file and I think if we can zoom in here. Yep. So you can see this also emphasizes general n8n node structure and then I go through specific tools. I go through specific nodes that pop up. I also give it a breakdown on how to create sticky note nodes. It's a tricky one to say. The AI agent module again reinforcing how to call that and what tools it can connect to. I give it some snippet examples of JSON in that case and then I go through some very commonly used tools at least for myself and my agency when it comes to using something like Pinecone Airtable. It has some tips and tricks to Claude on how it should actually use these tools and when it should use these tools. So it has the most common tools here. This one wasn't as easy for me to put together. Basically what I did is of the 300 workflows I just ran this through a Python script. And this Python script did two things. The first part is I just parsed out all the unique different nodes from all the JSONs. So imagine you had like a running total of all the individual different options or automations I could put in. I basically created a dictionary of all possible automations in the 300 I gave it. So in this case, we parsed around 284 unique examples and unique definitions around 5,000. And then I ran this set of basically automations that are compiled into an LLM. And I basically said, can you make this into a cheat sheet? Because the original file of thousands and thousands of nodes was over 500 pages long. And Claude would never take a look at that. And we'd probably need the context window to not triple, probably 10x of the actual knowledge base to be able to take it all at once. So I basically had a prompt here that said summarize a subset of nodes and build a prompt uh that asks for a concise cheat sheet and then we have that here. So you are an expert in n8n and JSON definitions below is a subset of nodes. Please produce a short cheat sheet. In this case I start processing all the different parts of the document into chunks and I try to create this synthesized knowledge of some insights that pop out when you analyze different workflows. So this part you don't need to work for, but just for fun, if you do want access to this, I'll make it available as well in case you want to take it for a spin.

Once I had that, all we had to do was just throw it in to the Claude project as knowledge. And again, I just went through and found different automations from the 300 that you saw here that I thought would be helpful or relevant and just pasted them here as additional reference material. And just to reinforce the point here, if I say something like, I want you to create an automation that goes from a Slack trigger and then does a bunch of things in the middle to take that trigger and then process it, summarize it, and build a report based off of it and then throw it back into a message in Slack at the very end. Okay, something vague again. Because I put a couple examples here that use Slack on the right hand side in this knowledge base, it'll have that much better of a chance to actually create something that in the middle will actually use some logic as to how it should structure the automation. So I'm not even giving it the step by step that you could and honestly you should in this case it can go the whole 59 and in this case it's telling me all these questions. I'm going to be vague again. Um, go with your best gut decision. I trust you. And we get this automation here that we can just copy paste. Put it in here. We got some stickies. We've got an AI agent node. If I quickly just move things around, move this to the very top. Okay. We have some Slack trigger. It's telling us what it's doing, which is it's listening for new messages. We have a filtering bot. This message data goes to the AI agent that then calls OpenAI. And what's cool is if you double click here, um you'll see it's already configured it to 4.0. Okay, in terms of the prompt, if we double click, it has taken the onus of creating a prompt because again that's part of my instructions. So the prompt engineering is also taken care of. And then the tools are set up. It ends up back in Slack with the Slack response. So, it's carried out pretty much the entire workflow from such an individually basic command.

And that's pretty much it. So, you can take my prompt, all the knowledge-based stuff that you'll find in the description below, replicate my Claude project, and start being able to create and replicate existing workflows that you see wherever on the web just through a snapshot. And if you found that valuable, let me know down in the comments below and give a like to the video. It doesn't only help the video, but the channel as well. And if you are a business owner, CEO, or business leader, and you love tips and tricks just like this, we do things like this on the exclusive content side in our paid early AI adopters community pretty much every week. So check out the second link in the description below, apply, and maybe I'll see you inside. I'll see you next time.