is an incredibly effective coding agent, which you should use to perform most cognitive tasks in your computer. Nonetheless, continual learning remains to be a task we’re struggling to show agents. Moreover, continual learning is a task humans are incredibly good at.
You’ll be able to simply reflect on any task you’ve been doing for a very long time. In just about all cases, you’ll develop into higher at that task over time, learning out of your mistakes and improving on them. This isn’t only a matter of remembering what works and what doesn’t. It’s also about constructing an intuition for tasks, which you just gain by doing them over time.
In this text, I’ll discuss how you’ll be able to achieve similar continual learning together with your coding agents. Continual learning for agents remains to be an unsolved challenge, but I’ll undergo how I make my coding agents learn from their mistakes and improve over time. Moreover, the contents I’ll cover in this text will make your agents much better on the tasks you specifically want them to be good at, whether or not it’s making shareholder presentations, resolving bugs in your specific codebase, or something completely different.
Why do we want continual learning
We’d like continual learning because we at all times wish to develop into higher on the tasks we do. Imagine when you’ve been a programmer for a few years, and also you’re still making basic mistakes, resembling forgetting colons after an if statement in Python.
Obviously, making such mistakes constantly may be very ineffective, which is why we wish to avoid it. We wish to develop into higher at tasks, to develop into simpler at them, and thus have the option to resolve harder problems.
Working on a task for an extended time frame will enable you to construct up an intuition for the duty, and enable you to solve more advanced problems in that area
You’ll be able to imagine a fresh coding agent as a brand new worker. Obviously, they’ll make some mistakes to start with, since they don’t understand your preferences or codebase. Nonetheless, while you tell the brand new worker the right way to do something, you expect them to learn that over time.
When you don’t take specific measures to make your coding agents remember such things, they’ll likely forget them, which is why you want to take lively measures to attain continual learning on your coding agents.
The best way to Achieve Continual Learning
On this section, I’ll cover some specific techniques I take advantage of every day to attain continual learning. These techniques come from talking to others working in the identical field, inspiration from the OpenClaw repository, and my very own experimentation.
The generalize knowledge command
The best and handiest approach to make Claude Code learn from its mistakes is a general knowledge command. This is an easy command (also often called a skill, simply a markdown file containing a prompt) to learn from a given thread.
I typically run this command each time I finish a conversation from Claude Code, performing a single task. For instance, if I’ve:
- Accomplished a feature implementation
- Resolved a bug
- Made a presentation
- Finished checking production logs
I simply run my command with:
/generalize-knowledge
This works because I’ve saved a generalized knowledge command, which is a prompt just like the one below:
Generalize all of the knowledge from this thread into claude.md and agents.md.
Write down any information that will be useful for a future agent working
on this repository. Also note down any issues you encountered, and the way you
resolved them.
Write the tasks you performed to the done-tasks.md file with time and date,
and a summary of the tasks.
In essence, I tell the model to learn from its mistakes and note down anything that will be useful for future interactions.
I also make the agent write down the duty it performed, so I even have a single file containing the whole lot I’ve done. This is just not strictly needed, but I find it nice to have this type of summary available.
Also note that this assumes you mostly perform a single task in a given Claude Code thread, which you certainly should do to get the perfect results. This also applies to each other coding agent available, just because a single task for a single thread helps the agents stay focused and avoid noise filling up their context.
Every day reflections
To construct on the last section, you can too have day by day reflection settings. When you for instance have multiple agents running throughout the day, you’ll be able to have a cron job (a command which is timed to run at a selected interval), to undergo all logs on your coding agent within the last 24 hours, and note down any useful information. This builds on the overall knowledge command, but works on a better level, for the reason that agent going through your logs won’t only have access to a single thread, but the whole lot you’re working on.
This may very well be useful, since the several perspective can result in different notes being written down, which can enable you to and your coding agents develop into more efficient.
Skills
Skills is one other concept I’d prefer to cover, which really helps contribute to continual learning and helps Claude Code learn from its mistakes. The previous sections I’ve covered, mostly writes to generic CLAUDE.MD, AGENTS.MD, WARP.MD files. Skills, nonetheless, are more specific files telling the agent the right way to perform specific tasks.
That is somewhat just like the generalize knowledge command, but a bit different since generic files note that generic mistakes and solutions, while skills cover far more specific topics. Some examples of skills are:
- How the agent should act when sorting your email
- How the agent should act when sorting your calendar
- The best way to use a selected API or package. This is especially essential for smaller and unknown API’s and packages that aren’t covered well within the pre-training of the LLMs
- The best way to approach solving bugs in a selected repository
As you’ll be able to tell, skills are more specific. Thus, each time you begin working with a brand new package, API, or a brand new task on the whole, I urge you to create a skill for that. The skill should cover the whole lot that is beneficial to know when working with the API or on the duty. Including:
- The best way to interpret the provided tasks throughout the given topic
- The best way to approach solving the tasks
- Previous mistakes made, and the way they were solved
The more information you store, the higher. Your coding agent will then normally load this skill dynamically when you start working on a related task.
For instance, when you ask your agent to sort your email, it should dynamically load the e-mail sorting skill, so it knows the right way to act. This helps your coding agent avoid the previous mistakes it’s made when sorting through your email.
Conclusion
In this text, I’ve covered the right way to make Claude Code and other coding agents learn from their mistakes. I’ve discussed three primary techniques to make use of, including making a generalize knowledge command, doing a day by day readthrough of agent logs, and actively using skills when working on tasks. I consider learning out of your mistakes is incredibly essential, each for humans and machines. When you can effectively make your coding agents learn from their mistakes, you’ll develop into way more efficient at applying them, and thus get a significant advantage in comparison with other agents that don’t learn from their mistakes.
👉 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
👉 Find me on socials:
💌 Substack
