Using ChatGPT - Genie AI in VS Code to Explain, Refactor and Test Rails Code

Matthew Berman demonstrates a 2023 VS Code extension on a Ruby on Rails project and examines the limits of its code context.

MBMatthew BermanIntervenant · Forward Future
Chaîne
Matthew Berman
Publié
1 avr. 2023
Vidéo
7:48
Lecture
3 min
Diapositives
3
Original
anglais
Ouvrir sur YouTube
En faisant défiler, la vidéo se réduit en bas à droite et continue. Les sous-titres suivent votre langue de lecture.
Langue de lectureDisponible en 2 langues
Cet article n’est pas encore disponible en français ; il s’affiche dans l’original en anglais.
RÉSUMÉ

En 30 secondes

In April 2023, Matthew Berman tries ChatGPT - Genie AI while waiting for access to GitHub Copilot X. He demonstrates explanations, optimization, problem finding and test generation on Rails code, and notes that he cannot confirm whether the extension sees the whole repository.

  1. 1Six code actionsGenie presents actions for tests, potential problems, optimization, explanation, comments and completion.
  2. 2Explain a state machineThe extension describes the AASM states and events in a Rails webhook model.
  3. 3Shorter association helperThe proposed rewrite reduces the example from 45 lines to 21, although length does not prove equivalence.
  4. 4Generate a testOne suggested test compares the associated company public ID with the value exposed through the customer.
  5. 5Context remains uncertainBerman can select code for prompts but does not verify full-repository context.

À retenir

  1. The extension offers shortcuts for explaining, optimizing, testing and completing selected code.
  2. A state-machine explanation and an association-helper refactor demonstrate its workflow on Rails code.
  3. Generated refactors, tests and security recommendations need human review and execution.
  4. The demonstration does not establish that Genie has access to an entire codebase.
  5. The model support and availability discussed reflect April 2023.
TEXTE INTÉGRAL

Lire le texte remanié, chapitre par chapitre

Transcription seule
01

Installing Genie AI

Berman introduces the extension as an option while he waits for Copilot X. He describes its API key and model support as observed in 2023.

I have used GitHub Copilot for a long time and found it saves me time. In this April 2023 tutorial, I explore a VS Code extension while waiting for access to the newly announced GitHub Copilot X. The extension I chose, ChatGPT - Genie AI, worked immediately with my Ruby on Rails project, whereas another extension I tried did not.

At the time, Genie required an OpenAI API key and appeared to support GPT-3.5; I expected GPT-4 support to follow, but that was a prediction, not a feature I demonstrated. After installing it, open the Genie icon in the VS Code sidebar. Its interface offers a prompt box, temperature choices, saved shortcuts, and six actions for selected code.

02

Explaining a Rails state machine

The sidebar offers actions for selected code. Genie explains an AASM webhook model.

Genie actions in VS Code
DIAPOSITIVE 1 / 3Genie actions in VS CodeThe sidebar shows six code shortcuts next to the Rails webhook model.

The buttons add tests, find potential problems, optimize, explain, add comments and complete code. I have found test generation particularly useful. For optimization, I have previously given it code I knew was unnecessarily complex and received a shorter, clearer version that passed my tests; that experience does not guarantee every generated change preserves behavior.

Explain can help when entering an unfamiliar codebase: select a method or file and ask for an explanation. I have not extensively tested the comment generator, and I wonder how much the ability to ask for explanations changes the need for comments. Code completion resembles a function GitHub Copilot already offered.

First I select a Rails webhook endpoint model. It uses the AASM gem to manage states such as active, paused, archived and disabled. Genie explains the state machine and its events, and I find the description accurate. The example suggests a way to navigate unfamiliar Ruby code, including code that uses metaprogramming.

03

Refactoring and finding issues

Berman examines an association helper, asks Genie to shorten it, and reviews its suggestions. The proposed changes still require verification.

Next I examine an AssociatedPublicIds file, which creates public IDs for associated models so the API does not expose sequential database IDs. I select the code and ask Genie to explain it. Its response identifies methods returning public IDs from associated records, which matches my intent.

Association helper before and after optimization
DIAPOSITIVE 2 / 3Association helper before and after optimizationThe side-by-side view compares the original with the shorter generated rewrite.

I ask Genie to optimize the file. The resulting version consolidates similar has-many, belongs-to and has-one logic, reducing the displayed code from 45 lines to 21. It looks cleaner to me, but shorter code alone does not establish equivalence: generated changes still need review and tests.

The Find Problems action flags possible issues: dynamic constant lookup could be risky if a class name comes from user input; dynamically defined methods can make maintenance harder; and the safe-navigation operator requires Ruby 2.3 or later. I agree that the metaprogramming may be too fancy, and I learned about the version constraint. Genie suggested Module.const_get as a safer alternative, but changing the receiver alone does not validate untrusted input; its suggestions need scrutiny.

04

Tests, settings and context

A generated test checks an associated public ID. Berman explores temperature presets and saved prompts, then explains his uncertainty about repository-wide context.

Generated tests for public IDs
DIAPOSITIVE 3 / 3Generated tests for public IDsThe displayed tests include an assertion for a customer’s associated company public ID.

I then select the code and ask Genie to add tests. One generated example asserts that a customer’s company public ID equals the associated company’s public ID, which is the relationship I expect. The generated test is a useful starting point; the demonstration shows the code rather than a full test run.

The interface provides Precise, Balanced and Creative temperature options. Temperature affects the variability of responses; I guess that the presets correspond to values such as zero and 0.5, but I do not verify their exact settings. The star button lets you save custom prompts as shortcuts, such as an instruction to implement tests.

My major concern is context. In the interface I can select the code passed to a prompt, but I have not figured out how to ask questions with the whole codebase as context. I speculate that Genie might have more project context, while acknowledging I could be wrong; the video does not demonstrate that it sees the full repository.

I would like a tool that can answer questions across the entire project rather than only the open file and highlighted code. Even with that limitation, I find this extension useful, and I hope the forthcoming Copilot X will address some of these rough edges.

Sur la même chaîne

12 diapositives34:21EN
Matthew Berman· 27 oct. 2026Matthew Berman Examines Anthropic’s IPO Filing, AI Growth and GovernanceMatthew Berman, Sam Altman · Forward FutureThe presenter reviews the S-1’s financial metrics, compute strategy and voting structure while questioning the tension between rapid AI development and safety.AnthropicAI SafetyIA en entreprise+2
2 diapositives0:36EN
Matthew Berman· 25 oct. 2026Kimi K3.1 and a Rubik’s Cube Solver DemonstrationMatthew Berman · Forward FutureMatthew Berman shows a scrambled virtual cube being solved and gives the Kimi K3.1 test a favorable assessment.ÉvaluationsAgents de codeOpen-weight models
6 diapositives25:50EN
Matthew Berman· 24 oct. 2026Kimi K3.1 Pro Tested: Strong 3D Demos, Uneven Results and Competitive PricingMatthew Berman · Forward FutureMatthew Berman tests the open-weight model on coding, 3D rendering and visual explanations, then compares benchmark results and prices.Open-weight modelsBenchmarksAI cost & performance+1
2 diapositives32:20EN
Matthew Berman· 23 oct. 2026Who Is Local AI For? The Costs, Trade-offs and a Hybrid FutureMatthew Berman · Forward FutureMatthew Berman weighs data control and independence against hardware cost, setup complexity and inference speed.Local inferenceOpen-weight modelsAI cost & performance+1
6 diapositives1:03:37EN
Matthew Berman· 23 oct. 2026Matthew Berman’s Team Tests Kimi K3.1 on Animation, Games, and ChartsMatthew Berman, Alex, Brian · Forward FutureA live team AMA turns into an informal test of Kimi K3.1, from personal-agent workflows to motion graphics, a browser game, and a benchmark chart.Agents de codeGenerative mediaÉvaluations+2
0:53EN
Matthew Berman· 22 oct. 2026Sam Altman on AI and the Discovery of New KnowledgeSam Altman · OpenAIAltman expects progress in mathematical discovery to extend to biology, materials and energy.AI for scienceMathematicsComputational Biology+1