is an incredibly effective coding agent, which you can use to perform most cognitive tasks on your computer. However, continual learning is still a task we’re struggling to teach agents. Furthermore, continual learning is a task humans are incredibly good at.
You can simply reflect on any task you’ve been doing for a long time. In almost all cases, you’ll become better at that task over time, learning from your mistakes and improving on them. This isn’t only a matter of remembering what works and what doesn’t. It’s also about building an intuition for tasks, which you simply gain by doing them over time.
This infographic highlights the main contents of this article. I’ll cover continual learning for coding agents, why you need it, and how to achieve it. Image by Gemini.
In this article, I’ll discuss how you can achieve similar continual learning with your coding agents. Continual learning for agents is still an unsolved challenge, but I’ll go through how I make my coding agents learn from their mistakes and improve over time. Furthermore, the contents I’ll cover in this article will make your agents far better at the tasks you specifically want them to be good at, whether it be making shareholder presentations, resolving bugs in your specific codebase, or something completely different.
Why do we need continual learning
We need continual learning because we always want to become better at the tasks we do. Imagine if you’ve been a programmer for many years, and you’re still making basic mistakes, such as forgetting colons after an if statement in Python.
Obviously, making such mistakes continuously is very ineffective, which is why we want to avoid it. We want to become better at tasks, to become more effective at them, and thus be able to solve harder problems.
Working on a task for a longer period of time will help you build up an intuition for the task, and help you solve more advanced problems in that area
You can imagine a fresh coding agent as a new employee. Obviously, they’ll make some mistakes in the beginning, since they don’t understand your preferences or codebase. However, when you tell the new employee how to do something, you expect them to learn that over time.
If you don’t take specific measures to make your coding agents remember such things, they’ll likely forget them, which is why you need to take active measures to achieve continual learning for your coding agents.
How to Achieve Continual Learning
In this section, I’ll cover some specific techniques I use on a daily basis to achieve continual learning. These techniques come from talking to others working in the same field, inspiration from the OpenClaw repository, and my own experimentation.
The generalize knowledge command
The simplest and most effective approach to make Claude Code learn from its mistakes is a general knowledge command. This is a simple command (also known as a skill, simply a markdown file containing a prompt) to learn from a given thread.
I typically run this command whenever I finish a conversation from Claude Code, performing a single task. For example, if I’ve:
- Completed 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 similar to the one below:
Generalize all the knowledge from this thread into claude.md and agents.md.
Write down any information that would be useful for a future agent working
in this repository. Also note down any issues you encountered, and how 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 would be useful for future interactions.
I also make the agent write down the task it performed, so I have a single file containing everything I’ve done. This is not strictly necessary, but I find it nice to have this sort of summary available.
Also note that this assumes you always perform a single task in a given Claude Code thread, which you definitely should do to get the best results. This also applies to every other coding agent available, simply because a single task for a single thread helps the agents stay focused and avoid noise filling up their context.
Daily reflections
To build on the last section, you can also have daily reflection settings. If you for example have multiple agents running throughout the day, you can have a cron job (a command which is timed to run at a specific interval), to go through all logs for your coding agent in the last 24 hours, and note down any useful information. This builds on the general knowledge command, but works on a higher level, since the agent going through your logs will not only have access to a single thread, but everything you’re working on.
This could be useful, since the different perspective can lead to different notes being written down, which will help you and your coding agents become more efficient.
Skills
Skills is another concept I’d like 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, however, are more specific files telling the agent how to perform specific tasks.
This is somewhat similar to the generalize knowledge command, but a bit different since generic files note that generic mistakes and solutions, while skills cover way 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
- How to use a specific API or package. This is particularly important for smaller and unknown API’s and packages that are not covered well in the pre-training of the LLMs
- How to approach solving bugs in a particular repository
As you can tell, skills are more specific. Thus, whenever you start working with a new package, API, or a new task in general, I urge you to create a skill for that. The skill should cover everything that is useful to know when working with the API or on the task. Including:
- How to interpret the provided tasks within the given topic
- How to approach solving the tasks
- Previous mistakes made, and how they were solved
The more information you store, the better. Your coding agent will then usually load this skill dynamically if you start working on a related task.
For example, if you ask your agent to sort your email, it will dynamically load the email sorting skill, so it knows how to act. This helps your coding agent avoid the previous mistakes it’s made when sorting through your email.
Conclusion
In this article, I’ve covered how to make Claude Code and other coding agents learn from their mistakes. I’ve discussed three main techniques to use, including making a generalize knowledge command, doing a daily readthrough of agent logs, and actively using skills when working on tasks. I believe learning from your mistakes is incredibly important, both for humans and machines. If you can effectively make your coding agents learn from their mistakes, you’ll become far more efficient at applying them, and thus get a major advantage compared to 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
🐦 X / Twitter

