AI Coding Agents - A Short Guide

Jeremy Allen

Home


LLM Coding agents like Gemini CLI, Claude Code, and ChatGPT Codex are tools for using LLM coding agents to build software. Getting the most out of coding agents takes some practice. This guide will highlight what has worked well for me and what has not.

Basic Terminology

Agent Choices

Agent and tool choice is important. There are a lot of soft opinions about which agent to use and it is a fast changing and competitive landscape. My current strategy is to use all 3. I primarily use Gemini CLI and Claude Code for implementation and Codex as a code reviewer. Gemini offers a more generous amount of tokens and context and seems to do a little better with larger code bases for me right now. Claude Code using Sonnet is also a strong choice, but is easier to use up all of your tokens. Opus tends to do a good job, but also burns through tokens the quickest. I recommend experimenting with Gemini CLI and Claude Code using Sonnet initially.

Environment Setup

This is more of a preference, but if you want a default starting place I use Visual Studio Code and the command line agents. I install the Claude and Gemini extensions. I run the agents in the integrated VS Code terminal. The terminal agents are smart and will use the extensions to enhance your experience. They will prompt you with diffs and verify each change you make by default. They also use various things like your current open file for context and have other quality of life integrations. They are decent at helping you configure VS Code (they often get the name of settings wrong or subtly wrong, so double check their work there). They are much better at tasks like setting up Python environments, creating or updating cmake files, and virtually any configuration chores for your project you may have.

Basic Usage

Write prompts. Ask the agent to make changes, edit or change files, review git commits, virtually anything a human engineer might do. I strongly recommend frequent git commits and branches when you plan on letting your coding agent make changes. This makes rolling changes back significantly easier. Good comments in your commits are also helpful, for you and the agent. A nice trick to get the agent going is to ask it to review git commits. You might ask it "Review the last 3 git commits, and let's pick up where we left off on that feature. Read @doc/feature-design.md and implement X part of the feature."

Managing Context

One of the key aspects of working with coding agents is managing your tokens and context. You cannot run one long unlimited length session. LLMs work by, reading your entire previous context to generate the next token in the prompt. There is some nuance here, but conceptually context grows linearly with session length. So, you have to use strategies to manage your context. LLMs come in with built in tools like session compaction. However, you can also help here. Git tags and feature branches are a great way to have specific context around changes.

Another key way to manage context is using brief design documents. A simple scenario: You have been working on a feature or sketching out a design concept brainstorming with your LLM agent. You may have interactively had it sketch snippets to you until the design looked good, but now your session is quite long and has a lot of irrelevant details that got you to the design you want to implement. The solution is simple. Ask the LLM to write a markdown doc with the design and break down the implementation into steps to track progress. Then, restart your session. If you had git commits use those too. Otherwise agents let you tell it files to use for context so give it some hints. "We will be working on @src/foo.py and @src/bar.py, read the last 3 git commits and @doc/feature-design.md. Implement the next step." Gemini and Claude both have good tools to measure your session and token usage, so keep an eye on that as you go to get a sense for how much things cost in terms of tokens.

Tips and Tricks