Let Claude Code Watch Your Deploys While You Sleep
Skills:
AI Pair Programming85%
Key Takeaways
Use Claude Code to automate repetitive tasks and improve code quality with continuous feedback loops
Full Transcript
Today, we are going to solve two problems. In fact, there's one problem, but then we need two solutions for it. The first one is the most talked command or {slash} command by Cloud Code, and that is {slash} loop. Now, think about this. See, when you build application, and the way we build application is changing now. So, initially, we used to go in a traditional way where you have to write the code, you have to write the test cases, then you have to also I mean, once you complete the entire project or maybe a part of feature, then you basically deploy it on the cloud. And then, you also build a pipeline there, right? And if you have experienced pipeline, and that is something which I struggled a lot. First of all, building the entire pipeline takes time, and once you write the entire code, the actual build takes time. Now, when you start the building, it will do everything. It will package your application. It will do the test cases, uh whatever test cases you have written, whatever way of testing you have defined. And then, it will start pushing it on the cloud. The entire pipeline goes there, right? Now, in this scenario, when you have this entire pipeline, it takes time. And what you do is you sit there, you manually babysit the entire flow. You sit there and check, is it is it is it complete? Is it complete? Not because you want to see it is build, you just want to make sure nothing fails, right? And then it fails, then you have to go back and do something. And as a human behavior, we have this kind of scenario where if something is building, you don't start working on something else. I mean, that's a human nature. Uh and at this point, let's say if you open your phone or if you open your laptop to check, is it is the build passed? You open a different tab, and then you get into it. Okay, maybe I'm just talking about myself. Open YouTube, watch some videos, maybe if you're checking on phone, you open the Instagram, and then you know how your 1 hour goes there. Okay, so the that's not the main problem here. The problem is you are babysitting the entire pipeline here. That's one. The second part is, let's say PR. If you have raised a PR, you worked on some branch and then you raised a PR now, and at this point again the build will happen and then you are waiting for someone to complete your PR to test to check everything is working or not. Now, what if this thing can be automated? And we are living in the world of automation now. So, basically Cloud Code can help you there. But there's one little problem here. So, the first problem we have talked about, you don't want to manually babysit. The second problem is let's say you automate that process now and using something. Okay, we have not talked about what is that something, but let's say you automate that process where something will check things for you. If the pipeline is completed or not, the it will handle the PR for you as well. And if you can do that using some automated process, maybe using Cloud Code. Now, in this scenario, you have to keep your session on and that means at the airport, you have to keep your laptop on. And maybe you have seen this, right? So, people don't walk now by closing the laptop, they walk at the airport or different places by keeping their laptop on because the agents are running behind. And one of the agent is this where which checks if the build is complete or not. The same problem I faced. So, let's say if I'm working on this video laptop and now if I want to continue the same thing, I will go to my home and then I have a different machine there to work with. And maybe I am recording, so I I use a different machine for the recording. What if I can manage this session between different laptops? And that's where we get one solution, which is Okay, I will not talk about the solution, but this solution is given by the sponsor of this video, which is Hostinger. And I will talk about the entire process. So, you got the problem statement, right? What we are trying to solve? And now let's get started. Okay, so if you go to Hostinger, of course you need to have an account there. The service which you are going to work with is the VPS and we all know the importance of having your own VPS. But we'll talk about that in some time. Let's start with the first problem solution, which is the loop. Now, what is {slash} loop, the most talked command from last for last few months? And to explain that, let me show you a demo. So, we are going to do this demo on two machines, one on my local machine, and then we are going to do that on VPS. And then you will see the importance of it. So, first I will open my VS Code. Now, this is the VS Code in which you can see there's a project, and I'll just zoom it a bit. So, there's a project, and this is a loop demo. Now, imagine this is the actual project. So, your job here is to build this pipeline. I know we and we know when you build a pipeline, it takes time. It can be 1 minute, 2 minutes, 10 minutes, 20 minutes, half an hour. It depends upon what are the steps in between. Okay, so if you're not doing all the testing part, it's very fast. But, what if you want to check out a lot of stuff? There are different tools available to check different stuff. So, in that case, it will take time. Now, I don't want to show you the entire process CI CD. It will take a lot of time to do that. What I did is I created this dummy script here, which is fake build ps1, and you will find the link in description somewhere. Now, using this script, I can just fake it. You know, something is building. So, uh there's a sleep, and it will say build started, resolving dependencies, uh compiling the auth, compiling the API, databases, and running the test suite, and then it will at the end it will say build finished. But, it will take some time, maybe more than 2 and 1/2 minutes. So, this is a fake build. And the way I can run this is very simple. I can just say {dot} {slash} Okay, Windows uh scripts {slash} fake build {dot} ps1. And the moment I do that, it will run. I think the only thing is you have to add this extra command here, which you can see on the screen, if this is not working. Sometime it gives restrictions that you can't run this type of script directly. So, you can see on the command, just use that. So, this script is running, which will take some time, and this thing will be done in the build log. This is where it says build started resolving dependencies. In fact, what I will do is I will just do that once again to show you. So, the moment you start this, it will say build started resolving dependencies, and after some time it will do other stuff. After every command I just say "Okay, so there's a sleep." Now, what you can do is you can just babysit this. Not manually, automated. And this is where loop comes into picture. So, what I will do here is I will open cloud here and cloud code. Just close this. So, there are two windows. So, one is the build is happening, and we'll start this once again with the command. Now, at this point I will just use loop here. You can see there's a loop, and there are multiple ways to do this. One is you can directly say loop, it will have its own way of doing it, uh default configuration. Second, you can mention the interval. So, you can see loop then interval, let's say I'm saying 45 seconds. So, in every 5 45 seconds it will run a recursive prompt. So, if you can go to the documentation, that's what they are saying. So, if you want to run a prompt repeatedly, you can do that with the help of loop. Okay, so you can have these three types: loop, uh 5 minutes check the deploy. So, every 5 minutes it will it will check the deploy status. Then you can skip the time. You can directly say check the deploy. It will have its own time intervals, and cloud code will decide that. Then you can simply say loop. So, it will run the build in maintenance prompt, or you can also mention something in the loop.md. So, if you can see, I have this file here, which is loop.md, and the same steps here. Uh if the last line says build succeed, tell me the build is done and summarize. Okay, one or two lines maximum. So, we can do that. But here, let me just go with the first way, which is specifying the time, {slash} loop 45 seconds, and then then you can mention the thing which you want to do. So, I will say check the CI, or I can say build status from build.log, and give me one line status. Okay, now this is the loop which I'm running. After every 45 seconds this will send this prompt. No syntactical stuff, just simple English. Okay, and I will just also open my build.log which is at this point, but when I restart this this will start again. Okay, so let's try. So if I start this script, let's say you're building something and also at the same time I will just run this loop. Let's see what happens. Okay, so 45 second round up to the con minimum of 1 minute. Okay, yeah. So it will create a job ID which it is creating now. Build status. Okay, where is the job ID? Oh, it's here. Job ID is here. And this con job started. So build status, you can see build status is build started because that's what it's reading now. Uh currently resolving dependency, that's what it has read. In progress, no yet errors yet. So then we have to wait for 45 seconds more. I should have done that for 30 seconds, you know, it's getting lengthy for the video. But I'll tell you the main problem. So let's say this is happening, okay, and at this point the build is very simple, which will be completed in 2 and 1/2 minutes. But let's say this is a big process. Maybe you're waiting for the PR and you are working on different time zone, your team is working in different time zone, and then you're in the entire night you have to wait uh if the PR is done. So you will stay awake and check if the PR is approved or not. Now, instead of that, what if you can just run this loop and then it will automatically check for you. And don't you You don't have to stay awake the entire night. Okay, I'm just waiting for 45 seconds more. Um I hope I said 45 seconds, not 45 minutes. Oh, 45 seconds, yeah. Okay, it will take some time. But there's one little problem with that. You have to keep your laptop open. Otherwise, the moment you shut down your laptop or if you just keep going to sleep and your if your session freezes for 10 minutes Cloud Code will close the session. And then after that you can't continue running loop. That's the problem we are trying to solve. Okay, you can see it has running again, so it says compiling complete because that's what you can see here. And test suit now running. That's what happened after 45 seconds and again we have to wait for 45 seconds and it will just keep it reading this. Okay, so coming back to the problem, I have to keep my laptop open and that's what you can see at the airport also they do that. I never did that because I don't code at the airport anyway. Uh but I was thinking, you know, if if I have to do that, if I have my AI server running continuously I would monitor it. And that's where you can use something called a VPS. Now VPS is virtual private server which you can run on the cloud and it can it will run for you 24/7. This type of work is very easy when you have a VPS. And Hostinger provides you with that service. So when you go to Hostinger the first thing you need is account and I do have an account here. So let me log in with my credentials and it will take some time. So it's very easy to create an account on Hostinger just have to sign up have your account there. Now once you have your account, the next step is to have a VPS. Now Hostinger provides you a lot of services. Uh so you can use it for the website hosting, you can use it for website builder, Node.js. I mean you can run your servers there, but I'm interested at this point in VPS. And one of the best feature about VPS from Hostinger is you get a lot of things pre-built. So let's do that. So I will say VPS hosting setup and this will ask you for the location and since I'm using it from Mumbai, I'm going to select that. Click on next. And this is what I was talking about. So let's say, of course you can choose your OS by default it will be Ubuntu I guess. But let me just go to the application. And here you can see there are a lot of options and I'm interested in cloud code. So just use cloud code and this cloud code will be running on your VPS. So once you run the loop, you don't have to keep your laptop on. The server will be on for you. So I'll click on select. You have to set some password here. At this point, I will click on generate. Next. Uh you can set the malware scanner and auto backup, but I just paid. I will just go with the malware scanner. Next. And there are different plans available here. I think KVM 2 is enough. KVM 1 is bit less come If you can see, we only have 4GB RAM. At least 8GB RAM is required if you want to run your cloud code, if you want to write the code as well, if you want to run your code. So, KVM 2 is required. Other plans depends upon your kind of work. You can select KVM 2, do the setup. And to make this setup even more cost-effective for you, make sure that you go to description. There's a link. Click on that link. And once you select KVM 2 plan and add to your card for 12 months, you can use a coupon code that is code for 20% flat discount. Now, once you complete your checkout, so you can see I already have my VPN setup here. Now, the only thing is this will be Linux-based. And demo which I've shown you is based on Windows. So, you will find another link for the same example for the Linux and Mac. So, let's try that. So, I will go to my VPS and I'll click on manage. Okay. Now, this is my VPS running behind. Okay. So, the the way I can use this is I don't want to use that terminal. Of course, you can click here and you can execute the commands. It's straightforward. But I want to get this control from my machine which I'm using. So, if I'm using this recording machine, I'll be accessing this. If I'm using my personal machine that, I'll be using that for the connection. So, terminal is good, but not for my use case. So, for my use case, what I will do is I will use SSH. So, I will just copy this. So, you can see that you can get the root access from this. And by the time you watch this, I will shut down this. So, let me open the terminal. And here, I will do the SSH. Enter. I'll say yes. Password. Now, this is a password which you have to remember when you set the VPS. I hope I've entered the right password. Yes. Okay, now I I got the access to my server. Perfect. Now, from here you can check Now, when you created this VPS Cloud Code was selected. So, Cloud Code will be by default installed. For example, you will also need Python. So, let's verify if you have Python. Uh okay, I think we have Python 3 here. Okay, Python is there. We will also need Git. Okay, Git is there. So, by default you will get Python, you will get Git, and Cloud Code since you selected that. So, all the development tools mostly are there. I'm not sure if we have Java there. If not, you can install. It's your own private server. Okay, Java is also installed. So, this is developer-friendly. That's perfect. Okay, so I can basically use my personal terminal. This is my terminal, and I can do the SSH. I can connect to the VPS. But, now I also want to write the code because the code which you wrote here is in my machine. And I want this code in the VPS. How do I do that? First of all, it's very simple. You will find the link in the description, and you can just get clone the project, but not here. On the VPS. So, what you can do is you can just open your terminal once again. And if you can see, I have already created the project there. But, if you don't know that, it's fine. You can check your current folder. And you can create a new folder which you can say mkdir, and whatever folder you want to say, let's say temporary. And once you have that folder, just go there and get clone. So, get clone, and you'll find the link for the Git there. Just paste it here. And you will get the project. And I already have that project, so I will just say, "Okay." I'm just my work my present directory. That's great. I will say go to projects, and there's a project which is Cloud Code or Cloud Loop Demo, the same project, but for Linux. Okay, now I want to open this project in VS Code. Okay, I don't want to write the code here. Of course, I can go inside, I can check the files, but how do I connect with VS Code? That's very simple, actually. In VS Code, you just have to add one extension, which is this, remote SSH. So, search for remote SSH and install this. And make sure it's from Microsoft, okay? Because there might be other SSH and uh there may be some issues. So, go for the Microsoft one, remote SSH. And once you have that, just click here, and this is how it will look like. You just have to connect now. So, click plus here, and pass your SSH link. So, SSH root, and whatever the IP is, enter, and you can add this in your SSH config of your particular machine, and connect it. The only thing is when you click on this, it might ask you for the password, okay? Uh Linux. Yeah, it will ask you for the password. The only if you don't want to do that, just create SSH uh keygen, and this will be connecting, and this will open a new window, okay? The earlier project gone now. Okay. There's a problem with the password, is it? I hope I'm entering the right password. Okay, that's done now. So, on the server, it will install the VS Code. Or it will already It will already have. Okay, so now I can I can just go back here, click on open folder, and this will list all the things in your VPS. Click on projects, cloud loop demo. This is a project. I will click on okay, and you got the same project. Perfect. Okay, it's asking for me for the password multiple times. I should have done that. Whenever you connect to the VPS, this is important. Create the SSH keygen, and that will save that. Okay, so this is we We here. I think by default you'll not be having Cloud Code there. Uh so you have to add this extension which is Cloud Code. So just go here and add Cloud Code which I did all already. And go back to Cloud now. Click new session. And I want terminal not the GUI. Okay, so I got the Cloud Code session there. Okay, perfect. So this is Cloud Code running here and I will use the same command which I've used before which is loop. I'm not loop here. I was typing here {slash} loop 45 seconds. So maybe this time let's go for 30 seconds and I will say check the build status in build.log. Okay, I will also have my build open which is I've done this test before making this video and that's what you can see here. And now let's run this. Let's run the script. The only thing is this is for bash which is for Linux and Mac. Uh I'll just run this now. So so scripts {slash} fake build.sh. Okay, uh what do you think? Will it work? And if I say enter, so build started. I will just enter for this as well and the same thing will happen now. So you can see 30 seconds is below the cron of minimum gravity. So I will round up to 1 minute. Okay, so for cron job they are at least saying 1 minute. I I was trying 30 seconds so that I can make a video but that's fine. We have to wait for 1 minute I think. But you got the point, right? So normal build takes more time. Maybe 10 minutes, 20 minutes. This will wait for 1 minute. Okay, let it complete. Okay, maybe my editor will cut the between section whenever I'm taking a pause. Hopefully. Uh okay, so the advantage is at this point even if I shut down this machine. Let's say I want to go somewhere now and I can check the build status once I reach home or from my phone. In fact I got we can you can also do that. So, let's say in your phone I will start the screen recording my phone as well. Provided if it is recording properly, I will just ask my editor to do that. I have Termux as the tool in my phone and I can also connect the SSH here. And okay, you can see this is happening. There we go. After 1 minute we got the status. But you can connect with your VPS from phone. I will say root @7 2. Okay, it will ask me for the password. Okay, password entered and now I'm in. So, from this also I can get the status. So, I can open cloud here. Yes, start this project. And I can I can just like run the loop from here. So, instead of executing the loop there, I can even run the loop here. Okay, that's the beauty. So, you can see all uh three models compiled successfully. Now it's in the test phase. Perfect. By the time it is happening, you can also type something else and you can keep your work going. Uh so, I can say explain the project. And it's not like you have to wait for cron job to complete. It's it's running in the back end. Let me try to run the loop from here. Okay. So, then you from the phone now. At least you can keep your phone unlock while traveling. Okay, multiple directories. Okay, I should have mentioned mentioned the file name as well, where to check. Okay, but you got the point, right? Okay, next check it will do at 2:50. Okay. >> [laughter] >> I should have mentioned the time. Uh so, that's the power of slash loop and that's how you can use Hostinger to host this. So, thank you Hostinger for sponsoring this video and got a chance to explain something real to everyone. And the loop is complete, the build is finished. Looks good. So, thank you so much for watching. See you next time.
Original Description
The `/loop` command in Claude Code enables an iterative development workflow where tasks can be analyzed, refined, and executed repeatedly with minimal manual intervention. Using a simple demo project, we explore how continuous feedback loops can help improve code quality, automate repetitive tasks, and streamline the overall development process.
Checkout Link: http://www.hostinger.com/in/telusko
Use code TELUSKO to get a 20% discount on your Hostinger plan.
For this setup, we are also using a dedicated Hostinger VPS, which gives a clean remote environment to run Claude Code, manage development workflows, and work with cloud-based infrastructure smoothly.
Source Code:
https://github.com/teluskoOrg/claude-loop-demo
#claudecode #hostinger #vpsara #aicoding #developertools #telusko
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
More on: AI Pair Programming
View skill →Related Reads
🎓
Tutor Explanation
DeepCamp AI