learn-on-failure

learn-on-failure is a skill for Claude Code from alexmond/alexmskills. It costs 100 tokens per session (968 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 100 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 968 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.00100 $0.00968
Opus 5 $0.00050 $0.00484
Sonnet 5 $0.00020 $0.00194
Haiku 4.5 $0.00010 $0.00097

Measured 10d ago against content hash 46cd6648da3f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, 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 10d 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.

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.
  5. Confirm to the user what was saved and where (one line is enough).

Read the full file on GitHub · 92 lines

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. 10d 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 (6 stars, last pushed 2d ago), licensed MIT. It adds 100 tokens to every session and 968 once invoked, about $0.0005 per session on Opus 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

Other skills, from other repositories

continuous-learning-v2

Instinct-based learning system that observes sessions via hooks, creates atomic instincts with confidence scoring, and evolves them into skills/commands/agents.

sangrokjung/claude-forge · 33 tokens

context-engineering

Manage, optimize, and debug Claude Code context windows. Use this skill whenever the user mentions context limits, context window, autocompaction, compaction firing, context rot, losing context mid-session, session degradation, running out of tokens, /compact, CLAUDEAUTOCOMPACTPCTOVERRIDE, context compression…

arturseo-geo/claude-code-skills · 150 tokens

memory-persistence

Implement cross-session memory, persistent agent knowledge, and session continuity for Claude Code. Use this skill whenever the user wants Claude to remember things between sessions, asks how to avoid re-explaining context each day, wants to build a memory system for an agent, mentions CLAUDE.md memory, session files…

arturseo-geo/claude-code-skills · 140 tokens

hive.note-taking

Maintain a free-form scratchpad of decisions, extracted values, and open questions so context pruning doesn't lose anything you still need.

aden-hive/hive · 30 tokens

security-compliance

Guides security professionals in implementing defense-in-depth security architectures, achieving compliance with industry frameworks (SOC2, ISO27001, GDPR, HIPAA), conducting threat modeling and risk assessments, managing security operations and incident response, and embedding security throughout the SDLC.

sangrokjung/claude-forge · 56 tokens

stride-analysis-patterns

Apply STRIDE methodology to systematically identify threats. Use when analyzing system security, conducting threat modeling sessions, or creating security documentation.

sangrokjung/claude-forge · 30 tokens