Thoughts On Agentic Coding
Like many of you, I have been riding the wave as AI transforms what it means to build software. While there is a lot of hype around what these models are capable of, the reality is that most of what you see is an exaggeration. That being said, here are some of the things that have worked well for me as I have adopted agentic coding into my workflow.
I’ll caveat all of this by saying a lot of this is common sense, but there doesn’t seem to be much common sense writing about AI right now so that’s why I decided to write down a few thoughts.
Other notes: Claude Code is my tool of choice, but I think these practices should apply to any of the agentic coding tools.
Start With A Plan
Sounds like a no-brainer, but it is really easy to just start prompting and hope for the best. However, it surprised me how quickly things can go off the rails when you do this. Claude Code has a planning-mode that you can toggle on. I start off almost every prompt by doing this. After discussing the requirements and generating a plan, CC will ask you if you want to auto-accept the plan. I almost always decline, even if the plan looks good and go back through and try and catch mistakes (I almost always find something that needs to be tweaked).
Break Things Into Small Chunks
As a general rule of thumb, the larger the scope of changes, the worse results you are going to get. If you have an ambitious scope, usually I will start a context dedicated to the big picture and chat about the high level and if I don’t already have a plan in mind about how to break things into smaller pieces. Even when I do have a good idea of how I want to break things down, I will validate that and ask for checklists. From there, I create a separate context dedicated to the more focused task.
Provide File Paths
One of the coolest things Claude Code can do is grep for files and search your codebase. This is very useful, but what I have found is that often times I know exactly where the file is that I want to provide as context and so giving the direct file path saves tokens and gets things done a lot faster.
Commit Early And Often
When you generate a change set that works, commit it. Using atomic commits will help greatly if (when) things go off the rails.
Simplify Before Moving On
Once you have something that works well (and you have committed the changes), take another pass and simplify. Like humans, LLMs tend to find the most complex solution first, and so reducing, simplifying, refining etc will allow your code changes to stack nicely. If you neglect this step, often times further down the road you will run into issues that are hard to debug and can cause your code to fall down like a house of cards.
Avoid Context Rot
Once I have finished a task, I’ll usually close the session and start a new one. Long running sessions go off the rails much faster than focused new ones. This practice seems to keep things moving in the right direction. And if you have followed the advice from above, when the model goes off the rails, revert all the changes and kill the context. You are asking for trouble if you are trying to correct a bad line of “reasoning”.
Have Good Taste
For an engineer good taste is the discernment of choosing high quality libraries, good design patterns, and having a preference for “clean code”. Models seem to reward these choices over time. If you don’t have good taste yet, this is where studying the fundamentals comes into play. Software design patterns, understanding architecture, and visual design will be a huge multiplier on your output.
React Specific Notes
Claude LOVES useEffect and setTimeout - avoid them like the plague.
Things I Am Experimenting With
One of the things that I am trying to do is to have the model write “verifiers” where it predicts the expected output and then we test against the reality. This is helpful in debugging. Obviously tests are one way to do this, but you can do this with a console.log.
Final Thoughts
I have been writing almost all of my code (90% +) using these practices the past few months building “classic mode” (an SVG based PDF editor) for agree.com I think the results are really impressive (our e-signature platform is and always will be free so give it a try). Let me know what you think!
←All Posts