# Session Review

> Review code changes made by Claude in the current session. Reads session-tracked file list from /tmp, runs git diff, and produces a prioritized code review. Use when user says "/session-review", "session review", "세션 리뷰", or "이번 세션 리뷰".

- Skill: `jaykim88/session-review` (Agent Skill)
- Install (CLI): `npx skillmds@latest add jaykim88/session-review`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jaykim88/session-review/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: JayKim88 (https://skillmd.com/u/jaykim88)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/jaykim88/session-review

---


# Session Review Skill

Reviews all files that Claude wrote or edited in the current Claude Code session.
Uses a PostToolUse hook (`track-files.sh`) to track every Write/Edit, then diffs
against HEAD to produce a focused, scoped code review.

## Trigger Phrases

- `/session-review`
- "session review"
- "세션 리뷰"
- "이번 세션 리뷰"
- "이번 세션 코드 리뷰"

---

## Execution Algorithm

### Step 1: Load Session File List

Run the following shell commands to get the tracked files for this session:

```bash
# Get current session ID
SESSION=$(cat /tmp/cc-current-session.txt 2>/dev/null)
echo "Session: $SESSION"

# Get unique file paths for this session
if [ -n "$SESSION" ]; then
  grep "^${SESSION}|" /tmp/cc-files-all.txt 2>/dev/null \
    | cut -d'|' -f2- \
    | sort -u
fi
```

If session ID is empty or file list is empty:
- Warn: "세션 추적 파일이 없습니다. `track-files.sh` 훅이 활성화되어 있는지 확인하세요."
- Fallback: run `git status --short` to get currently modified files as a proxy

### Step 2: Filter to Git-Tracked Files

For each file in the list:
- Check if it exists on disk: `test -f "$FILE"`
- Check if it's inside a git repo: `git -C "$(dirname $FILE)" rev-parse 2>/dev/null`
- Only keep files that pass both checks

Report any skipped files (non-existent or outside git).

### Step 3: Generate Diffs

Run git diff for all tracked files at once:

```bash
# Show all changes (staged + unstaged) vs HEAD
git diff HEAD -- <file1> <file2> ...

# If a file has no diff vs HEAD (was already committed this session):
# show the last commit's diff for that file
git log --oneline -1 -- <file>
git show HEAD -- <file>
```

Also run:
```bash
git status -- <file1> <file2> ...
```

to show each file's current state (modified / new / staged).

### Step 4: Analyze and Review

Analyze ALL diffs together, understanding the session's changes as a whole.

For each issue found, classify:
- **Critical** — Bugs, security issues, data loss risk, broken logic
- **Important** — Missing error handling, incorrect types, violated patterns
- **Minor** — Naming, comments, unused variables, style

Output format:

```
## Session Review — [N] files changed

### Summary
[2-3 sentences: what was done this session, overall quality]

### Files Changed
- `path/to/file.ts` — [one-line description of changes]
- `path/to/file.py` — [one-line description of changes]

### Issues

#### Critical
- **[file:line]** Description of critical issue

#### Important
- **[file:line]** Description of important issue

#### Minor
- **[file:line]** Description of minor issue

### Positive Observations
[Non-obvious things that were done well — only include if genuinely notable]
```

If no issues found: "No significant issues found. Changes look clean."

### Step 5: Offer Actions

After the review output, ask:

```
리뷰 완료. 특정 파일이나 이슈를 더 자세히 살펴볼까요?
또는 발견된 이슈를 바로 수정할 수도 있습니다.
```

---

## Fallback: No Hook Data

If `/tmp/cc-current-session.txt` doesn't exist (hook not active):

1. Inform the user: "훅이 감지되지 않았습니다. `settings.json`에 `track-files.sh` 훅을 추가해주세요."
2. Show the setup instructions from the plugin README.
3. As a one-time fallback: run `git diff HEAD --name-only` to find all modified files,
   and review those instead (with a note that this is not session-scoped).

---

## Error Handling

| Situation | Response |
|-----------|----------|
| No session file | Warn + show hook setup instructions + offer git fallback |
| File deleted mid-session | Skip it, note "deleted during session" |
| File outside any git repo | Skip it, note path |
| Binary file | Skip it |
| Empty diff (committed) | Use `git show HEAD -- file` instead |
| Very large diff (>500 lines) | Summarize by section instead of line-by-line |

