ワンクリックで
self-healing
A learning system that gets better over time by learning from errors.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
A learning system that gets better over time by learning from errors.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | self-healing |
| description | A learning system that gets better over time by learning from errors. |
| version | 2.0.0 |
| allowed-tools | ["Read","Edit","Write","Bash","Grep","Glob"] |
Auto-use when: error, fix, debug, solution, not working, same issue, previously fixed
Works with: quality skill - enriches error records
Error occurs -> Hook captures it -> Saved to JSONL -> Next session reads it -> Same mistake avoided
| | | |
v v v v
[PostToolUse] Categorize Assign severity [SessionStart Hook]
exit code!=0 Sub-category Detect framework Inject recent errors
parse error Stack trace Dedup check Show multi-solutions
Rotation Cross-project learning
| Hook | Trigger | Action |
|---|---|---|
PostToolUse:Bash | exit code != 0 | Categorize error and write to errors.jsonl |
PostToolUse:Edit|Write | Tool fails | Record file editing errors |
PostToolUse:Bash | Previously failed command succeeds | Detect fix, write to fixes.jsonl |
SessionStart | Every session start | Inject project-specific error context |
The hook automatically records:
Storage: ~/.claude/self-healing/errors.jsonl
Per-project: ~/.claude/self-healing/project-contexts/{hash}.jsonl
{
"ts": "2026-02-11T10:30:00Z",
"session": "abc123",
"project": "/path/to/project",
"project_hash": "a1b2c3d4e5f6",
"tool": "Bash",
"command": "npm test",
"exit_code": 1,
"error_snippet": "TypeError: Cannot read property 'map' of undefined",
"error_category": "runtime",
"error_sub_category": "null_reference",
"framework": "jest",
"severity": "high",
"stack_locations": ["src/List.tsx:42", "src/App.tsx:15"],
"context_files": ["src/components/List.tsx"],
"fixed": false
}
| Severity | Condition | Icon |
|---|---|---|
| critical | Segfault, OOM, data loss, corruption | [!!!] |
| high | Build fail, test fail, runtime error | [!!] |
| medium | Lint, type error, deprecation | [!] |
| low | Warning, permission, config | [-] |
14 different frameworks are automatically detected from commands and error messages:
nextjs, react, prisma, jest, vitest, webpack, vite, eslint, docker, python, go, rust, swift, kotlin
When a previously failed command succeeds:
.pending-opserrors.jsonl is updated to fixed: truefixes.jsonl (includes error_category, error_sub_category, error_snippet for multi-solution)The same error type may have different solutions. The system manages this:
fixes.jsonl with error_category, error_sub_category, error_snippet and fix_descriptionfix_description values for the same category+sub-category are treated as multi-solutionsalternative_fixes arraypatterns.jsonEvery session start, inject-context.sh runs and provides:
@ src/List.tsx:42)[!!!] critical, [!!] high, [!] medium, [-] lowpatterns.jsonerrors.jsonl: Maximum 500 lines (priority: unresolved errors preserved)project-contexts/{hash}.jsonl: Maximum 200 linesanalyze-patterns.sh triggers automatically in backgroundWhen an error occurs, known solutions are shown immediately. Claude Code sees this suggestion and can apply it directly.
How it works:
capture-error.sh records an error, it searches fixes.jsonl for known solutions with matching error_category + error_sub_category[Self-Healing] Known N solutions for this error type: to stdoutExample output:
[Self-Healing] Known 2 solutions for this error type:
-> Edit: src/List.tsx (items.map -> items?.map);
-> Edit: src/Card.tsx (data.title -> data?.title ?? "Untitled");
If a previously resolved error reappears, an automatic warning is given.
How it works:
errors.jsonl is searched for matching command + category/sub_category with fixed: trueExample output:
[Self-Healing] REGRESSION WARNING: This error was previously resolved!
Previous solution: Edit: src/List.tsx (items.map -> items?.map);
The same solution can be reapplied or a permanent fix may be needed.
At session start, a weekly comparison is shown:
The system comes pre-loaded with 30 common error/fix pairs on first install. This means instant fix suggestions and regression detection work from the very first session.
Auto-trigger: inject-context.sh checks for marker file at each session start. If missing, preload.sh runs automatically.
Coverage (8 categories, 30 entries):
Idempotent: .preload_done marker prevents duplicate loading.
bash ~/.claude/skills/self-healing/scripts/cleanup.sh # Statistics
bash ~/.claude/skills/self-healing/scripts/cleanup.sh --old # Remove resolved errors older than 30 days
bash ~/.claude/skills/self-healing/scripts/cleanup.sh --reset # Delete all data (confirmation required)
Error/fix experiences are shared across different projects:
analyze-patterns.sh calculates fix rate per projectWith analyze-patterns.sh:
alternative_fixes per patternpatterns.json generated| File | Content | Max Size |
|---|---|---|
~/.claude/self-healing/errors.jsonl | All error records | 500 lines |
~/.claude/self-healing/fixes.jsonl | Successful fix records | - |
~/.claude/self-healing/patterns.json | Extracted patterns + multi-solution | - |
~/.claude/self-healing/project-contexts/{hash}.jsonl | Per-project memory | 200 lines |
~/.claude/self-healing/.last-error | Last error info (for fix detection) | 1 record |
~/.claude/self-healing/.pending-ops | Pending operations for fix detection | Temporary |