David Gewirtz / Elyse Betters Picaro / ZDNET Follow ZDNET: Add us as a preferred source on Google. ZDNET's key takeaways Step-by-step builds beat full-spec instructions for AI coding. AIs can destroy code as quickly as they create it. Use AGENTS.md, screenshots, and refactoring to keep projects stable. Last week, I put in somewhere between 50 and 60 hours of pair programming with, and getting to know, ChatGPT Codex. Pair programming is an old term with a new meaning. Pair programming is the practice of two or more programmers writing code together at the same time. For years, the two programmers were two humans. But as of late, with the advent of coding AI, pair programming can mean a human pairing up with an AI to code together. That's what I've been doing. I did my first 12 to 15 hours by using it through the $20-per-month ChatGPT Plus, and was cut off three times in the process for overuse of resources. I did the remaining 45 or so hours by using the $200-per-month ChatGPT Pro program, and didn't get shut down once. By the time I was done, I completed a major feature upgrade for my core product, and created four additional add-on products to that core product. It was the most productive development period I've ever experienced. But it was not all smooth sailing. There were bumps and potholes. Yeah, I know. The AI's hallucinations and malapropisms are rubbing off on me. But I learned a lot. In this article, I'm going to share with you the most valuable lessons I learned. Before we dive in, I encourage you to go back and read my previous three articles on Codex. The first discusses how unenthused I was when the only way to use it was from GitHub. The second describes my experience using it in the VS Code IDE, but being throttled too often. The last one discusses how I managed to do four years of product development in four days using Codex. OK, now that you're able to see what it's possible to do with this tool, let's look at some tips and techniques. If you read all the way to the end of the article, you even get a bonus tip. 1. Avoid PRDs and spec-driven development This is going to be hugely controversial because the use of product requirements documents (PRDs) and specifications is pretty much the gold-standard recommended best practice for AI-based coding. But, in my experience, the use of PRDs and spec-driven development causes way more problems than it solves. Look, I'm not saying don't build a PRD. It's always a good idea to have a good idea of what you're planning on building. But don't feed it all to the AI at once. Also: How people actually use ChatGPT vs Claude - and what the differences tell us Fundamentally, the AI will take what you ask it to do and attempt to do it. But if your PRD is incomplete, or if it misunderstands one small instruction, or if there are any of the other possible gotchas that could result from using one giant monolithic set of instructions, it can all devolve very quickly. It's also very hard to test a giant creation and make sure everything works together, especially if it all manifests into existence at once. So, how should you do it? That's next... 2. Build up, step-by-step I tried the above technique three or four times during my big pair programming sprint, with no success. Then, I decided to build things up step-by-step. That was enormously successful. My recent projects involve a user interface that's part of a website's dashboard, and then business logic that does whatever unique value-add my new program is supposed to do. I started by describing the user interface elements I wanted. I was very careful to tell the AI I didn't want those elements wired up, or to have their functionality enabled. What this means is that if I had a checkbox option and a save settings button, I did not want the AI to save or restore that checkbox's setting. I also didn't want the AI to use the value of the checkbox to control whatever it will eventually control. At first, the UI elements added by the AI were added, but were placed very poorly. That's OK. I got the AI to add all the elements I needed, but didn't worry about the look. If you're keeping track, that meant there was no work on the appearance, the save/restore, or the main functionality. Also: How to use ChatGPT to write code - and my top trick for debugging what it generates Once most of the elements I wanted were on screen, I instructed the AI to move them around, style them, and position them. This is the biggest value I got from the AI, because this is mostly CSS. I truly dislike CSS. Often it took five or ten tries to get the AI to listen, but eventually everything arrived where I wanted it. Then, and only then, did I start working on the functionality. First, this was the local JavaScript code necessary to make items appear or disappear based on user input. For example, this set of subordinate checkboxes appears in my AI bot manager only if the "Add RSL to RSS feeds" button is checked. Screenshot by David Gewirtz/ZDNET Finally, once the UI was laid out correctly and the JavaScript interactions worked, only then did I have the AI start working on the core functionality. This process made the whole build much more manageable, and the results were robust, fast, and very workable. 3. AIs make big mistakes quickly AIs are able to accomplish an incredible amount of work very quickly. I spotlighted how I got Codex to help me collapse four years of product development into four days. But as fast as AIs can create, they can also destroy. One malformed (or misinterpreted) prompt can destroy your entire codebase. That's another reason for small, stepwise changes, instead of asking the AI to take big swings. Big swings can result in very fast strikeouts. Also: The best AI for coding in 2025 (including a new winner - and what not to use) And, of course, back up or check in your changes regularly so you can roll back. 4. Use that Undo button Codex has an undo button. It will undo the entire set of actions the AI took for the prompt you just gave. That undo button is your friend. Call on it whenever you need it. 5. Don't let the AI guilt you Codex always seems to nag you to add business logic way before you should. Don't let it guilt you into doing it. Once Codex thinks it understands what you're building, it will start to make suggestions about features to add. Don't add them, even though it might be tempting. Most of the time, Codex doesn't really know how to make new features fit nicely into whatever you're building. Also: How to turn ChatGPT into your AI coding power tool - and double your output That said, definitely make notes of those suggestions. As your product build matures, you can carefully direct Codex how to add some of them into your final product. 6. Use AGENTS.md AGENTS.md is a standard file that many coding AIs use for standardized instructions for any given project. I have mine in the root of my main project. It provides a lot of guidelines to the AI, so I don't need to specially instruct the AI each time I run it. Here's an example of the sort of thing included in the standardized instructions: "Never modify any files in library directories. These are externally created software libraries and it must be possible to update them with new releases without concern that custom code will be overwritten." Also: How I used ChatGPT to analyze, debug, and rewrite a broken plugin from scratch - in an hour This tells the AI that files in library directories may change, and it should avoid modifying code in those directories, because they are essentially system services. By the fact that it's in the AGENTS.md file, I don't need to tell it at the beginning of every session. 7. Use screenshots Don't hesitate to use screenshots a lot. I take screenshots and point out areas where I want the AI to pay attention with arrows. The AI sometimes seems to have difficulty picturing a situation based on a description, but as soon as I give it a screenshot, it "gets it." Also: Bad vibes: How an AI agent coded its way to disaster Sometimes, if we're in the middle of a session and the AI seems to be missing something about what I want it to do, all I do is take a screenshot, paste it into Codex chat in VS Code, and prompt it with "this." 8. Feed the AI HTML and CSS Another way to help the AI is to open a web page in the browser inspector, copy the HTML from the inspector, and paste it into the chat session. This is particularly helpful if the AI is having trouble identifying the right CSS selectors for styling a web page. 9. Tell Codex to remember session data You're going to run out of session space, especially if you've been giving it big error dumps or source code. When it looks like you've been going for a while or you've done a fairly large diagnostic dump into the chat window, tell the AI to give you enough information so that you can pass it along to the next session. Also: How ChatGPT actually works (and why it's been so game-changing) Here's the prompt I use: I want to start a new session to clear the context window. But I would like you to be able to remember the aspects of our discussion here so you will be able to reference it in the new session. Can you provide me something I can cut and paste from this session to the next, that will bring you up to speed? Think of it like the end-of-shift report or patient handover when shifts change in a hospital. When it gives me its result, I copy it. Then, I start a new session and paste the handover information into the new session. It's a quick way to bring the AI up to speed across sessions. 10. Tell Codex to refactor its big files Codex really likes to dump all its code into one or two big files. Yes, if you already have a bunch of files and folders created, Codex will use them. But if it creates new code, it likes to slam all of it into one place. But you can tell Codex to refactor its code. For example, it likes to inline both JavaScript and CSS into the middle of PHP files, often bloating those files. I tell Codex to pull out the JavaScript and put it into a .js file in a js folder. I also tell it to do the same with its CSS. As a result, all three languages become more maintainable. Also: AI agents make great teammates, but don't let them code alone - here's why You can also do this for logical groupings of functions. Rather than putting all functions in one big file, give Codex category files, and tell it to put the functions related to each category into its associated file. Bonus tip: Code for maintainability Codex does not naturally code for human maintainability. But if you tell the AI to format it and comment it, or how to structure the code, it will comply. It will also write good explanations of the code and give you summary and reference information. But you need to ask for it. What are your favorite tips? What about you? Have you tried pair programming with an AI tool like Codex or another assistant? Did you find step-by-step development worked better than handing it a full specification? How do you handle AI mistakes or code blow-ups in your own workflow? Do you think features like AGENTS.md or screenshot guidance could make your projects more manageable? Let us know in the comments below. You can follow my day-to-day project updates on social media. Be sure to subscribe to my weekly update newsletter, and follow me on Twitter/X at @DavidGewirtz, on Facebook at Facebook.com/DavidGewirtz, on Instagram at Instagram.com/DavidGewirtz, on Bluesky at @DavidGewirtz.com, and on YouTube at YouTube.com/DavidGewirtzTV.