Yesterday a Redditor shipped a clever fix for a problem most of us ignore. Your coding agent changes six files, says “Looks great, everything passed!”, and you merge it without really knowing what happened. The skill is called learn-from-code. It’s open source, and the twist is in how it fights comprehension loss.
What’s new
u/minhgiaubeo posted in r/PromptEngineering about a skill for agents like Claude Code, Cursor and Codex. It targets the two usual failure modes. Either the agent is too lazy (“all good!”) or it dumps a wall of syntax descriptions nobody reads. Anyone who has used an agent for more than a week has seen both. One day you get a one-line summary that tells you nothing. The next day you get four screens of “this function takes a parameter and returns a value,” which is technically accurate and completely useless.
The skill has two modes. You can use either one, and they solve slightly different problems. Mode A is about understanding what just happened. Mode B is about building your own skill while the agent works next to you.
The twist
Most people complain that their agent is too verbose or too quiet. This build asks a different question: can a human still hold the program in their head after the agent is done? That’s a much better test than word count. A short explanation that leaves you with a clear mental model beats a long one that leaves you with nothing.
Mode A doesn’t explain code line by line. It explains the situation:
- The real-world trigger that calls the function, such as a user clicking “retry payment” or a nightly job hitting an empty queue
- The business rule the code is protecting, for example “an order can never ship twice” or “a refund can’t exceed the original charge”
- Why the alternative approaches were rejected, so you know the agent didn’t just grab the first idea that compiled
- A check of the files the agent did NOT touch, to see whether any callers are now broken
The last point matters most. Agents are good at telling you what they changed. They’re much weaker at telling you what they might have broken somewhere else. Imagine the agent renames a field in a shared helper and updates the three files it found. A fifth file, which it never opened, still reads the old field name. Tests pass because nothing covers that path. A caller audit is exactly the thing that surfaces this before your users do.
Mode B is the bolder one. The agent turns non-trivial functions into typed TODO stubs with guided hints, and you implement the critical step yourself. It works like a tutor who hands you the pencil. You still get the scaffolding, the types and the surrounding structure, but the one decision that matters is left for you to write.
Mini-workflow
- 1️⃣ Install it:
npx skills add HarleySw/learn-from-code-skill - 2️⃣ Let your agent do a multi-file change as usual. Don’t change how you prompt it. The skill works on the output, not the input.
- 3️⃣ Run Mode A to get the “why” behind the change: the trigger, the invariant, the rejected options.
- 4️⃣ Read the caller audit on untouched files before you merge. If it lists a file you’ve never heard of, open it. That’s usually where the surprise lives.
- 5️⃣ When you’re working in an area you want to understand, switch to Mode B and write the critical step yourself.
Pro tips
- Use Mode A as your default review layer. It costs you a few minutes of reading and gives you the context to catch bad assumptions. A good habit is to try to predict the explanation before you read it. Where your guess and the agent’s answer differ, that’s the part you didn’t understand.
- Save Mode B for code you’ll own long term. Don’t use it everywhere. One commenter, u/geoffreybyers, pointed out that Mode B puts a human in the loop on every non-trivial change, which is a rate limit you don’t want in an automated pipeline. That’s fair. Treat it as a learning tool, not a pipeline stage.
- Steal the structure even if you never install the skill. “Explain the trigger, the invariant, and the rejected alternatives” is a prompt you can paste into any agent instruction file today. Add one more line asking the agent to list every caller of any function whose signature changed, and you’ve got a rough version of the whole idea for free.
- Keep the explanations. Paste the Mode A output into your PR description. Future you, and any teammate reviewing it, will thank you six months from now when nobody remembers why the code looks the way it does.
The post only has a handful of upvotes so far, and I haven’t run the skill myself. Still, the framing is the useful part. It treats understanding as something the agent is responsible for, not just correct code.
Call to Action
Here’s the repo: https://github.com/HarleySw/learn-from-code-skill ☠
Try Mode A on your next big agent diff and see how many of the “why” answers you could have given yourself. If you’ve built your own prompt for keeping agent output digestible, drop it in the comments. I’d love to compare notes!
Frequently Asked Questions
Q: Why does Mode A explain the business invariant instead of the syntax?
Reading code tells you what it does, but not why the check exists. One commenter found that when the agent named the invariant a block was protecting, they still remembered why it was there six months later, while the same checks had looked like random noise before. When you review agent output, ask it to name the real-world event that triggers the function and the rule it protects, since that gives you more useful context per paragraph.
Q: Should teams fill in the Mode B TODO stubs during a production sprint?
Commenters disagree here. Some think Mode B works well as a training tool for learning exercises, but say a production sprint rarely has time to fill in stubs when the agent already knows the answer. Others argue that making a human implement critical steps on every change turns the developer into a bottleneck that waits on the agent. A middle ground is to use Mode B on unfamiliar or high-risk code and skip it for routine changes.
Q: How do I install the skill without copy-pasting a giant prompt?
Run npx skills add HarleySw/learn-from-code-skill to install it as a standard agent skill. One commenter said they wish more skills were packaged this way, because pasting large system prompts by hand every session gets old fast.
Designing an Agent Skill prompt to prevent comprehension loss from AI coding
by u/minhgiaubeo in PromptEngineering