Apply AI-generated code changes to your VS Code project with ReptClip
Job to be done: Apply AI-generated code changes to a project in VS Code
🇳🇬 Ways to use this in Nigeria
Ideas to get you started, adapt to your situation.
- Student
Fix bugs in your Python assignment code by pasting it into an AI chatbot and applying its suggested changes via ReptClip.
- 9-5 employee
Refactor a small JavaScript function in your VS Code project by sending it to an AI chatbot and applying the diff with ReptClip.
- Entrepreneur
Quickly add a new feature to your web app's frontend by getting code suggestions from an AI and applying them with ReptClip.
What you’ll get
You’ll be able to quickly send parts of your VS Code project to a free AI chatbot, get code changes (also called ‘diffs’), and apply them back to your files with a single click. This approach streamlines the process of using AI for code modifications, avoiding manual copy-pasting of code blocks and reducing errors when applying changes. It’s especially useful for making quick updates or refactoring small sections of a project.
Tools you need
- VS Code (free): A popular code editor where you will manage your project and apply changes.
- ReptClip (free): A VS Code extension that helps you send project context to AI chatbots and apply their suggested code changes.
- AI Chatbot (freemium): A conversational AI tool like ChatGPT, Claude, or Gemini, which will generate the code changes based on your project context and prompt.
Steps
-
Install ReptClip: Open VS Code. Go to the Extensions view (you can usually find it by clicking the square icon on the sidebar, or by pressing
Ctrl+Shift+Xon Windows/Linux orCmd+Shift+Xon macOS). Search for “ReptClip” and click “Install”.- You should see the extension installed and a new “ReptClip” tab appear in the bottom panel of VS Code.
-
Open the ReptClip tab: In VS Code, look for the “ReptClip” tab in the bottom panel (where Terminal, Problems, and Output usually are). Click on it.
- You should see the ReptClip interface with an input field labeled “Files to include”.
-
Specify files to include: In the “Files to include” input field, type the names of the files you want the AI to consider. You can use patterns like
**/*.ts(for all TypeScript files) or specific file paths (likepage.tsx). PressEnterorTabafter each file to add it.- Example from source: The author added
page.tsxandAGENTS.md. - As you type, you’ll get suggestions. If a file matches, its name will turn green; otherwise, it will be yellow. The order you add files is preserved in the context.
- Example from source: The author added
-
Copy project context: After adding all desired files, press
Enteragain.- The project context (including your project’s file structure and the content of the specified files, along with instructions for the AI on how to format its response) will be copied to your clipboard. You should see a notification confirming this. The context will look similar to the example provided in the source, starting with
# Project structureand then the content of your files.
- The project context (including your project’s file structure and the content of the specified files, along with instructions for the AI on how to format its response) will be copied to your clipboard. You should see a notification confirming this. The context will look similar to the example provided in the source, starting with
-
Paste into an AI chatbot: Open your preferred free AI chatbot (e.g., ChatGPT, Claude, Gemini) in your web browser. Paste the copied context into the chat input field (press
Ctrl+Von Windows/Linux orCmd+Von macOS).- The chatbot’s input field will now contain your project context.
-
Write your prompt: Below the pasted context, type your request for the AI.
- Example from source: The author’s goal was to “redesign my website’s landing page”.
- The author doesn’t share their exact prompt; a starting point:
Please redesign my website's landing page (page.tsx) to improve its visual appeal and add a clear call-to-action button. Provide the changes in the Search/Replace block format you were given.- Send your message to the chatbot.
-
Get AI-generated diffs: The chatbot will generate code changes in a specific format, typically inside a code block. This format uses
SEARCHandREPLACEblocks for each file modification.- You should see the chatbot’s response containing one or more code blocks with the suggested changes. The format will be similar to the example shown in the source, starting with a file path like
src/models/user.pyfollowed bySEARCHandREPLACEsections.
- You should see the chatbot’s response containing one or more code blocks with the suggested changes. The format will be similar to the example shown in the source, starting with a file path like
-
Copy the diffs: Copy the entire code block containing the AI-generated diffs to your clipboard.
- Make sure to copy the entire block, including the file paths and
SEARCH/REPLACEsections.
- Make sure to copy the entire block, including the file paths and
-
Apply the diffs in VS Code: Go back to VS Code and the ReptClip tab. Click the “Apply Diffs” button.
- The extension will read the diffs from your clipboard and apply them to the specified files in your project. You should see your files update with the new code. If there are any issues, ReptClip will usually provide feedback.
Original source
This workflow was shared by effessdev on the DEV Community blog. It demonstrates how the ReptClip VS Code extension can be used to integrate AI chatbots into your coding workflow for applying code changes efficiently.
Notes & variations
- Free-tier alternatives: The workflow explicitly mentions “free chatbots,” so any freemium AI chat service (like ChatGPT, Claude, or Gemini) will work.
- Common mistake: A common pitfall is not copying the entire diff block from the AI chatbot, or the chatbot generating diffs in a format ReptClip doesn’t understand. Ensure the AI’s output strictly follows the
SEARCH/REPLACEblock format shown in the example. If the AI doesn’t follow the format, you might need to refine your prompt to explicitly ask for changes in “ReptClip format” or “Search/Replace blocks”. - Tip for better results: When providing your prompt to the AI, be as specific as possible about the changes you want. For example, instead of “redesign my landing page,” try “redesign
page.tsxto add a new hero section with a call-to-action button, using Tailwind CSS classes.” Also, review the generated diffs carefully before applying them, as AI can sometimes introduce errors or unexpected changes.