← 전체로 돌아가기
스킬 ai

Claude 학습 기록

Claude의 시행착오를 기록해 다음 작업에 활용하는 법.

claudememorylearningskillai-assistant

Claude가 작업 중 겪은 시행착오나 비효율적인 패턴을 ~/.claude/memory/에 기록해서 다음번에 같은 실수를 반복하지 않도록 하는 기능이야.

언제 기록해야 할까? (능동적으로)

작업이 끝날 때 다음 중 하나라도 해당되면 기록해야 함. * 재시도: 같은 작업을 2번 이상 시도했을 때 (예: 명령어 플래그 조정, 파일 재편집). * 첫 시도 실패: 처음 시도한 구현이나 명령어가 작동하지 않아 다른 방법으로 바꿨을 때. * 막다른 길 탐색: 특정 접근 방식에 시간을 썼지만 결국 포기했을 때. * 사용자가 "기록해", "학습해" 등으로 명시적으로 요청할 때도 기록함.

기록하지 말아야 할 때

  • 사소한 오타 수정.
  • 사용자 요청에 의한 방향 변경.
  • 프로젝트별 특정 상태 (글로벌 메모리 아님).
  • 이미 문서화된 내용이나 코드에서 바로 알 수 있는 내용.
  • 비밀번호, 토큰 등 민감 정보.

어떻게 기록할까?

각 기록은 ~/.claude/memory/<slug>.md 파일로 저장되며, 아래 구조를 따라야 함.

---
name: {짧은 제목}
description: {이 학습이 적용되는 상황 한 줄 요약}
date: {YYYY-MM-DD}
tags: [topic1, topic2]
---

## What happened
{무엇을 시도했고, 무엇이 잘못되었고, 어떻게 해결했는지}

## Root cause
{첫 시도가 실패한 근본적인 이유}

## Next time
{구체적인 규칙: X 상황을 만나면 Z 대신 Y를 먼저 해라}

기록된 학습 활용법

새로운 작업 시작 시, ls ~/.claude/memory/로 목록을 확인하고 현재 작업과 관련된 파일의 description을 보고 참고하면 됨.

ls ~/.claude/memory/

여기서 배울 것

  1. Claude의 시행착오를 `~/.claude/memory`에 기록해 재발 방지.
  2. 재시도, 첫 시도 실패, 막다른 길 탐색 시 능동적으로 기록.
  3. 기록 파일은 `name`, `description`, `date`, `tags`, `What happened`, `Root cause`, `Next time` 구조를 따름.
  4. 새 작업 전 관련 메모리를 확인해 과거 학습을 활용.
원본 파일 보기 (.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`