Close Menu
    Facebook LinkedIn YouTube WhatsApp X (Twitter) Pinterest
    Trending
    • New study reveals surprising insect interaction
    • Memorial Day Tech Deals: Sony, Apple, Anker, and More
    • Visually impaired Waymo users in CA say riding in a Waymo gives them a feeling of independence and spares them the discrimination they face from human drivers (Sonia A. Rao/New York Times)
    • Best Places to Buy Contact Lenses Online for 2026 | The Cheapest Places to Find Contact Lenses
    • Introducing the Agent Toolkit for Amazon Web Services
    • Disabled kea invents jousting to become alpha
    • The Electric Ferrari Luce Is Finally Here
    • X says it is cracking down on large accounts that have been gaming its revenue-sharing program by “programmatically reuploading content from smaller accounts” (Lakshmi Varanasi/Business Insider)
    Facebook LinkedIn WhatsApp
    Times FeaturedTimes Featured
    Tuesday, May 26
    • Home
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    • More
      • AI
      • Robotics
      • Industries
      • Global
    Times FeaturedTimes Featured
    Home»Artificial Intelligence»How to Write Robust Code with Claude Code
    Artificial Intelligence

    How to Write Robust Code with Claude Code

    Editor Times FeaturedBy Editor Times FeaturedMay 14, 2026No Comments10 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr WhatsApp Email
    Share
    Facebook Twitter LinkedIn Pinterest Telegram Email WhatsApp Copy Link


    coding brokers can be utilized to rapidly create new functions. Nonetheless, the issue if you create a brand new utility rapidly is that you simply can not take a look at the code.

    In my view, that is really nice. You normally don’t want to investigate the code except you’re creating safety-critical functions or comparable, contemplating the coding brokers have develop into so good that that is normally not crucial.

    Nonetheless, in the event you don’t take sure precautions, you’ll expertise robustness points the place your app is much less dependable in comparison with in the event you programmed it your self, pondering fastidiously by way of each piece of code. On this article, I’ll cowl the particular ways and methods I exploit to make my code as sturdy as doable after I program utilizing Claude Code with out trying on the code myself.

    This infographic highlights the principle contents of this text. I’ll talk about methods to construct sturdy code with coding brokers. First, I cowl methods to initially write sturdy code after which proceed to cowl methods to confirm and enhance the code after preliminary implementation. Picture by ChatGPT.

    Why do you want sturdy code?

    That is largely a rhetorical query, as you in fact need sturdy code that may deal with quite a lot of completely different conditions, as a result of it makes the customers’ expertise much less errors and general have a greater expertise together with your product. One other query to ask your self right here is, in fact, shouldn’t you be really trying on the code your self to make it extra sturdy?

    I’ve two essential responses to this final level:

    1. You don’t actually have time to have a look at all of the code your self if you wish to preserve a excessive tempo and develop a product rapidly.
    2. The coding brokers have develop into so good at detecting points and constructing dependable code, if prompted appropriately, that growing the robustness of code will be achieved mechanically by way of coding brokers and doesn’t must be handbook work.

    Thus, we get to this text’s essential level, which is how one can guarantee robustness of code mechanically by way of coding brokers so that you don’t must spend time doing this your self. I’ll cowl this within the following sections.

    Methods to construct initially sturdy code

    The primary part I’ll cowl is methods to construct sturdy code initially. And the next part will cowl methods to confirm the robustness of code and repair it after it’s been constructed. I view this as two separate issues, and I exploit separate methods to resolve them, which is why I divided it into two sections.

    Lively utilization of plan mode

    Plan mode is the primary method I’ll cowl which I feel is essential if you wish to get probably the most out of coding brokers. Utilizing plan mode allows the coding brokers to spend extra time planning the implementation as an alternative of simply beginning out with it immediately. This sometimes improves the fashions capability to see the larger image and thus avoids bugs for instance attributable to updates to at least one element altering issues in different parts.

    Plan mode additionally asks clarifying questions in order that any ambiguities are made clear. having coding brokers ask new questions as an alternative of you asking coding brokers is an extremely highly effective function I urge you to actively use extra. You wish to let the mannequin do as a lot of the pondering as doable and solely come again to you as soon as it must make clear one thing or perceive higher what you wish to implement.

    It’s far more highly effective to have the LLMs ask you questions than you asking the LLMs questions.

    This, usually, results in fewer bugs and a mannequin being extra environment friendly at implementing an answer. Whereas in fact plan mode initially takes extra time since you must plan with the agent and never begin the implementation immediately, it’s normally price it in the long term due to the less bugs you expertise and having to spend much less time iterating with the agent after an implementation to make sure you get the precise implementation you need.

    Protecting talent recordsdata

    The second half is the MD recordsdata that you’ve got in your repository. Over time, if you spend time coding within the repository, the variety of markdown recordsdata ought to enhance steadily, highlighting how brokers ought to behave within the repository, earlier bugs which have been reported and the way they have been fastened, and different points which have arisen within the repository beforehand.

    That is extremely vital and helpful for the coding brokers as a result of they usually have sufficient context to have the ability to actively make the most of this information. And it makes them much less liable to make incorrect selections that they’ve made previously. These Markdown recordsdata are sometimes constituted of errors that brokers have made in earlier periods, and so having quite a lot of them helps all of them make higher selections

    To create these Markdown recordsdata, I urge you to make an agent generalize data from a thread after each chat thread that you simply’ve had together with your coding agent. That is most likely the primary tip that makes coding with brokers more practical. Secondly, that each time you uncover and repair a bug, you retailer an outline of the issue and the way it was solved in a markdown file.

    Should you apply these ideas each time you’re coding, you’ll develop an extremely highly effective data base inside your repository, and your brokers will certainly enhance over time and develop into increasingly more efficient and fewer liable to errors, and thus construct extra sturdy code.

    Keep away from operating your agent with too massive context window

    One other quite common cause I obtain non-robust code, susceptible code, or code containing bugs is that I’ve been operating my agent with too lengthy a context. Claude Code, for instance, launched their 1 million context mannequin not too way back. 1 million token context window is extraordinarily lengthy, and it could include quite a lot of info. Nonetheless, from my expertise, mannequin efficiency degrades closely when you go previous 3-400 thousand tokens, which is simply 30-40% of the max context window of the mannequin.

    Thus, except you actually must, due to quite a lot of particular context, I urge you to work with brokers with much less of their context stuffed up in order that they will develop into more practical.

    The rationale coding brokers’ efficiency degrades with longer context is that the brokers must take extra context under consideration, the place quite a lot of the context will sometimes be noise, probably not related to the issue they’re engaged on. Nonetheless, it’s laborious for the fashions to separate noise from actually vital info, which makes them carry out worse.

    Methods to confirm the robustness of code by way of coding brokers

    In fact, it is extremely vital to construct sturdy code initially. Nonetheless, it’s inevitable that coding brokers make errors as a result of they don’t seem to be capable of see the total context of what they’re doing, or for another cause, they implement code that’s liable to errors and thus not sturdy. In these conditions, it’s extremely vital to have a security internet the place you discover code that’s liable to errors and repair it earlier than a consumer experiences it.

    Coding agent code assessment

    The primary and doubtless the best factor you are able to do to construct extra sturdy code is to have coding brokers assessment the code that different coding brokers produce. The way in which you do that is that you’ve got a brand new coding agent with a transparent context window, besides for his or her immediate, in fact: to investigate the code within the pull request, and search for any errors.

    This immediate that you simply present to the pull request-reviewing coding agent will also be iterated on over time. For instance, informing it of previous bugs which have been skilled and the way these bugs have been caught and the way they have been fastened. It will possible make the reviewing brokers extra capable of uncover bugs.

    A professional tip right here may very well be to have a separate mannequin or a distinct mannequin performing code assessment. For instance, when you’ve got Claude code, write your code. Usually, it may, in some eventualities, at the least be helpful to have one other coding agent assessment the code, for instance, GPT 5.5 or Gemini 3. It is because completely different coding brokers will suppose in a different way and can thus, in some eventualities, be extra capable of uncover bugs

    Pre-commit detection

    Pre-commit hooks are an idea the place you’ve gotten some piece of code run earlier than each decide to test for static errors. This might, for instance, be lacking translation errors, which is a typical pre-commit hook that quite a lot of code bases have carried out. In fact these hooks are very efficient and really helpful as a result of in the event you forgot so as to add a translation they’ll let you understand earlier than you carry out the commit. Some errors can’t be detected with pre-commit hooks however in these eventualities it may very well be very helpful to only have an agent rapidly do a pre-commit stroll by way of. That is the place the agent goes by way of the implementation that you simply simply did and appears for potential errors. This in lots of circumstances saves me quite a lot of time as a result of I don’t must have the code go to a code assessment I can repair fast errors immediately

    Doing that is primarily asking the agent:

    Is the code manufacturing prepared?

    This sounds quite simple, however it could really be fairly helpful, and generally helps uncover errors from my expertise.

    Conclusion

    On this article, I mentioned methods to code utilizing coding brokers and guarantee they produce sturdy code. In fact, coding brokers have improved rather a lot because the launch of ChatGPT in 2022. Nonetheless, they’re nonetheless liable to errors, particularly in the event that they’re not used appropriately. I coated two essential methods, together with methods to construct initially sturdy code and methods to confirm code after it’s carried out to search for potential bugs and the problems that may happen with the code. Typically, I feel tuning your coding brokers for optimum efficiency will develop into extremely vital sooner or later, and quite a lot of the methods I cowl on this article will stay related even when the generic or basic efficiency of LLMs will increase vastly. I simply urge you to take the guidelines under consideration and optimize your coding brokers.

    👋 Get in Touch

    👉 My free eBook and Webinar:

    🚀 10x Your Engineering with LLMs (Free 3-Day Email Course)

    📚 Get my free Vision Language Models ebook

    💻 My webinar on Vision Language Models

    👉 Discover me on socials:

    💌 Substack

    🔗 LinkedIn

    🐦 X / Twitter



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Editor Times Featured
    • Website

    Related Posts

    Introducing the Agent Toolkit for Amazon Web Services

    May 25, 2026

    Can AI write your code? | Towards Data Science

    May 25, 2026

    I Built My First ETL Pipeline as a Complete Beginner. Here’s How.

    May 25, 2026

    From TF-IDF to Transformers: Implementing Four Generations of Semantic Search

    May 25, 2026

    The Ultimate Beginners’ Guide to Building an AI Agent in Python

    May 24, 2026

    Beyond the Model: Why Data Scientists Must Embrace APIs and API Documentation

    May 24, 2026
    Leave A Reply Cancel Reply

    Editors Picks

    New study reveals surprising insect interaction

    May 26, 2026

    Memorial Day Tech Deals: Sony, Apple, Anker, and More

    May 26, 2026

    Visually impaired Waymo users in CA say riding in a Waymo gives them a feeling of independence and spares them the discrimination they face from human drivers (Sonia A. Rao/New York Times)

    May 26, 2026

    Best Places to Buy Contact Lenses Online for 2026 | The Cheapest Places to Find Contact Lenses

    May 26, 2026
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    About Us
    About Us

    Welcome to Times Featured, an AI-driven entrepreneurship growth engine that is transforming the future of work, bridging the digital divide and encouraging younger community inclusion in the 4th Industrial Revolution, and nurturing new market leaders.

    Empowering the growth of profiles, leaders, entrepreneurs businesses, and startups on international landscape.

    Asia-Middle East-Europe-North America-Australia-Africa

    Facebook LinkedIn WhatsApp
    Featured Picks

    Two women arrested for allegedly running a Sarasota gambling house

    December 19, 2025

    Hustlers are cashing in on China’s OpenClaw AI craze

    March 11, 2026

    A Budget MacBook Makes Sense, but Crushing the Chromebook Won’t Be Easy

    November 14, 2025
    Categories
    • Founders
    • Startups
    • Technology
    • Profiles
    • Entrepreneurs
    • Leaders
    • Students
    • VC Funds
    Copyright © 2024 Timesfeatured.com IP Limited. All Rights.
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us

    Type above and press Enter to search. Press Esc to cancel.