Getting it into your agent
This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.
/plugin marketplace add JuanMarchetto/agent-skills/plugin install learn-by-mistakeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/juanmarchetto/agent-skills/learn-by-mistake)<a href="https://agentmods.dev/skills/juanmarchetto/agent-skills/learn-by-mistake"><img src="https://agentmods.dev/badge/skills/juanmarchetto/agent-skills/learn-by-mistake/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/juanmarchetto/agent-skills/learn-by-mistake"><img src="https://agentmods.dev/badge/skills/juanmarchetto/agent-skills/learn-by-mistake.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00068 | $0.03912 |
| Opus 5.5 | $0.00027 | $0.01565 |
| Sonnet 5.5 | $0.00014 | $0.00782 |
| Haiku 4.5 | $0.00007 | $0.00391 |
Grade A, and why
learn-by-mistake scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 357 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Learn by Mistake
After EVERY tool use that results in an error:
- Check
.claude/lessons.mdfor matching lessons BEFORE attempting a fix - After fixing, evaluate if this error warrants a new lesson
- If yes, write or update the lesson file
This applies even if the user did not ask about the error. If a command fails, you act.
You are an AI assistant with persistent error memory. You analyze failures, extract root-cause lessons, and prevent the same mistake from happening twice. This system applies to all error types: test failures, build errors, runtime crashes, command failures, linter errors, and type errors.
The lesson file lives at .claude/lessons.md relative to the project root.
1. Session Start — Load Lessons
At the start of every session, check if .claude/lessons.md exists in the current project.
If it exists:
- Read it silently (do not print the contents unprompted).
- Load all Active Lessons into working memory, prioritized by Hits count (highest first).
- Keep the top 20 most-hit active lessons readily available for pattern matching.
- Be prepared to match ANY active lesson against errors encountered during the session.
If it does not exist:
- Do nothing. The file will be created on the first error worth learning from.
1b. User Correction Detection — Conversational Errors
Errors are not only technical. When the user corrects you, that is ALSO a learning opportunity. Detect user corrections by watching for phrases like:
- "no, that's wrong" / "that's not right" / "that's incorrect"
- "don't do that" / "never do that" / "stop doing that"
- "that's not what I asked" / "I said X not Y"
- "undo that" / "revert that" / "that broke things"
- "you already made this mistake" / "we went through this"
- "use X instead" / "the correct way is..." / "actually..."
- Any explicit statement that your output, approach, or code was wrong
What ships with it
17 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- .claude-plugin/plugin.json 397 B
- .gitignore 77 B
- commands/forget.md 2.3 KB
- commands/learn.md 3.0 KB
- commands/lessons.md 3.1 KB
- commands/setup.md 3.9 KB
- demo/demo.gif 93 KB
- demo/demo.sh 3.0 KB runs code
- demo/record.tape 179 B
- hooks/hooks.json 693 B
- hooks/scripts/detect-error.sh 4.6 KB runs code
- hooks/scripts/load-lessons.sh 2.3 KB runs code
- hooks/scripts/preserve-lessons.sh 1.8 KB runs code
- README.md 6.6 KB
- references/error-patterns.md 9.3 KB
- references/sanitization-patterns.md 4.8 KB
- templates/lessons-init.md 406 B
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 357 lines · 68 tokens per session scan A 224b8479d4b8
learn-by-mistake is a skill published in the GitHub repository JuanMarchetto/agent-skills (5 stars, last pushed 8mo ago), licensed MIT. It adds 68 tokens to every session and 3,912 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
learn-by-mistake compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| learn-by-mistakeJuanMarchetto/agent-skills | Skill | 5 | 8mo ago | MIT | A | 68 | Claude Code |
| opencli-autofixjackwener/OpenCLI | Skill | 32k | 2d ago | Apache-2.0 | A | 61 | Claude Code |
| unicli-repairolo-dot-io/Uni-CLI | Skill | 229 | 6d ago | Apache-2.0 | A | 68 | Claude Code |
| bgclick-revolo-dot-io/Uni-CLI | Skill | 229 | 6d ago | Apache-2.0 | A | 56 | Claude Code, Codex |
| chatcrystal-debug-recallZengLiangYi/ChatCrystal | Skill | 65 | 6d ago | Apache-2.0 | A | 54 | Codex |
| context-degradationsinhoneyy/master-skills | Skill | 19 | yesterday | none | A | 28 | Claude Code |
| diagnose-with-memoryezBuilder/code-brain | Skill | 11 | 3mo ago | Apache-2.0 | A | 32 | Claude Code |