Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

session-reflection-analysis

БесплатноБез исполняемых скриптовНе проверен

Use when asked to reflect on how the session went

harperreedот harperreed★ 339 звёзд на GitHub15 установок в других каталогах

Об этом скилле

Session Reflection Analysis

Analyze recent chat history to identify improvement opportunities and reduce token waste in future sessions.

Overview

This skill helps identify patterns of inefficiency in Claude Code sessions by analyzing session history. The analysis focuses on actionable improvements to documentation, automation, and workflows.

Step 1: Locate Project Sessions

First, find the correct project folder. Claude Code stores sessions at ~/.claude/projects/ with folder names derived from the project path (slashes become dashes, colons become double-dashes).

# List available project folders
ls -la ~/.claude/projects/

# Find the current project's session folder by matching the working directory
# Example: /Users/harper/src/myproject -> -Users-harper-src-myproject
CURRENT_PATH=$(pwd | sed 's|^/||; s|/|-|g')
PROJECT_DIR="$HOME/.claude/projects/-${CURRENT_PATH}"

# Verify it exists
if [ -d "$PROJECT_DIR" ]; then
    echo "Found project dir: $PROJECT_DIR"
    ls -la "$PROJECT_DIR"/*.jsonl 2>/dev/null | head -5
else
    echo "No session folder found for current project"
    echo "Available projects:"
    ls ~/.claude/projects/
fi

Step 2: Generate Session Summary

CRITICAL: Do NOT read raw session files directly. They are massive and will consume your entire token budget.

First, verify jq is available:

if ! command -v jq &> /dev/null; then
    echo "ERROR: jq is required but not installed"
    echo "Install with: brew install jq (macOS) or apt install jq (Linux)"
    exit 1
fi

Then use jq to generate a 98% token-reduced summary:

# Set project dir (adjust if auto-detection didn't work)
PROJECT_DIR="$HOME/.claude/projects/-Users-harper-Public-src-2389-matrix-productivity"  # Update this path!
OUTPUT="/tmp/session-summary.jsonl"

# Optional: Only analyze sessions from last N days
DAYS_BACK=7
CUTOFF_DATE=$(date -v-${DAYS_BACK}d +%Y-%m-%d 2>/dev/null || date -d "${DAYS_BACK} days ago" +%Y-%m-%d)

# Summarize: extract user requests, tool names, assistant text (truncated)
cat "$PROJECT_DIR"/*.jsonl 2>/dev/null | jq -c '
select(.type == "user" or .type == "assistant") |
{
  type,
  ts: .timestamp,
  content: (
    if .message.content | type == "string" then
      .message.content[0:300]
    elif .message.content | type == "array" then
      [.message.content[] |
        if .type == "text" then {t: "text", v: .text[0:300]}
        elif .type == "tool_use" then {t: "tool", v: .name}
        elif .type == "tool_result" then {t: "result", len: (.content | length)}
        elif .type == "thinking" then empty
        else {t: .type}
        end
      ]
    else null
    end
  )
}' > "$OUTPUT" 2>/dev/null

echo "Summary: $(wc -l < "$OUTPUT") messages, $(wc -c < "$OUTPUT" | xargs) bytes"

This extracts:

  • User message text (first 300 chars)
  • Tool calls (name only, not full output)
  • Tool result sizes (not content)
  • Timestamps for sequence analysis

Step 3: Launch Subagent for Analysis

Use the Task tool to spawn an analysis subagent:

Task tool parameters:
- subagent_type: "Explore"
- prompt: |
    Analyze the session summary at /tmp/session-summary.jsonl for inefficiency patterns.

    Read the file and look for these patterns:

    | Pattern | Example | Impact |
    |---------|---------|--------|
    | **Wasted tokens** | Re-reading same file 5+ times | High |
    | **Wrong paths taken** | Implemented feature, then discovered existing code | Medium-High |
    | **Repeated mistakes** | Same error type in 3+ instances | Medium |
    | **Missing automation** | Manual steps repeated across sessions | Medium |
    | **Missing documentation** | Had to figure out what should be in CLAUDE.md | Medium |
    | **Unnecessary tool calls** | Called multiple tools when one would work | Low-Medium |
    | **Context loss after compaction** | Info that should survive in persistent docs | High |
    | **Assumption without verification** | Decisions made without checking existing code | High |

    For each pattern found, propose improvements as:
    1. CLAUDE.md updates
    2. New skills for .claude/skills/
    3. New slash commands for .claude/commands/
    4. Script automation
    5. Git hooks
    6. Workflow changes

    Make all proposals copy-paste ready with complete text/code.
    Quantify impact where possible (tokens saved, time saved).
    Be specific with examples from the actual session data.

Step 4: Create Reflection Document

The subagent should generate a document with this structure:

# Session Reflection: YYYY-MM-DD

## Summary Statistics
- Session date range: [start] to [end]
- Messages analyzed: [count]
- Major inefficiencies found: [count]

## Proposed Improvements

### High Priority

#### 1. [Problem Title]

**Problem observed**: [What went wrong - be specific with examples]

**Proposed solution**:

[Complete text/code to add or change - copy-paste ready]


**File to modify**: `path/to/file.md`

**Cost**: [Effort to impl
Полный SKILL.md на GitHub

Установить session-reflection-analysis в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл session-reflection-analysis?

Use when asked to reflect on how the session went

Как установить скилл session-reflection-analysis?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл session-reflection-analysis запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить session-reflection-analysis с