Back to all projects

Case study

GPT Code Assistant

A ChatGPT-powered assistant for refactoring and code suggestions, integrated into the editor. Weekend project that taught me how much prompt engineering matters for code-generation tasks.

Role
Personal project
Period
2023-06 → 2023-06
Status
Shipped
Tags
4
PythonOpenAICode generationPrompt engineering

Summary

A small editor plugin that used GPT to suggest refactors and explain code on demand. The interesting part was not the integration; it was discovering that prompt format, context window, and a few-shot examples moved the output quality by an order of magnitude.

What I built

  • An editor plugin that takes a selection and asks GPT for a refactor or an explanation.
  • A prompt layer that wraps the user's selection with format, context window, and a few-shot examples before sending the request.

What was hard

Getting the prompt format right. Without structure, GPT produced plausible-looking code that did not match the surrounding codebase; with the right format and a few-shot example, the suggestions stopped being wrong in interesting ways. The delta between "talking to a model" and "shipping a tool that produces usable code" lived almost entirely in this layer.

What's next

The project lives in the repo and I still use it on my own machine. The wider question it raised is one I have kept working on in later projects: how much of code generation is prompt design versus model design.

What I learned

That experience is what made me take the agentic-AI thing seriously later on.