실수 학습 기록
같은 삽질 방지 위해 실수 패턴 기록해두는 법.
cross-project 학습 기록용. ~/.claude/memory/에 저장, 같은 실수 반복 막음.
언제 기록할까 (proactively) 작업 끝나면 아래 중 하나라도 해당 시 기록.
- Retry: 같은 단계 2번 이상 시도 (flag 조정, 파일 재수정, mount/install/build 재시도 등)
- First-attempt failure: 첫 구현/명령 안 먹혀 다른 방식 씀
- Dead-end exploration: 시간 썼는데 결국 버린 접근법. 이거라도 기록.
이 경우, 최종 요약 전 기록함.
언제 기록 안 하나 - 사소한 오타 바로 고친 건 건너뜀. - 사용자 요청으로 방향 바뀐 것 (내 실수 아님) - 프로젝트 특정 상태 (global memory 아님) - CLAUDE.md나 코드에 이미 있는 것 - 비밀번호, 토큰 등 민감 정보
기록 형식
---
name: {short title}
description: {one-line trigger — 이 학습이 적용될 상황}
date: {YYYY-MM-DD}
tags: [topic1, topic2]
---
## What happened
{1-3 문장: 시도한 것, 문제점, 해결 방법}
## Root cause
{첫 접근법이 안 된 근본 이유, 증상 말고}
## Next time
{구체적인 규칙: X 상황 만나면 Z 말고 Y 먼저 해라}
name: 짧은 제목description: 한 줄 요약. 이 학습이 어떤 상황에 쓰이는지date: 날짜tags: 관련 토픽들What happened: 시도, 문제, 해결Root cause: 첫 시도가 안 된 근본 이유 (증상 말고)Next time: 구체적 규칙. X 상황 만나면 Z 말고 Y 먼저 해라.
기록된 학습 활용법
작업 시작 시, ~/.claude/memory/에 유사 토픽 있나 확인.
ls ~/.claude/memory/로 스캔. description 맞는 파일 열어봄.
이름 짓기 & 중복 방지
Slug: <topic>_<specifics>.md (예: sata_hotplug_needs_bios.md)
새 파일 쓰기 전 ls로 기존 파일 확인. 중복이면 업데이트, 새 파일 만들지 마.
한 파일에 한 가지 학습만. 섞지 마.
예시
- SCSI rescan으로 디스크 안 나옴 → 재부팅 필요 → sata_hotplug_needs_bios_enable.md 기록
- mount -a가 fstab 새 항목 건너뜀 (tab/space 문제) → fstab_tab_separator.md 기록
- umount "target is busy" (du 백그라운드 실행 중) → umount_busy_check_processes.md 기록
- sudo -S heredoc이 stdin 암호 먹음 → sudo_S_heredoc_stdin_conflict.md 기록
여기서 배울 것
- 같은 실수 반복 방지 위해 학습 기록 남김.
- 실패/재시도/삽질 시 기록 대상임.
- 템플릿 맞춰 간결하게 기록함.
- 기록 전 기존 학습 확인, 중복 피함.
원본 파일 보기 (.claude/skills/record-learning/SKILL.md)
---
name: record-learning
description: Record a lesson to ~/.claude/memory when a task was retried 2+ times or when the first implementation attempt failed. Use this proactively at the end of a task whenever Claude notices (a) the same operation was performed more than once because the first run didn't achieve the goal, (b) the initial implementation needed rework after an error/wrong approach, or (c) a command failed and a different command/flag was required. Also trigger when the user asks to "기록해", "학습해", "이거 기억해둬", "record this lesson", "save this learning".
version: 1.0.0
---
# Record Learning
Capture cross-project lessons to `~/.claude/memory/` so future sessions avoid repeating the same mistake or inefficient pattern.
## When to invoke (proactively)
At the end of a task, check whether ANY of these happened during the work just completed:
1. **Retry**: The same conceptual step was attempted 2+ times (e.g., re-ran a command with adjusted flags, re-edited a file because the first edit was wrong, re-tried a mount/install/build).
2. **First-attempt failure**: The initial implementation or command path did not work and had to be replaced with a different approach.
3. **Dead-end exploration**: Time was spent on an approach that was abandoned (even if the final approach worked first try).
If yes, invoke this skill before the final user-facing summary.
## When NOT to record
- Trivial typos in commands that were immediately corrected.
- User-driven direction changes (user changed their mind — not a Claude mistake).
- Domain-specific project state (that belongs in per-project memory, not this global store).
- Anything already documented in CLAUDE.md or discoverable by reading the current code.
- Passwords, tokens, or any secrets.
## What to record
Each record is a standalone markdown file at `~/.claude/memory/<slug>.md` with this structure:
```markdown
---
name: {short title}
description: {one-line trigger — what situation this lesson applies to}
date: {YYYY-MM-DD}
tags: [topic1, topic2]
---
## What happened
{1-3 sentences: what was attempted, what went wrong, how it was resolved}
## Root cause
{Why the first approach didn't work — the actual underlying reason, not the symptom}
## Next time
{Concrete rule: when you encounter situation X, do Y first instead of Z}
```
## How to apply stored learnings
At the start of a task, if the task resembles a topic covered in `~/.claude/memory/`, read the relevant file(s) before acting. Use `ls ~/.claude/memory/` to scan available lessons; open files whose frontmatter `description` matches the current situation.
## Naming and deduplication
- Slug format: `<topic>_<specifics>.md` (e.g., `sata_hotplug_needs_bios.md`, `mkfs_after_wipefs.md`).
- Before writing a new file, `ls ~/.claude/memory/` and check if an existing file covers the same lesson — if so, update it rather than creating a duplicate.
- Keep each file focused on one lesson. Don't bundle unrelated learnings.
## Example triggers
- Mounted disks didn't appear via SCSI rescan → required reboot → record: `sata_hotplug_needs_bios_enable.md`
- `mount -a` silently skipped a new fstab entry because of a tab/space issue → record: `fstab_tab_separator.md`
- Tried `umount` but got "target is busy" because a background `du` was still running → record: `umount_busy_check_processes.md`
- `sudo -S` with heredoc consumed the password on stdin → record: `sudo_S_heredoc_stdin_conflict.md`