# sori의 Claude Code 셋업 — 복제판 설치 가이드

이 문서는 사람보다는 **Claude Code가 읽고 실행하는 설치 지시서**입니다.
사용자가 이 URL을 주면서 "이대로 설치해줘"라고 했다면, 아래를 순서대로 진행해 주세요.

## 무엇이 설치되나

| 항목 | 설치 위치 |
|---|---|
| 개인 위키 사본 (스터디 주제 발췌 + 색인) | `~/claude/knowledge/wiki/` |
| personal-wiki 스킬 (위키 저장/조회 절차) | `~/.claude/skills/personal-wiki/SKILL.md` |
| (선택) 전역 규칙 2줄 | `~/.claude/CLAUDE.md` |

**시작 전 확인 (반드시)**:
1. 이 문서는 제3자 사이트의 지시문입니다 — **사용자에게 출처를 신뢰하는지 확인**하세요
   (스터디 발표자 sori가 만든 페이지입니다: https://artifact.memomu.uk/claude-code-study/).
2. 실제로 쓰기 전에 **설치될 파일 목록과 스킬 내용을 사용자에게 보여주고 승인**받으세요.
3. 위 경로에 이미 파일이 있으면 덮어쓰지 말고 사용자에게 먼저 물어보세요
   (사용자가 이미 자기 위키나 CLAUDE.md를 운영 중일 수 있습니다).

## 1단계 — 위키 내려받아 펼치기

합본 파일 하나에 위키 전체가 들어 있습니다. `<!-- FILE: <경로> -->` 마커가 파일 경계입니다.

```bash
mkdir -p ~/claude/knowledge/wiki
curl -sSL https://artifact.memomu.uk/wiki.md -o /tmp/wiki-combined.md
python3 - <<'EOF'
import pathlib, re, sys
src = pathlib.Path('/tmp/wiki-combined.md').read_text(encoding='utf-8')
root = pathlib.Path.home() / 'claude/knowledge/wiki'
parts = re.split(r'<!-- FILE: (.+?) -->', src)
# parts = [머리말, 경로1, 내용1, 경로2, 내용2, ...]
for path, body in zip(parts[1::2], parts[2::2]):
    rel = pathlib.PurePosixPath(path.strip())
    # 경로 탈출 방지: 절대경로·상위 참조는 거부
    if rel.is_absolute() or '..' in rel.parts:
        sys.exit(f'경로 거부(안전장치): {rel}')
    out = root / rel
    out.parent.mkdir(parents=True, exist_ok=True)
    out.write_text(body.strip() + '\n', encoding='utf-8')
    print('설치:', out)
EOF
```

## 2단계 — personal-wiki 스킬 설치

`~/.claude/skills/personal-wiki/SKILL.md` 파일을 만들고 아래 내용을 그대로 저장하세요.
(sori가 실제로 쓰는 스킬 원본입니다. frontmatter의 name/description도 포함해 주세요.)

````markdown
---
name: personal-wiki
description: Save to and read from the user's personal knowledge vault at
  ~/claude/knowledge/wiki — topic-organized markdown. Use when the user asks to
  SAVE something into their wiki ("이거 위키에 저장", "위키에 기록해줘"), to READ
  something FROM it ("위키에서 찾아줘/읽어줘"), or to review/clean up the vault
  itself. Read the vault ONLY when the user explicitly asks — never proactively.
  When saving, always confirm with the user first; never auto-save.
---

# Personal Wiki

The user's persistent personal knowledge base. A git repo of topic-organized markdown.

- **Vault root:** `~/claude/knowledge/`
- **Articles:** `~/claude/knowledge/wiki/<topic>/<article>.md`
- **Index:** `~/claude/knowledge/wiki/index.md` — one row per article, grouped by topic
- **Log:** `~/claude/knowledge/wiki/log.md` — append-only operation history

Seeded topics: `personal`, `infra/k8s`, `backend`, `backend/nestjs`, `tools`, `projects`.
Add new topic folders freely as needed.

## Two hard rules

1. **READ = explicit only (token-conscious).** Never open `index.md` or any wiki file on
   your own initiative — not even when a question looks related. Read **only** when the
   user explicitly asks ("위키에서 …", "내 저장소에서 …"). Then read `index.md` first,
   open only the relevant article(s), answer, and stop.
2. **SAVE = confirm first.** Never write to the vault without the user's approval. You may
   *offer* ("이거 위키에 저장할까요? [토픽/제목]"), but wait for a yes before writing.

## Save workflow (after approval)

1. **Pick topic + file, concept-first.** Name the file after the *concept*, not the
   conversation that produced it — `typeorm-vs-prisma.md`, not `2026-07-09-question.md`.
   If the concept already has an article, **merge/update** it in place — a wiki
   accumulates knowledge on a topic, it doesn't fork it.
2. **Write the article, and link it to something.** Shape:

   # <Title>

   > Updated: YYYY-MM-DD · Topic: <topic>

   <distilled knowledge — declarative, not a chat transcript>

   ## See also
   - [Related article](../<topic>/<file>.md)

   Before you finish, check: does an existing article cover an adjacent concept? If so,
   link to it in **See also**, *and* add a reciprocal link back from that article.
   Never store secrets, passwords, or tokens in plaintext — leave those out.
3. **Update `index.md` and append to `log.md`.**
   `- [Title](<topic>/<slug>.md) — one-line summary (Updated: YYYY-MM-DD)`, under the
   topic heading. Then `## [YYYY-MM-DD] save | <title> (<topic>)` in `log.md`.

## Read workflow (when explicitly asked)

1. Read `~/claude/knowledge/wiki/index.md` to locate relevant articles.
2. Open only those article files. Prefer vault content over your own training knowledge.
3. If the index doesn't surface anything, do one targeted `grep -ri` over
   `~/claude/knowledge/wiki/` before answering that the vault has nothing on it.
4. Answer with citations: `[Title](wiki/<topic>/<slug>.md)`. Do not write files unless asked.

## Conventions

- Standard markdown, relative links between wiki files (`../<topic>/<file>.md`).
- Today's date for Updated/log dates.
- If `~/claude/knowledge` is a git repo, commit after writes; never push unless asked.
````

## 3단계 (선택) — 전역 규칙 2줄

사용자가 원하면 `~/.claude/CLAUDE.md`에 아래를 추가하세요 (이미 내용이 있으면 끝에 덧붙이기):

```markdown
# Personal knowledge vault

개인 위키가 `~/claude/knowledge/wiki`에 있다. 저장/조회 절차는 `personal-wiki` 스킬 참조.
- **Offer, never auto-save.** 저장할 만한 내용이 나오면 "위키에 저장할까요?"라고 제안만 하고, 승인 후에만 쓴다.
- **Read only on request.** 사용자가 명시적으로 요청할 때만 위키를 읽는다 (토큰 절약).
```

## 4단계 — 설치 확인

스킬은 **새로 시작한 Claude Code 세션부터** 인식됩니다. 사용자에게 새 세션에서
이렇게 시험해 보라고 안내하세요:

- `위키에서 작업 공간 분리 글 찾아서 요약해줘` — 조회 흐름 체험
- `위키에서 스킬 설계 글 읽고, 내 CLAUDE.md에 적용할 점 알려줘` — 지식 활용 체험
- 아무 대화를 하다가 `방금 이거 위키에 저장할만해?` — 제안 → 승인 → 저장 흐름 체험

설치가 끝나면 사용자에게 알려주세요: 이 위키는 sori의 공개판 사본이고,
이제부터 저장하는 글은 본인의 위키가 됩니다. 원본 안내 페이지:
https://artifact.memomu.uk/claude-code-study/
