YouTube Deep SummaryYouTube Deep Summary

Star Extract content that makes a tangible impact on your life

Video thumbnail

This Cursor AI Setup Is a Smoking Gun (And it's FREE)

AI LABS โ€ข 2025-05-22 โ€ข 9:38 minutes โ€ข YouTube

๐Ÿค– AI-Generated Summary:

How to Use Shotgun Code and Gemini 2.5 Pro to Overhaul Your Codebase with AI

If youโ€™ve ever handed over your entire project to an AI hoping it would magically fix everything, only to find the results disappointing, youโ€™re not alone. Recently, I faced a similar challenge with my Next.js app. I gave an AI full control based on an implementation plan, but the app was built incorrectly. With many issues to resolve, I discovered a powerful tool called Shotgun Code, combined with the Gemini 2.5 Pro language model, that transformed the way I approached fixing and improving my app.

In this post, Iโ€™ll walk you through my experience using Shotgun Code to analyze and refactor a large codebase, how I leveraged Google AI Studio with Gemini 2.5 Pro to generate precise code changes, and how I applied those changes seamlessly. By the end, youโ€™ll understand how this new workflow can help you overhaul your projects efficientlyโ€”even without proper documentation or an implementation plan.


What is Shotgun Code?

Shotgun Code is a GitHub project designed to help you give your entire codebase as input to a large language model (LLM). It generates a comprehensive prompt that can be fed into high-performing LLMs like Gemini 2.5 Pro. The AI analyzes the entire project and outputs a detailed diff or patch file suggesting exactly what changes to make and where.

Key Advantages:

  • Handles entire codebases, not just snippets.
  • Creates huge context prompts to ensure the AI understands your project fully.
  • Outputs precise diffs with references to specific files.
  • Allows recursive implementation of changes, improving the project iteratively.

Setting Up Shotgun Code

Prerequisites:
- Go programming language installed (easy to install via a single command).
- Node.js installed.
- Wails CLI installed for running the app.

Installation Steps:
1. Clone the Shotgun Code repository.
2. Run the provided install script in your terminal.
3. The script will install front-end dependencies and set up everything.
4. Run the app with the command provided in the repoโ€”it automatically handles directories.

Once launched, youโ€™ll see the Shotgun Code app ready to analyze your project.


Preparing Your Project for Analysis

Shotgun Code requires you to select the specific folders from your project that are relevant to the changes you want. Large projects often contain many dependency files or docs that arenโ€™t necessary for the AI context.

Tips:
- Uncheck large folders like node_modules or .next to avoid exceeding context size limits.
- Exclude documentation files (.md files) unless they are crucial.
- Keep key files like package.json to provide dependency context.

By carefully selecting only whatโ€™s needed, Shotgun generates an accurate project context without hitting size limitations.


Composing the Prompt for AI

After preparing the context, you write a clear task description in the appโ€™s prompt section. For example, I wanted to replace custom React components with Shad CN components. The prompt section allows you to:

  • Write your user task in plain language.
  • Add any custom rules or restrictions (e.g., avoid certain libraries).
  • See a structured, LLM-friendly prompt generated automatically.

This prompt can then be copied and pasted directly into an LLM interface.


Using Gemini 2.5 Pro in Google AI Studio

To get your diff output, you paste the generated prompt into Google AI Studioโ€™s Gemini 2.5 Pro model.

Steps:
1. Select Gemini 2.5 Pro (not Flash).
2. Set temperature to 0.1 to minimize creativity and ensure the model strictly follows instructions.
3. Paste the entire prompt and run the model.

The model processes your entire codebase context and returns a diff patch file with all necessary code changes.


Applying the Changes

Shotgun Code plans to add direct patch application within the app soon, but for now, you can use tools like Cursor or Windsurf to apply the changes.

  • Paste the diff prompt into Cursor.
  • The model executes file updates based on the diff.
  • You may experience some pauses or questions from the AIโ€”switching models (e.g., to GPT-3.5) can speed this up and reduce interruptions.

My Results: Overhauling a Slow, Buggy Next.js App

Using this approach, I made several major improvements to my app:

1. Performance Boost

  • The original app was sluggish with jittery animations and slow loading.
  • After AI refactoring, scrolling and interactions became smooth and responsive.

2. UI Improvements

  • Initially, switching to Shad CN components made the UI look worse.
  • I instructed the AI to use Aseternity UI components, resulting in a clean, minimal design with dark/light mode support.

3. Improved User Flow

  • The original workflow assigned one task per hour, which felt awkward.
  • I reworked the flow to allow flexible time period entries with a streamlined popup.
  • The resulting UI looked modern and intuitive.

Why Shotgun Code is a Game-Changer

This method offers a fresh alternative to traditional refactoring approaches:

  • No need for exhaustive documentation or manual code reviews upfront.
  • The AI scans the entire project holistically and understands dependencies.
  • Single prompt input triggers comprehensive changes across the codebase.
  • Great for legacy projects or AI-generated codebases with missing context.

Final Thoughts

If youโ€™re struggling to maintain or overhaul a complex codebase, Shotgun Code combined with Gemini 2.5 Pro offers a promising new workflow. It leverages large language models to generate actionable, precise patches, saving you hours of manual work.

While still evolving, this toolchain is a powerful example of how AI can assist developers in large-scale code transformations.


Ready to Try It?

  • Install Shotgun Code from GitHub.
  • Prepare your project context.
  • Generate and execute prompts in Google AI Studio with Gemini 2.5 Pro.
  • Apply patches with Cursor or Windsurf.
  • Watch your app transform!

If you want to learn more about AI-powered development tools and workflows, be sure to subscribe to channels and follow communities focused on AI in software engineering.


Thank you for reading! If you found this guide helpful, please share it with your developer friends and stay tuned for more tutorials on AI-assisted coding.


๐Ÿ“ Transcript (285 entries):

Let's just say you have a code base right here like I do and you want to make lots of changes to it. I have a Nex.js app here and I messed up a lot in it. I actually gave AI full control and it built everything based on the implementation plan but it built the whole app wrong. And now there are a lot of things I want to change. I found something that I thought was pretty cool. It's a GitHub repository called Shotgun Code. And what it basically does is allow you to give your entire codebase to it. It generates a prompt and then you give that prompt to any good performing LLM like Gemini 2.5 Pro and implement changes recursively as I've written right here. You save your context with Shotgun by providing it the whole codebase and it creates a truly gigantic prompt here. They're using Google AI Studio and it's going to return a massive patch for your code. It will tell you what things to change and exactly where to change them. Google AI Studio gives 25 free prompts per day which is pretty good. After that, you just drop the change file or the diff file into cursor or windsurf and apply all the changes in a single request. That's how powerful this is. I'm going to show you how to install it, how to get it up and running. And I'll also show you how I took my app, which had a lot of problems and completely overhauled it. No implementation plan, no proper documentation, just used Shotgun and transformed my entire project. First up, we have our installation. Just for the prerequisites, you need to have Go installed. The Go programming language. It's really easy to install. Just ask chat GPT. It's one command. This command right here will check if you already have Go installed or not, and you can use that to confirm. Then you need to have Node.js installed, and you also need to have the Wales CLI installed to actually use the app. The installation command for Wales is right here. I'll leave it in the description below so you can check that out. The actual install is pretty much this entire block. You just copy it, go into your terminal, paste it in, and it will install the shotgun code app for you. I already have it installed, so I'm going to go inside the directory. If we go back to the GitHub repo, you don't need to do anything else. You just paste this command followed by this one. It is already going to change the directory for you and install the front-end dependencies as well. Just copy this, go back, and in the root of the project, as you can see right here, you don't need to manually cd into the shotgun directory. That's already handled. Just run this command and it will fire up the app for you. Now you can see the app has opened up and we can actually start using it. Now that we've opened up the app, let me give you a general overview of how to use it and what's inside. The first step is preparing the context. This means selecting your project folder and opening it. The app I told you about, time track copy, is the original app and time track is the version I made edits to. For now, let's just open the original app because we're not going to make any changes. When we open it, you'll see an error saying there was a problem generating the context. The size has obviously exceeded the limit. What we need to do is only select the necessary folders. You'll often find a lot of stuff in your projects that you don't actually need. It's just dependency files. Let's just say we open the main project folder with the front-end app. You'll see a next folder. Uncheck it. Now, we're good to go. Since we're only selecting what's necessary, we can also deselect this cursor rules file. Then we have these MD files. These are just my own documentation, so I'll uncheck those as well. The package.json files define the dependencies, so I'll keep them. Now that the generated project context is ready, we can move on to the next step, composing the actual prompt. This is where you write the task you want to give the AI. Let's just say I want the entire codebase, which was originally built using custom React components to now use Shad CN components. If you look at the prompt section, you'll see it now includes our user task, which is what we just typed. The prompt is structured in a way that's easier for LLMs to read because it's clearly divided and includes additional elements that help them understand it better. We also have a section for custom rules. If you're using specific rules for your project, you just drop them in here. Mine aren't that important in this case, but if your cursor rules file includes something specific, like avoiding a certain library, you can paste that here. After you've written your task and added your custom rules, your finalized prompt will appear right here. You can hit copy all and it will copy the whole thing. Next, we move on to executing the prompt. This step involves going to Google AI Studio and pasting in your prompt. I'll show you exactly how to do that later. Then we have the apply patch step, which isn't available yet. The developer mentioned that these two steps will be added to the app in the future. He will probably use the Gemini API key here and implement a coding agent to run the changes directly. In my opinion, using cursor or wind surf, whichever you prefer, as the task executive works really well. That's a general overview of the application. Now, let's move on to what to do with the prompt you just copied. The next step is going to Google AI Studio and actually getting the diff prompt from the Gemini model. First, make sure you have Gemini 2.5 Pro selected, not Flash, the Pro model. After selecting it, change the temperature to 0.1. The temperature is a measure of how much creativity the model is allowed to use in its output. At one, it's in normal mode. When you force it to 0.1, there is basically no creativity involved at all, meaning it will follow the instructions exactly as given. Paste your entire prompt right here. If you scroll up, you'll see the prompt we generated earlier. Just paste it here. You don't need to add anything extra. Everything needed for the output is already included in the prompt, including what to generate and how to do it. Then run it. it will start processing and provide you with a complete diff. This takes a little time, but it gives you a very solid set of changes, which when implemented will accurately make the changes you want in your app. If you're enjoying the video, I'd really appreciate it if you could subscribe to the channel. We're aiming to hit 25,000 subscribers by the end of this month, and your support really helps. We share videos like this three times a week, so there's always something new and useful for you to check out. After getting the prompt from Gemini Studio, I came back into cursor, typed apply diff, and pasted the prompt right here. This prompt includes all the changes with references to the relevant files that need updating. Gemini processed the entire codebase and gave us exactly the files that need to be changed. Now, we're going to execute our changes using cursor. I have three chats in total, five chats overall, and I made three implementation changes. The reason there are more chats is because in one I had a network error and in another I switched the model from Gemini 2.5. Gemini 2.5 Pro was getting too slow. It had already done the thinking. But another thing Gemini does in cursor which I haven't seen in Windsurf is that it frequently stops and asks the user questions even when it's not specified in the rules file. That's why I switched to clawed 3.5 sonnet and the changes to the code became even faster. This is exactly what I did. Let me show you the changes I implemented. First of all, I improved the speed of the site. The site was very slow. It lagged a lot. The animations were slow and the movement was very jittery. Not a good experience at all. That was the first thing I fixed. I used simple shaden components and for some reason that made the web app look really bad. I asked it to use aseternity UI components only which look really minimal and I also changed the overall workflow or user flow of the app a bit. Here's the original app, timetrack.dev, and you'll notice the slow speed right away. There's visible lag even while scrolling. The loading times are slow, and even hovering over something feels sluggish. Definitely not a good experience. That was the first thing I needed to change. Gemini gave me a prompt that told me exactly what to modify. Here's the new version of the site. As I hover over the tables, you can clearly see it's much smoother. Scrolling is smooth with no jitter at all. Even when adding something via a pop-up, it slides in smoothly. That was the first major improvement performance. Next was the use of aceternity UI. I initially asked it to use shad CN components and it came out looking really horrible. I didn't like it at all, especially the glowing look. I really hated it. If I had just asked cursor to implement the changes directly, it would have only done half the work. The rest of the code base would have been left for me. I'd have to go back and manually tell cursor what parts were missing. It would have been a whole process. But here you can see a clean minimal UI using acetity UI. It looks really good. We have dark and light mode switching. There is some repeated UI, but that's just one prompt to clean up. Not a big deal. Down here, we have the settings to toggle the format, and overall, it just looks great. The next thing I had to improve was the user flow. Previously, I had prompted it to build what's now working well, but in the earlier version, the pop-up was even worse. I didn't like it. I don't know why the UI came out that bad. It basically allocated one task to each hour, which didn't make sense to me. I reworked the entire workflow. Now, I just go ahead and add a time period. Let's just say the category is work. Start time is 4 p.m. End time is 5:00 p.m. Hit save activity. And you can see we now have a nice looking panel and the activity is recorded. This is the refactoring. These are the changes I made to the code. The website looks amazing now. I'm really loving it. The tool is a new way of doing things that hasn't really been seen before. You give the LLM one task, it scans the entire codebase, sees all the connections, and figures out how to achieve that task. It's a nice alternative way to get things done. There are a lot of other approaches like making proper documentation and all that, but if you don't have it, you can just use Shotgun and shotgun your codebase. That brings us to the end of this video. If you'd like to support the channel and help us keep making tutorials like this, you can do so by using the super thanks button below. As always, thank you for watching and I'll see you in the next