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.