learn-on-failure

learn-on-failure is a skill for Claude Code from alexmond/alexmskills. It costs 45 tokens per session (927 once invoked), scanned A, original, MIT.

A tool for saving lessons from problems encountered in a project. Project memory is a set of notes kept with the project's development context for future work.

In plain words
What is it for?
Use it after a task needs multiple fixes, a test or build fails, an API behaves unexpectedly, or an assumption turns out to be wrong.
Why use it?
It records the cause and solution of repeated mistakes so the same detour can be avoided later.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

Part of the learn-on-failure plugin — 1 skill shipped together

Good fit Use it after a task needs multiple fixes, a test or build fails, an API behaves unexpectedly, or an assumption turns out to be wrong.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/alexmond/alexmskills/learn-on-failure
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add alexmond/alexmskills --skill learn-on-failure
Clone the repo
git clone --depth 1 https://github.com/alexmond/alexmskills

Made for: Claude Code.

Or install learn-on-failure, the plugin that ships this one along with the rest of its 1 skill.

Wrote 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.

agentmods badge for learn-on-failure

README.md
[![agentmods](https://agentmods.dev/badge/skills/alexmond/alexmskills/learn-on-failure/github.svg)](https://agentmods.dev/skills/alexmond/alexmskills/learn-on-failure)
Your own site
<a href="https://agentmods.dev/skills/alexmond/alexmskills/learn-on-failure"><img src="https://agentmods.dev/badge/skills/alexmond/alexmskills/learn-on-failure/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.

agentmods 80×15 button for learn-on-failure

Your own site · 80×15
<a href="https://agentmods.dev/skills/alexmond/alexmskills/learn-on-failure"><img src="https://agentmods.dev/badge/skills/alexmond/alexmskills/learn-on-failure.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 927 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00045 $0.00927
Opus 5.5 $0.00018 $0.00371
Sonnet 5.5 $0.00009 $0.00185
Haiku 4.5 $0.00005 $0.00093

Measured 2mo ago against content hash a7709af63a7e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

learn-on-failure 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 2mo 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.

plugins/learn-on-failure/skills/learn-on-failure/SKILL.md · 92 lines

How it starts

The opening of the file, as written. The whole thing — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Codex: Read the client path before applying this workflow.

Save a learning to project memory

Try it: /learn-on-failure:learn-on-failure testing "BCrypt accepts $2a$ but not $2y$ hashes" — or just say "remember this: ...". Mostly it fires automatically after a multi-cycle fix.

$ARGUMENTS

Locate the project memory directory

Claude Code keeps per-project memory at ~/.claude/projects/<project-slug>/memory/, where <project-slug> is derived from the current project's absolute path. Do not hardcode a path — the active project's memory directory is provided in the session's memory/system context. Use that path. Within it:

  • MEMORY.md is the index.
  • Topic files (e.g. dependencies.md, testing.md, debugging.md) hold detailed, subject-specific notes.

If the memory directory or MEMORY.md does not yet exist, create them.

Determine the learning

If triggered automatically (multi-cycle resolution), synthesise the learning from the conversation:

  • What was the root cause of the extra cycle(s)?
  • What assumption or gap in knowledge caused the first attempt to fail?
  • What is the correct approach / API / behaviour?
  • What should be checked first next time to avoid the same detour?

If triggered by the user, record exactly what they stated in $ARGUMENTS.

Steps

  1. Read the current MEMORY.md index in the project's memory directory.

  2. Check whether a relevant topic file already exists in that same directory. If so, read it too.

  3. Decide where to write:

    • Short, self-contained insight that fits an existing MEMORY.md section → add it there (keep file ≤ 200 lines).
    • Detailed or topic-specific learning → append to or create a dedicated topic file, then add/update a one-line reference in MEMORY.md.
  4. Write in concise, actionable form:

    • Bullet points, not prose.
    • Lead with what to do / what to check, follow with why.
    • If it supersedes an existing note, update or remove the old one.

Read the full file on GitHub · 92 lines

Files

What ships with it

1 file 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.

Changes

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.

  1. 2mo ago Changed · -55 tokens per session a7709af63a7e
  2. 3mo ago First seen · 92 lines · 100 tokens per session scan A 46cd6648da3f

Subscribe to this mod's changes

learn-on-failure is a skill published in the GitHub repository alexmond/alexmskills (11 stars, last pushed 1mo ago), licensed MIT. It adds 45 tokens to every session and 927 once invoked, about $0.0002 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-08-31.

Related

learn-on-failure compared with skills from other repositories

learn-on-failure next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
learn-on-failurealexmond/alexmskillsSkill111mo agoMITA45Claude Code
weekly-digeststhedotmack/claude-memSkill122ktodayApache-2.0A93Claude Code
cloud-syncthedotmack/claude-memSkill122ktodayApache-2.0A64Claude Code
screenpipethedotmack/claude-memSkill122ktodayApache-2.0A46Claude Code
emerging-techniques-long-contextdavila7/claude-code-templatesSkill35ktodayMITA78Claude Code, Codex
forgetasgeirtj/system_prompts_leaksSkill74ktodayCC0-1.0A0Claude Code, Codex
hive.note-takingaden-hive/hiveSkill11k4d agoApache-2.0A30Claude Code, Codex