learn-from-failure — скилл для Claude Code: разбор ошибок
Скилл learn-from-failure для Claude Code разбирает сбои и проверяет, повторялась ли их причина. После повторов он помогает создать артефакт, который должен предотвратить тот же сбой.
MIT ★ 26 обновлён 2026-11-16
npx skills add wrg32786/aigent-os --skill learn-from-failure -a claude-codeЧто делает learn-from-failure
Скилл классифицирует сбой, ищет похожие случаи в $AIGENT_VAULT/memory/FAILURE_MODES.md и записывает новый эпизод в журнал. Если причина встречалась 0–1 раз, он предлагает вести наблюдение; при 2 и более случаях требует создать артефакт. Если сбоев 3 и более, прежний артефакт нужно диагностировать и исправить или заменить.
Тип артефакта зависит от причины: для ошибки маршрутизации меняется описание скилла или добавляется хук, для проблемы проверки — пункт в доктрине, для сбоя инструмента — запись в SKILL_GAPS.md. Случаи нехватки знаний оформляются как заметка, а выход за пределы полномочий передаётся оператору. Для работы с журналом нужен $AIGENT_VAULT с файлом memory/FAILURE_MODES.md.
Скилл вызывается командой /learn-from-failure или с описанием сбоя после неё. Без аргумента он спрашивает, что произошло.
Какие задачи решает
- классифицировать причину сбоя
- найти повторяющиеся ошибки в журнале
- решить, нужен ли постоянный артефакт для исправления
- зафиксировать причину, исправление и слой системы
Примеры запросов агенту
- Разбери повторный сбой: агент выбрал не тот инструмент.
/learn-from-failure— ошибка проверки данных повторилась./learn-from-failureЗафиксируй сбой авторизации Gmail MCP и проверь журнал повторов.
Как установить learn-from-failure
1Через Skills CLI (Vercel)
npx skills add wrg32786/aigent-os --skill learn-from-failure -a claude-code2Вручную: положить файлы
~/.claude/skills/learn-from-failure/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/learn-from-failure/
1Через Skills CLI (Vercel)
npx skills add wrg32786/aigent-os --skill learn-from-failure -a codex2Вручную: положить файлы
.agents/skills/learn-from-failure/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add wrg32786/aigent-os --skill learn-from-failure -a cursor2Вручную: положить файлы
.cursor/skills/learn-from-failure/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install wrg32786/aigent-os skills/learn-from-failure2Вручную: положить файлы
.github/skills/learn-from-failure/SKILL.md1Через Skills CLI (Vercel)
npx skills add wrg32786/aigent-os --skill learn-from-failure -a gemini-cli2Командой платформы
gemini skills install https://github.com/wrg32786/aigent-os --path skills/learn-from-failureВручную: положить файлы
.devin/skills/learn-from-failure/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add wrg32786/aigent-os --skill learn-from-failure -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о learn-from-failure
Как установить learn-from-failure в Claude Code?
Выполни npx skills add wrg32786/aigent-os --skill learn-from-failure -a claude-code. Файл скилла появится по пути ~/.claude/skills/learn-from-failure/SKILL.md.
Что делает learn-from-failure?
Он классифицирует сбой, сверяет его причину с журналом и выбирает способ закрепить исправление. При повторных случаях создаёт требование к постоянному артефакту, а после третьего сбоя проверяет прежний артефакт.
Что нужно для работы learn-from-failure?
Нужен $AIGENT_VAULT с журналом memory/FAILURE_MODES.md: скилл читает его, чтобы находить повторения, и дополняет новыми случаями.
Исходный текст
SKILL.md · MIT
---
name: learn-from-failure
description: "Convert failures into reusable artifacts and check repetition. Use when analyzing a failure mode or a recurring failure."
---
# /learn-from-failure — Convert failure to reusable artifact
When a failure occurs, classify it, check for repetition, and produce a durable artifact that prevents recurrence.
## Trigger
`/learn-from-failure` or `/learn-from-failure <failure description>`
Use on: "same issue", "happened again", "recurring", "third time", "keeps happening"
## Flow
### 1. Identify failure
- If argument provided: use it
- If no argument: ask "What failed?"
### 2. Classify failure mode
| Mode | Description | Example |
|------|-------------|---------|
| `routing` | Task sent to wrong agent/model/tool | Opus used for a read-only task |
| `verification` | Output accepted without checking data flow | Video "looked fine" but spec was wrong |
| `tool` | Tool unavailable, broken API, wrong usage | Gmail MCP auth expired |
| `knowledge` | Agent lacked domain knowledge | Didn't know SDK v6 changed type strings |
| `authority` | Agent acted outside delegation zone | the AIgent made a Level 3 decision |
### 3. Check for repetition
Read `$AIGENT_VAULT/memory/FAILURE_MODES.md`. Search for Pattern lines matching the current failure's root cause.
- **0-1 prior occurrences:** Phase 1 — log and monitor
- **2+ occurrences:** Phase 2 — mandatory artifact. A log entry is not enough.
- **3+ occurrences:** The prior artifact failed. Diagnose why and fix or replace it.
### 4. Log to FAILURE_MODES.md
Append a new entry following the existing format:
```markdown
## {YYYY-MM-DD} — {short symptom name}
**Symptom:** {what went wrong, user-visible}
**Verified cause:** {exact mechanism}
**Fix:** {what was done}
**Layer:** {which system layer}
**Pattern:** {one-line category — this is the load-bearing piece for repetition detection}
```
### 5. Determine artifact type
| Failure mode | Artifact | Target |
|---|---|---|
| `routing` | Skill description or hook | the skill's `SKILL.md` description, or `.claude/hooks/` |
| `verification` | Checklist item in doctrine | Relevant doctrine note |
| `tool` | SKILL_GAPS entry + skill spec | `memory/SKILL_GAPS.md` |
| `knowledge` | Vault note or memory candidate | `concepts/` or `memory/` |
| `authority` | Flag to the operator | `aigent_authority_matrix.md` |
### 6. Create artifact
- For routing: add 3+ trigger phrases to the skill's `description` ("Use when ...")
- For verification: append a concrete, runnable check to the relevant doctrine
- For tool: log to SKILL_GAPS.md, suggest /skill-hunt if external capability needed
- For knowledge: write a memory candidate or vault note
- For authority: surface to the operator with recommendation
### 7. Output
```
Failure logged: {classification}
Pattern: {pattern line}
Repeated: {yes/no, count}
Artifact: {type} at {path}
```
## Boundary
Per [[Self-Learning Doctrine]]: a failure logged without an artifact is a false resolution. The ledger grows, the failure recurs, the system learns nothing.
## Bounded procedure experiment (fixture only)
A Finding is an observation, not a verified cause or authority to edit a procedure.
The [fixture mechanics](../../evals/procedure-experiment/README.md) use a declarative grammar and a pinned historical corpus.
Freeze the candidate, evidence, corpus, size budgets and rollback before evaluating.
Require a passing verdict and a caller-supplied approval bound to the candidate and base.
Distinct identity strings are not authenticated review.
This proves mechanics on a fixture, not natural-language procedure compliance or live behavior.
## Related
- [[concepts/Self-Learning Doctrine]] — the doctrine this skill implements
- [[memory/FAILURE_MODES.md]] — the ledger
- [[concepts/Capability Expansion Doctrine]] — tool failures feed the expansion loop
- [[Self-Improving CLAUDE.md]] — the broader self-improvement cycle
© wrg32786 · MIT · wrg32786/aigent-os